Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
structs.hpp
Go to the documentation of this file.
1#ifndef IV_SRC_ALARMS_STRUCTS_HPP_
2#define IV_SRC_ALARMS_STRUCTS_HPP_
3
4#include "alarms/enums.hpp"
6#include "core/Timestamp.hpp"
7#include "core/constants.hpp"
8#include "core/defines.hpp"
9#include "model/structs.hpp"
10#include "third_party/magic_enum/magic_enum.hpp"
11
12namespace iv::alarms
13{
14
15struct Alarm
16{
17 //Overload operator << for std::cout
18 friend std::ostream &operator<<(std::ostream &os, const Alarm &alarm)
19 {
20 os << "Priority: " << magic_enum::enum_name(alarm.alarmPriority)
21 << " State: " << magic_enum::enum_name(alarm.alarmState)
22 << " Type: " << magic_enum::enum_name(alarm.alarmType) << " Value: " << alarm.value
23 << " Timestamp: " << alarm.timestamp;
24 return os;
25 }
26
32 bool hasValidAlarm {false};
33};
34
35struct Event
36{
37 Event() = default;
38 Event(std::string _tag, std::string _message, const iv::alarms::Alarm &_alarm, const bool _isPrinted = false)
39 : tag(std::move(_tag)), message(std::move(_message)), alarm(_alarm), isPrinted(_isPrinted)
40 {
41 }
42 Event(const Event &other) = default;
43
44 Event &operator=(const Event &other) = default;
45
46 // Comparison operator for std::find
47 bool operator==(const Event &other) const
48 {
49 return tag == other.tag;
50 }
51
52 // Comparison operator for std::sort
53 bool operator<(const Event &other) const
54 {
55 return std::tie(alarm.timestamp, tag) > std::tie(other.alarm.timestamp, other.tag);
56 }
57
58 //Overload operator << for std::cout
59 friend std::ostream &operator<<(std::ostream &os, const Event &event)
60 {
61 os << "Tag: " << event.tag << " Message: " << event.message << " Alarm[ " << event.alarm << " ]";
62 return os;
63 }
64
66 std::string message;
68 bool isPrinted {false};
69};
70
72{
74 {
76 std::string name;
78 };
79
85
86 bool hasStartDate {false};
87 bool hasEndDate {false};
90
91 bool hasTags {false};
92 std::vector<iv::types::channelId> channelsTags {9};
93 bool hasGroups {false};
94 std::vector<GroupFilter> groups;
95 bool hasUnitsIds {false};
96 std::vector<UnitFilter> unitsIds;
97
99};
100
122
123}// namespace iv::alarms
124
125#endif//IV_SRC_ALARMS_STRUCTS_HPP_
Definition Timestamp.hpp:17
iv::types::milliseconds inMilliseconds() const
Definition Timestamp.hpp:136
Definition AlarmsManager.cpp:18
eCallAllStatus
Definition enums.hpp:79
eAlarmPriority
Definition enums.hpp:13
eAlarmRepeatType
Definition enums.hpp:107
eWatchState
Definition enums.hpp:90
eAlarmType
Definition enums.hpp:56
eIsNodeOnDuty
Definition enums.hpp:73
eAlarmState
Definition enums.hpp:20
static constexpr iv::types::channelValue channelValueInvalid
Definition constants.hpp:14
uint64_t timestamp
Definition types.hpp:21
uint16_t unitId
Definition types.hpp:77
double channelValue
Definition types.hpp:67
std::string channelId
Definition types.hpp:66
std::string groupId
Definition types.hpp:70
Definition AlarmsManager.cpp:18
Definition structs.hpp:16
iv::alarms::eAlarmType alarmType
Definition structs.hpp:29
iv::types::channelValue value
Definition structs.hpp:30
iv::types::timestamp timestamp
Definition structs.hpp:31
friend std::ostream & operator<<(std::ostream &os, const Alarm &alarm)
Definition structs.hpp:18
bool hasValidAlarm
Definition structs.hpp:32
iv::alarms::eAlarmState alarmState
Definition structs.hpp:28
iv::alarms::eAlarmPriority alarmPriority
Definition structs.hpp:27
Definition structs.hpp:36
iv::alarms::Alarm alarm
Definition structs.hpp:67
Event(std::string _tag, std::string _message, const iv::alarms::Alarm &_alarm, const bool _isPrinted=false)
Definition structs.hpp:38
Event & operator=(const Event &other)=default
friend std::ostream & operator<<(std::ostream &os, const Event &event)
Definition structs.hpp:59
bool isPrinted
Definition structs.hpp:68
std::string message
Definition structs.hpp:66
iv::types::channelId tag
Definition structs.hpp:65
bool operator==(const Event &other) const
Definition structs.hpp:47
Event(const Event &other)=default
bool operator<(const Event &other) const
Definition structs.hpp:53
bool isActive
Definition structs.hpp:77
iv::types::groupId groupId
Definition structs.hpp:75
std::string name
Definition structs.hpp:76
Definition structs.hpp:81
iv::types::unitId id
Definition structs.hpp:82
bool isActive
Definition structs.hpp:83
Definition structs.hpp:72
std::vector< UnitFilter > unitsIds
Definition structs.hpp:96
bool hasStartDate
Definition structs.hpp:86
std::vector< GroupFilter > groups
Definition structs.hpp:94
std::vector< iv::types::channelId > channelsTags
Definition structs.hpp:92
iv::types::timestamp startDate
Definition structs.hpp:88
iv::comms::api::ApiPaginationInfo paginationInfo
Definition structs.hpp:98
iv::types::timestamp endDate
Definition structs.hpp:89
bool hasEndDate
Definition structs.hpp:87
bool hasUnitsIds
Definition structs.hpp:95
bool hasGroups
Definition structs.hpp:93
bool hasTags
Definition structs.hpp:91
Definition structs.hpp:102
iv::alarms::eWatchState dutyState
Definition structs.hpp:118
iv::alarms::eAlarmRepeatType alarmRepeatType
Definition structs.hpp:120
watchcallNodeStatus(iv::alarms::eIsNodeOnDuty _isThisStationOnDuty, iv::alarms::eWatchState _dutyState, iv::alarms::eCallAllStatus callAll, iv::alarms::eAlarmRepeatType _alarmRepeatType)
Definition structs.hpp:110
watchcallNodeStatus()
Definition structs.hpp:103
iv::alarms::eCallAllStatus callAllStatus
Definition structs.hpp:119
iv::alarms::eIsNodeOnDuty isThisNodeOnDuty
Definition structs.hpp:117
Definition structs.hpp:19