-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventpending.h
64 lines (51 loc) · 1.39 KB
/
eventpending.h
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
#ifndef EXITPENDING_H
#define EXITPENDING_H
// STL
#include <set>
#include <list>
#include <string>
// PUT
#include <put/object.h>
#include <put/specialized/timerevent.h>
class EventPending : public Object
{
public:
EventPending(void) noexcept;
virtual ~EventPending(void) noexcept { }
bool setTimeout(milliseconds_t timeout) noexcept;
signal<> event_timeout;
signal<> event_trigger;
protected:
virtual bool activateTrigger(void) noexcept = 0;
private:
void timerExpired(void) noexcept;
TimerEvent m_timer;
milliseconds_t m_timeout_count;
milliseconds_t m_max_timeout_count;
};
class ExitPending : public EventPending
{
public:
ExitPending (void) noexcept { }
~ExitPending(void) noexcept { }
void setPids(const std::list<std::pair<pid_t, pid_t>>& pids) noexcept
{ m_services.clear(); m_pids = pids; }
void setServices(const std::list<std::string>& services) noexcept
{ m_pids.clear(); m_services = services; }
private:
bool activateTrigger(void) noexcept;
std::list<std::pair<pid_t, pid_t>> m_pids;
std::list<std::string> m_services;
};
class StartPending : public EventPending
{
public:
StartPending (void) noexcept { }
~StartPending(void) noexcept { }
void setServices(const std::list<std::string>& services) noexcept
{ m_services = services; }
private:
bool activateTrigger(void) noexcept;
std::list<std::string> m_services;
};
#endif // EXITPENDING_H