1 #pragma once 2 3 #include "interfaces/report_manager.hpp" 4 #include "interfaces/trigger_action.hpp" 5 #include "interfaces/trigger_types.hpp" 6 7 namespace action 8 { 9 10 namespace numeric 11 { 12 class LogToJournal : public interfaces::TriggerAction 13 { 14 public: 15 LogToJournal(::numeric::Type type, double val) : type(type), threshold(val) 16 {} 17 18 void commit(const std::string& id, uint64_t timestamp, 19 double value) override; 20 21 private: 22 ::numeric::Type type; 23 double threshold; 24 25 const char* getType() const; 26 }; 27 28 class LogToRedfish : public interfaces::TriggerAction 29 { 30 public: 31 LogToRedfish(::numeric::Type type, double val) : type(type), threshold(val) 32 {} 33 34 void commit(const std::string& id, uint64_t timestamp, 35 double value) override; 36 37 private: 38 ::numeric::Type type; 39 double threshold; 40 41 const char* getMessageId() const; 42 }; 43 } // namespace numeric 44 45 namespace discrete 46 { 47 class 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 62 class 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 77 namespace onChange 78 { 79 class 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 89 class 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 102 class 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 119