diff options
author | Matthew Barth <msbarth@us.ibm.com> | 2017-04-12 10:57:19 -0500 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-05-07 12:02:56 -0400 |
commit | b86374d9b6bf0c6fe78d8d87a8748138056b3ac3 (patch) | |
tree | c77540980aa980d0cd52cfefb92c143c95e1bf01 /src/events.hpp | |
parent | d106605c2dd9bf5f29924bf2f919fd26affc4174 (diff) | |
download | phosphor-dbus-monitor-b86374d9b6bf0c6fe78d8d87a8748138056b3ac3.tar.gz phosphor-dbus-monitor-b86374d9b6bf0c6fe78d8d87a8748138056b3ac3.zip |
Add item group monitoring data type framework
Include supported data types for item groups:
--Start event trigger
--Signal event trigger
--A countAtOrAbove condition
--A log_error action
Change-Id: I1ae5ba60e4d9c06155885d52d98a44b31fd73207
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'src/events.hpp')
-rw-r--r-- | src/events.hpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/events.hpp b/src/events.hpp new file mode 100644 index 0000000..b6de8de --- /dev/null +++ b/src/events.hpp @@ -0,0 +1,79 @@ +#pragma once + +#include "data_types.hpp" + +namespace phosphor +{ +namespace dbus +{ +namespace monitoring +{ + +class Event : public std::vector<Condition> +{ + public: + enum class Trigger + { + START, + SIGNAL + }; + + Event() = delete; + Event(const Event&) = delete; + Event(Event&&) = delete; + Event& operator=(const Event&) = delete; + Event& operator=(Event&&) = delete; + virtual ~Event() = default; + + Event(const std::vector<Condition>& conditions, + Trigger t) : + std::vector<Condition>(conditions), + trigger(t) + { + // Nothing to do here + } + + Trigger trigger; +}; + +class StartEvent : public Event +{ + public: + StartEvent() = delete; + StartEvent(const StartEvent&) = delete; + StartEvent(StartEvent&&) = delete; + StartEvent& operator=(const StartEvent&) = delete; + StartEvent& operator=(StartEvent&&) = delete; + ~StartEvent() = default; + + explicit StartEvent(const std::vector<Condition>& conditions) : + Event(conditions, Trigger::START) + { + // Nothing to do here + } +}; + +class SignalEvent : public Event +{ + public: + SignalEvent() = delete; + SignalEvent(const SignalEvent&) = delete; + SignalEvent(SignalEvent&&) = delete; + SignalEvent& operator=(const SignalEvent&) = delete; + SignalEvent& operator=(SignalEvent&&) = delete; + ~SignalEvent() = default; + + SignalEvent(const char* signature, + const std::vector<Condition>& conditions) : + Event(conditions, Trigger::SIGNAL), + signature(signature) + { + // Nothing to do here + } + + const char* signature; +}; + +} // namespace monitoring +} // namespace dbus +} // namespace phosphor |