Eris
1.3.19
Main Page
Related Pages
Classes
Files
File List
Eris
TimedEventService.h
1
#ifndef ERIS_TIMED_EVENT_SERVICE_H
2
#define ERIS_TIMED_EVENT_SERVICE_H
3
4
#include <wfmath/timestamp.h>
5
6
#include <sigc++/signal.h>
7
8
#include <set>
9
10
namespace
Eris
11
{
12
16
class
TimedEvent
17
{
18
public
:
19
virtual
~
TimedEvent
()
20
{
21
}
22
29
virtual
void
expired
() = 0;
30
34
virtual
const
WFMath::TimeStamp&
due
()
const
= 0;
35
};
36
37
class
EventsByDueOrdering
38
{
39
public
:
40
bool
operator()(
const
TimedEvent
* a,
const
TimedEvent
* b)
const
41
{
42
return
a->
due
() < b->
due
();
43
}
44
};
45
46
class
TimedEventService
47
{
48
public
:
49
50
static
TimedEventService
* instance();
51
52
static
void
del();
53
58
unsigned
long
tick
(
bool
idle =
false
);
59
62
void
registerEvent(
TimedEvent
* te);
63
66
void
unregisterEvent(
TimedEvent
* te);
67
71
sigc::signal<void>
Idle
;
72
private
:
73
TimedEventService
();
74
75
static
TimedEventService
* static_instance;
76
77
typedef
std::set<TimedEvent*, EventsByDueOrdering> TimedEventsByDue;
78
TimedEventsByDue m_events;
79
};
80
81
}
// of namespace Eris
82
83
#endif // of ERIS_TIMED_EVENT_SERVICE_H
Generated on Sat Mar 22 2014 05:06:13 for Eris by
1.8.1.2