#include <EventInterface.h>
Inheritance diagram for EventInterface:
Public Member Functions | |
EventInterface (EventInterfaceList *evlist) | |
Constructor. | |
~EventInterface () | |
Destructor. | |
EventInterfaceList * | GetEventInterfaceList () |
Returns the EventInterfaceList to which this EventInterface belongs to. | |
EventInterface * | GetEventInterfaceNext () |
Returns the next EventInterface in the list. | |
void | DispatchEvent () |
Dispatches the event by calling OnEvent() if necessary. | |
virtual void | OnEvent ()=0 |
This is called when the event timer expires. | |
void | SetNextEvent (int msec) |
Sets the next event (usec relative to the current event clock). | |
void | SetNextEventAbsolute (EventClock::tTime evtime) |
Sets the next event (absolute time). | |
EventClock::tTime | GetNextEventTime () const |
Returns the time of the next event. | |
bool | HasNextEvent () const |
Returns whether the event is active. | |
Protected Attributes | |
EventInterfaceList * | mEventInterfaceList |
The next EventInterface in the list. | |
EventInterface * | mEventInterfaceNext |
The next EventInterface in the list. |
This is an abstract class used to model an event timeout.
An class derived from EventInterface must implement the OnEvent() method. This method is called whenever the timeout occurs.
The most useful way to set a timeout is by calling the SetNextEvent() method. It takes as argument the number of milliseconds to wait until calling OnEvent(). Note that the timeout is cleared when OnEvent is called, i.e. if you want OnEvent to be invoked every 100ms, you need to call
within the OnEvent() method to set the timeout again.
Alternatively, one may use the SetNextEventAbsolute() method to set an absolute time for the next event.
Note that an EventInterface only holds one timeout at the time. Calling SetNextEvent() or SetNextEventAbsolute() several times will only keep the smallest timeout (the event closest to now in time). However, you can create several objects derived from EventInterface and add them to the EventInterfaceList.