13#ifndef RTCTK_COMPONENTFRAMEWORK_EVENTDEFINITIONS_HPP
14#define RTCTK_COMPONENTFRAMEWORK_EVENTDEFINITIONS_HPP
19#include <boost/core/demangle.hpp>
30 return boost::core::demangle((
typeid(T).name()));
41template <
typename EventType>
43 if (
j.contains(
"type")) {
59template <
typename EventType>
87 [[deprecated(
"Use from_json instead.")]]
90 [[deprecated(
"Use to_json instead.")]]
112 inline static const std::string
TOPIC_NAME =
"computation_topic";
120 [[deprecated(
"Use from_json instead.")]]
123 [[deprecated(
"Use to_json instead.")]]
146 [[deprecated(
"Use from_json instead.")]]
149 [[deprecated(
"Use to_json instead.")]]
168 const std::string&
item,
171 [[deprecated(
"Use from_json instead.")]]
174 [[deprecated(
"Use to_json instead.")]]
192 inline static const std::string
TOPIC_NAME =
"configuration_topic";
234 const std::string&
state);
240 const std::string& item,
241 const std::string&
state);
247 const std::vector<std::string>&
items,
248 const std::string&
state);
250 [[deprecated(
"Use from_json instead.")]]
253 [[deprecated(
"Use to_json instead.")]]
294 [[deprecated(
"Use from_json instead.")]]
297 [[deprecated(
"Use to_json instead.")]]
335 [[deprecated(
"Use from_json instead.")]]
338 [[deprecated(
"Use to_json instead.")]]
380 [[deprecated(
"Use ctor with Item and TimeString instead.")]]
382 const std::string& item,
387 [[deprecated(
"Use from_json instead.")]]
390 [[deprecated(
"Use to_json instead.")]]
435 [[deprecated(
"Use ctor with Item and TimeString instead.")]]
437 const std::string& item,
442 [[deprecated(
"Use from_json instead.")]]
445 [[deprecated(
"Use to_json instead.")]]
465 inline static const std::string
TOPIC_NAME =
"coordination_topic";
471 [[deprecated(
"Use from_json instead.")]]
474 [[deprecated(
"Use to_json instead.")]]
493 const std::string&
entity,
494 const std::string&
state);
498 [[deprecated(
"Use from_json instead.")]]
501 [[deprecated(
"Use to_json instead.")]]
528 [[deprecated(
"Use from_json instead.")]]
531 [[deprecated(
"Use to_json instead.")]]
557 inline static const std::string
TOPIC_NAME =
"alert_status_topic";
Defines the JSON payload type JsonPayload.
Definition commandReplier.cpp:22
void to_json(JsonPayload &j, const std::vector< DataPointPath > &v)
Definition dataPointPath.cpp:207
std::optional< EventType > ConvertTo(const JsonPayload &j)
Helper to convert to certain EventType if possible.
Definition eventDefinitions.hpp:60
bool ConvertibleTo(const JsonPayload &j)
Helper to check if JsonPayload is convertible to a certain EventType.
Definition eventDefinitions.hpp:42
nlohmann::json JsonPayload
Type requirements:
Definition jsonPayload.hpp:25
void from_json(const JsonPayload &j, std::vector< DataPointPath > &v)
Definition dataPointPath.cpp:217
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23
std::string PrettyTypeName()
Definition eventDefinitions.hpp:29
Abstract Event Type that is used as a base for all events.
Definition eventDefinitions.hpp:78
TimeString time
Definition eventDefinitions.hpp:94
std::string origin
Definition eventDefinitions.hpp:93
virtual ~AbstractEvent()=default
JsonPayload ToJson() const
Definition eventDefinitions.cpp:35
Represents an active alert originating from a component instance.
Definition eventDefinitions.hpp:565
std::string origin
Component instance origin.
Definition eventDefinitions.hpp:569
TimeString since
Timestamp when alert was first made active.
Definition eventDefinitions.hpp:584
std::string id
Alert identifier which is unique to the origin.
Definition eventDefinitions.hpp:574
std::string description
Description of alert.
Definition eventDefinitions.hpp:579
Event published when alert status is changed.
Definition eventDefinitions.hpp:553
AlertStatusEvent()=default
static const std::string TOPIC_NAME
Definition eventDefinitions.hpp:557
bool status
Reduced alert status.
Definition eventDefinitions.hpp:595
std::vector< Alert > active_alerts
List of active alerts.
Definition eventDefinitions.hpp:600
Abstract Event Type that is used as a base for computation events.
Definition eventDefinitions.hpp:111
ComputationEvent()=default
JsonPayload ToJson() const
Definition eventDefinitions.cpp:70
std::string item
Definition eventDefinitions.hpp:126
std::string state
Definition eventDefinitions.hpp:127
static const std::string TOPIC_NAME
Definition eventDefinitions.hpp:112
Event Type used to signal that a computation has finished.
Definition eventDefinitions.hpp:164
ComputationFinishedEvent()=default
JsonPayload ToJson() const
Definition eventDefinitions.cpp:126
JsonPayload result
Definition eventDefinitions.hpp:177
Event Type used to signal that a computation has started.
Definition eventDefinitions.hpp:141
ComputationStartedEvent()=default
JsonPayload ToJson() const
Definition eventDefinitions.cpp:99
Represents a single configuration item.
Definition eventDefinitions.hpp:201
bool operator==(const Item &) const =default
std::string name
PathName of the configuration item.
Definition eventDefinitions.hpp:205
std::optional< TimeString > timestamp
(Optional) Timestamp of the configuration item.
Definition eventDefinitions.hpp:210
std::optional< uint64_t > sequence_id
(Optional) SequenceId of the configuration item.
Definition eventDefinitions.hpp:215
Abstract Event Type that is used as a base for configuration events.
Definition eventDefinitions.hpp:191
ConfigurationEvent()=default
static const std::string TOPIC_NAME
Definition eventDefinitions.hpp:192
std::vector< Item > ItemList
Definition eventDefinitions.hpp:220
std::string state
Definition eventDefinitions.hpp:257
ItemList items
Definition eventDefinitions.hpp:256
JsonPayload ToJson() const
Definition eventDefinitions.cpp:176
Event Type used to signal that configuration data items were retrieved from RTR.
Definition eventDefinitions.hpp:312
JsonPayload ToJson() const
Definition eventDefinitions.cpp:294
ConfigurationRetrievedEvent()=default
Event Type used to signal that configuration data items were updated in RTR.
Definition eventDefinitions.hpp:271
ConfigurationUpdatedEvent()=default
JsonPayload ToJson() const
Definition eventDefinitions.cpp:253
Abstract Event Type that is used as a base for coordination events.
Definition eventDefinitions.hpp:464
JsonPayload ToJson() const
Definition eventDefinitions.cpp:438
static const std::string TOPIC_NAME
Definition eventDefinitions.hpp:465
CoordinationEvent()=default
Event Type used to signal that configuration data items were applied in HRTC.
Definition eventDefinitions.hpp:409
HrtcConfigurationAppliedEvent()=default
uint64_t hrtc_sample_id
Definition eventDefinitions.hpp:450
TimeString hrtc_timestamp
Definition eventDefinitions.hpp:449
std::string hrtc_origin
Definition eventDefinitions.hpp:448
JsonPayload ToJson() const
Definition eventDefinitions.cpp:408
Event Type used to signal that configuration data items were scheduled to be applied in HRTC.
Definition eventDefinitions.hpp:354
HrtcConfigurationScheduledEvent()=default
uint64_t hrtc_sample_id
Definition eventDefinitions.hpp:395
JsonPayload ToJson() const
Definition eventDefinitions.cpp:348
TimeString hrtc_timestamp
Definition eventDefinitions.hpp:394
std::string hrtc_origin
Definition eventDefinitions.hpp:393
Event Type used to signal that some entity in HRTC changed its state.
Definition eventDefinitions.hpp:519
HrtcStateChangedEvent()=default
TimeString hrtc_timestamp
Definition eventDefinitions.hpp:534
JsonPayload ToJson() const
Definition eventDefinitions.cpp:504
uint64_t hrtc_sample_id
Definition eventDefinitions.hpp:535
Event Type used to signal that some entity changed its state.
Definition eventDefinitions.hpp:489
JsonPayload ToJson() const
Definition eventDefinitions.cpp:469
StateChangedEvent()=default
std::string entity
Definition eventDefinitions.hpp:504
std::string state
Definition eventDefinitions.hpp:505
Represents an ISO 8601 time string in format: YYYY-MM-DDThh:mm:ss.sssZ.
Definition timeString.hpp:28
A timestring in ISO-8601 format.