summaryrefslogtreecommitdiffstats
path: root/src/events.hpp
blob: b6de8de499ce79b896491b01aac6c371fd37fd8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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
OpenPOWER on IntegriCloud