trigger_actions.hpp (d960e1f37e72115fdd8ec0163c99bb19e0487b91) trigger_actions.hpp (f763c9e3bbe0f86a4a41e7bb0dc70bffde0af9b2)
1#pragma once
2
3#include "interfaces/report_manager.hpp"
4#include "interfaces/trigger_action.hpp"
5#include "interfaces/trigger_types.hpp"
6
7namespace action
8{
9
1#pragma once
2
3#include "interfaces/report_manager.hpp"
4#include "interfaces/trigger_action.hpp"
5#include "interfaces/trigger_types.hpp"
6
7namespace action
8{
9
10namespace numeric
11{
10class LogToJournal : public interfaces::TriggerAction
11{
12 public:
12class LogToJournal : public interfaces::TriggerAction
13{
14 public:
13 LogToJournal(numeric::Type type, double val) : type(type), threshold(val)
15 LogToJournal(::numeric::Type type, double val) : type(type), threshold(val)
14 {}
15
16 void commit(const std::string& id, uint64_t timestamp,
17 double value) override;
18
19 private:
16 {}
17
18 void commit(const std::string& id, uint64_t timestamp,
19 double value) override;
20
21 private:
20 numeric::Type type;
22 ::numeric::Type type;
21 double threshold;
22
23 const char* getType() const;
24};
25
26class LogToRedfish : public interfaces::TriggerAction
27{
28 public:
23 double threshold;
24
25 const char* getType() const;
26};
27
28class LogToRedfish : public interfaces::TriggerAction
29{
30 public:
29 LogToRedfish(numeric::Type type, double val) : type(type), threshold(val)
31 LogToRedfish(::numeric::Type type, double val) : type(type), threshold(val)
30 {}
31
32 void commit(const std::string& id, uint64_t timestamp,
33 double value) override;
34
35 private:
32 {}
33
34 void commit(const std::string& id, uint64_t timestamp,
35 double value) override;
36
37 private:
36 numeric::Type type;
38 ::numeric::Type type;
37 double threshold;
38
39 const char* getMessageId() const;
40};
39 double threshold;
40
41 const char* getMessageId() const;
42};
43} // namespace numeric
41
44
45namespace discrete
46{
47class LogToJournal : public interfaces::TriggerAction
48{
49 public:
50 LogToJournal(::discrete::Severity severity) : severity(severity)
51 {}
52
53 void commit(const std::string& id, uint64_t timestamp,
54 double value) override;
55
56 private:
57 ::discrete::Severity severity;
58
59 const char* getSeverity() const;
60};
61
62class LogToRedfish : public interfaces::TriggerAction
63{
64 public:
65 LogToRedfish(::discrete::Severity severity) : severity(severity)
66 {}
67
68 void commit(const std::string& id, uint64_t timestamp,
69 double value) override;
70
71 private:
72 ::discrete::Severity severity;
73
74 const char* getMessageId() const;
75};
76
77namespace onChange
78{
79class LogToJournal : public interfaces::TriggerAction
80{
81 public:
82 LogToJournal()
83 {}
84
85 void commit(const std::string& id, uint64_t timestamp,
86 double value) override;
87};
88
89class LogToRedfish : public interfaces::TriggerAction
90{
91 public:
92 LogToRedfish()
93 {}
94
95 void commit(const std::string& id, uint64_t timestamp,
96 double value) override;
97};
98} // namespace onChange
99
100} // namespace discrete
101
42class UpdateReport : public interfaces::TriggerAction
43{
44 public:
45 UpdateReport(interfaces::ReportManager& reportManager,
46 std::vector<std::string> names) :
47 reportManager(reportManager),
48 reportNames(std::move(names))
49 {}
50
51 void commit(const std::string& id, uint64_t timestamp,
52 double value) override;
53
54 private:
55 interfaces::ReportManager& reportManager;
56 std::vector<std::string> reportNames;
57};
58} // namespace action
102class UpdateReport : public interfaces::TriggerAction
103{
104 public:
105 UpdateReport(interfaces::ReportManager& reportManager,
106 std::vector<std::string> names) :
107 reportManager(reportManager),
108 reportNames(std::move(names))
109 {}
110
111 void commit(const std::string& id, uint64_t timestamp,
112 double value) override;
113
114 private:
115 interfaces::ReportManager& reportManager;
116 std::vector<std::string> reportNames;
117};
118} // namespace action