blip  0.1
TimerEvent.hpp
Go to the documentation of this file.
1 #ifndef __blip_TimerEvent_hpp
2 #define __blip_TimerEvent_hpp
3 
4 #include <blip/Blip.hpp>
5 #include <blip/Event.hpp>
6 
7 namespace blip {
8 
10 
11 typedef int8_t TimerID;
12 
17 class TimerEvent : public Event
18 {
19  friend class TimerManager;
20 
21  public:
22 
24  virtual ~TimerEvent();
25 
27  inline TimerID getTimerID() const
28  { return(_id); }
29 
30  virtual inline time_ms_t getEventTime() const
31  { return(_eventTime); }
32 
34  inline uint_t getFireCount() const
35  { return(_fireCount); }
36 
37  protected:
38 
40  TimerEvent(TimerID id, time_ms_t eventTime = 0);
41 
42  inline void setEventTime(time_ms_t eventTime)
43  {
44  _eventTime = eventTime;
45  ++_fireCount;
46  }
47 
48  inline void reset()
49  {
50  _eventTime = 0;
51  _fireCount = 0;
52  }
55  private:
56 
57  TimerID _id;
58  time_ms_t _eventTime;
59  uint_t _fireCount;
60 
61  CCXX_COPY_DECLS(TimerEvent);
62 };
63 
64 } // namespace blip
65 
66 #endif // __blip_TimerEvent_hpp
uint_t getFireCount() const
Get the number of times that this TimerEvent has been fired.
Definition: TimerEvent.hpp:34
virtual ~TimerEvent()
Destructor.
Definition: TimerEvent.cpp:18
An abstract base class for all application events.
Definition: Event.hpp:12
A class that manages Timers and schedules TimerEvents for delivery when Timers fire.
Definition: TimerManager.hpp:27
WAV file format details at: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/.
Definition: AccelerometerSensorEvent.cpp:3
TimerID getTimerID() const
Get the ID of this timer.
Definition: TimerEvent.hpp:27
int8_t TimerID
Definition: TimerEvent.hpp:9
virtual time_ms_t getEventTime() const
Get the time at which this event occurred.
Definition: TimerEvent.hpp:30
A timer event.
Definition: TimerEvent.hpp:17