Go to the documentation of this file.
12 #ifndef RTCTK_COMPONENTFRAMEWORK_EVENTDEFINITIONS_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_EVENTDEFINITIONS_HPP
17 #include <boost/core/demangle.hpp>
24 return boost::core::demangle((
typeid(T).
name()));
28 using namespace std::chrono;
29 return duration_cast<nanoseconds>(system_clock::now().time_since_epoch()).count();
50 payload[
"type"] = std::vector<std::string>();
51 payload[
"origin"] =
origin;
52 payload[
"time"] =
time;
66 inline static const std::string
TOPIC_NAME =
"computation_topic";
82 payload[
"type"].push_back(PrettyTypeName<ComputationEvent>());
83 payload[
"item"] =
item;
84 payload[
"state"] =
state;
105 payload[
"type"].push_back(PrettyTypeName<ComputationStartedEvent>());
119 std::string
const&
item,
130 payload[
"type"].push_back(PrettyTypeName<ComputationFinishedEvent>());
131 payload[
"result"] =
result;
144 inline static const std::string
TOPIC_NAME =
"configuration_topic";
151 std::vector<std::string>
const&
items,
152 std::string
const&
state)
162 payload[
"type"].push_back(PrettyTypeName<ConfigurationEvent>());
163 payload[
"items"] =
items;
164 payload[
"state"] =
state;
189 payload[
"type"].push_back(PrettyTypeName<ConfigurationUpdatedEvent>());
211 payload[
"type"].push_back(PrettyTypeName<ConfigurationRetrievedEvent>());
222 std::string
const& item,
241 payload[
"type"].push_back(PrettyTypeName<HrtcConfigurationScheduledEvent>());
258 std::string
const& item,
277 payload[
"type"].push_back(PrettyTypeName<HrtcConfigurationAppliedEvent>());
295 inline static const std::string
TOPIC_NAME =
"coordination_topic";
305 payload[
"type"].push_back(PrettyTypeName<CoordinationEvent>());
315 std::string
const&
entity,
316 std::string
const&
state)
330 payload[
"type"].push_back(PrettyTypeName<StateChangedEvent>());
331 payload[
"state"] =
state;
332 payload[
"entity"] =
entity;
345 std::string
const&
entity,
346 std::string
const&
state,
362 payload[
"type"].push_back(PrettyTypeName<HrtcStateChangedEvent>());
379 inline static const std::string
TOPIC_NAME =
"alert_status_topic";
420 json[
"status"].get_to(
status);
421 for (
auto&& active : json[
"active_alerts"]) {
423 active[
"id"].get_to(alert.
id);
425 active[
"origin"].get_to(alert.
origin);
426 active[
"since"].get_to(alert.
since);
436 payload[
"type"].push_back(PrettyTypeName<AlertStatusEvent>());
437 payload[
"status"] =
status;
440 json_active.push_back(
JsonPayload{{
"origin", alert.origin},
442 {
"description", alert.description},
443 {
"since", alert.since}});
445 payload[
"active_alerts"] = std::move(json_active);
458 #endif // RTCTK_COMPONENTFRAMEWORK_EVENTDEFINITIONS_HPP
std::vector< Alert > active_alerts
Definition: eventDefinitions.hpp:453
ComputationFinishedEvent(std::string const &origin, std::string const &item)
Definition: eventDefinitions.hpp:114
Abstract Event Type that is used as a base for computation events.
Definition: eventDefinitions.hpp:65
ConfigurationEvent(std::string const &origin, std::vector< std::string > const &items, std::string const &state)
Definition: eventDefinitions.hpp:150
name
Definition: wscript:15
AbstractEvent(JsonPayload const &payload)
Definition: eventDefinitions.hpp:42
uint64_t hrtc_sample_id
Definition: eventDefinitions.hpp:286
ComputationFinishedEvent(std::string const &origin, std::string const &item, JsonPayload const &result)
Definition: eventDefinitions.hpp:118
JsonPayload ToJson() const
Definition: eventDefinitions.hpp:160
ConfigurationUpdatedEvent(std::string const &origin, std::string const &item)
Definition: eventDefinitions.hpp:176
ConfigurationRetrievedEvent(std::string const &origin, std::string const &item)
Definition: eventDefinitions.hpp:198
ConfigurationUpdatedEvent(std::string const &origin, std::vector< std::string > const &items)
Definition: eventDefinitions.hpp:180
bool status
Reduced alert status.
Definition: eventDefinitions.hpp:452
uint64_t hrtc_sample_id
Definition: eventDefinitions.hpp:369
AlertStatusEvent(JsonPayload const &json)
Construct by deserializing from JSON.
Definition: eventDefinitions.hpp:419
std::string origin
Definition: eventDefinitions.hpp:56
ComputationEvent(std::string const &origin, std::string const &item)
Definition: eventDefinitions.hpp:72
ComputationFinishedEvent(JsonPayload const &payload)
Definition: eventDefinitions.hpp:124
ComputationEvent(std::string const &origin, std::string const &item, std::string const &state)
Definition: eventDefinitions.hpp:68
ComputationStartedEvent(std::string const &origin, std::string const &item)
Definition: eventDefinitions.hpp:96
Event Type used to signal that a configuration data item was applied in HRTC.
Definition: eventDefinitions.hpp:256
Definition: commandReplier.cpp:20
AlertStatusEvent(bool st, std::vector< Alert > ac, std::string const &origin)
Construct by providing members.
Definition: eventDefinitions.hpp:412
Abstract Event Type that is used as a base for configuration events.
Definition: eventDefinitions.hpp:143
uint64_t GetTimestamp()
Definition: eventDefinitions.hpp:27
Represents an active alert originating from a component instance.
Definition: eventDefinitions.hpp:387
CoordinationEvent(JsonPayload const &payload)
Definition: eventDefinitions.hpp:300
Event Type used to signal that a computation has started.
Definition: eventDefinitions.hpp:95
std::string PrettyTypeName()
Definition: eventDefinitions.hpp:23
JsonPayload ToJson() const
Definition: eventDefinitions.hpp:80
std::string origin
Component instance origin.
Definition: eventDefinitions.hpp:391
HrtcStateChangedEvent(std::string const &origin, std::string const &entity, std::string const &state, uint64_t hrtc_timestamp, uint64_t hrtc_sample_id)
Definition: eventDefinitions.hpp:344
ConfigurationUpdatedEvent(JsonPayload const &payload)
Definition: eventDefinitions.hpp:184
JsonPayload ToJson() const
Definition: eventDefinitions.hpp:103
HrtcConfigurationScheduledEvent(std::string const &origin, std::string const &item, std::string const &hrtc_origin, uint64_t hrtc_timestamp, uint64_t hrtc_sample_id)
Definition: eventDefinitions.hpp:221
JsonPayload ToJson() const
Definition: eventDefinitions.hpp:275
static const std::string TOPIC_NAME
Definition: eventDefinitions.hpp:379
Event Type used to signal that some entity changed its state.
Definition: eventDefinitions.hpp:313
ConfigurationRetrievedEvent(JsonPayload const &payload)
Definition: eventDefinitions.hpp:206
uint64_t hrtc_timestamp
Definition: eventDefinitions.hpp:368
uint64_t hrtc_sample_id
Definition: eventDefinitions.hpp:250
std::string description
Description of alert.
Definition: eventDefinitions.hpp:401
ComputationStartedEvent(JsonPayload const &payload)
Definition: eventDefinitions.hpp:100
std::string state
Definition: eventDefinitions.hpp:337
HrtcConfigurationAppliedEvent(JsonPayload const &payload)
Definition: eventDefinitions.hpp:268
static const std::string TOPIC_NAME
Definition: eventDefinitions.hpp:144
Abstract Event Type that is used as a base for coordination events.
Definition: eventDefinitions.hpp:294
Event Type used to signal that a configuration data item was updated in RTR.
Definition: eventDefinitions.hpp:175
StateChangedEvent(JsonPayload const &payload)
Definition: eventDefinitions.hpp:324
JsonPayload ToJson() const
Serialize to JSON.
Definition: eventDefinitions.hpp:434
ConfigurationEvent(JsonPayload const &payload)
Definition: eventDefinitions.hpp:156
JsonPayload ToJson() const
Definition: eventDefinitions.hpp:48
JsonPayload ToJson() const
Definition: eventDefinitions.hpp:328
std::string state
Definition: eventDefinitions.hpp:169
Defines the JSON payload type JsonPayload.
std::vector< std::string > items
Definition: eventDefinitions.hpp:168
static const std::string TOPIC_NAME
Definition: eventDefinitions.hpp:66
JsonPayload ToJson() const
Definition: eventDefinitions.hpp:303
HrtcConfigurationAppliedEvent(std::string const &origin, std::string const &item, std::string const &hrtc_origin, uint64_t hrtc_timestamp, uint64_t hrtc_sample_id)
Definition: eventDefinitions.hpp:257
Event published when alert status is changed.
Definition: eventDefinitions.hpp:378
JsonPayload ToJson() const
Definition: eventDefinitions.hpp:128
JsonPayload ToJson() const
Definition: eventDefinitions.hpp:187
std::string id
Alert identifier which is unique to the origin.
Definition: eventDefinitions.hpp:396
HrtcConfigurationScheduledEvent(JsonPayload const &payload)
Definition: eventDefinitions.hpp:232
Abstract Event Type that is used as a base for all events.
Definition: eventDefinitions.hpp:39
Definition: mudpiProcessingError.hpp:119
uint64_t time
Definition: eventDefinitions.hpp:57
static const std::string TOPIC_NAME
Definition: eventDefinitions.hpp:295
AbstractEvent(std::string const &origin)
Definition: eventDefinitions.hpp:45
Event Type used to signal that a computation has finished.
Definition: eventDefinitions.hpp:113
StateChangedEvent(std::string const &origin, std::string const &entity, std::string const &state)
Definition: eventDefinitions.hpp:314
JsonPayload result
Definition: eventDefinitions.hpp:135
std::string item
Definition: eventDefinitions.hpp:88
std::uint64_t since
Timestamp when alert was first made active.
Definition: eventDefinitions.hpp:406
HrtcStateChangedEvent(JsonPayload const &payload)
Definition: eventDefinitions.hpp:354
JsonPayload ToJson() const
Definition: eventDefinitions.hpp:239
CoordinationEvent(std::string const &origin)
Definition: eventDefinitions.hpp:297
ConfigurationRetrievedEvent(std::string const &origin, std::vector< std::string > const &items)
Definition: eventDefinitions.hpp:202
std::string hrtc_origin
Definition: eventDefinitions.hpp:284
ComputationEvent(JsonPayload const &payload)
Definition: eventDefinitions.hpp:76
uint64_t hrtc_timestamp
Definition: eventDefinitions.hpp:285
ConfigurationEvent(std::string const &origin, std::string const &item, std::string const &state)
Definition: eventDefinitions.hpp:146
StateChangedEvent(std::string const &origin, std::string const &state)
Definition: eventDefinitions.hpp:320
Event Type used to signal that a configuration data item was retrieved from RTR.
Definition: eventDefinitions.hpp:197
nlohmann::json JsonPayload
Type requirements:
Definition: jsonPayload.hpp:24
std::string state
Definition: eventDefinitions.hpp:89
Event Type used to signal that a configuration data item was scheduled to be applied in HRTC.
Definition: eventDefinitions.hpp:220
std::string hrtc_origin
Definition: eventDefinitions.hpp:248
JsonPayload ToJson() const
Definition: eventDefinitions.hpp:360
std::string entity
Definition: eventDefinitions.hpp:336
Event Type used to signal that some entity in HRTC changed its state.
Definition: eventDefinitions.hpp:343
uint64_t hrtc_timestamp
Definition: eventDefinitions.hpp:249
JsonPayload ToJson() const
Definition: eventDefinitions.hpp:209