Main Page | Class Hierarchy | Class List | File List | Class Members

EventInterface Class Reference

General Event Interface. More...

#include <EventInterface.h>

Inheritance diagram for EventInterface:

MipBus List of all members.

Public Member Functions

 EventInterface (EventInterfaceList *evlist)
 Constructor.
 ~EventInterface ()
 Destructor.
EventInterfaceListGetEventInterfaceList ()
 Returns the EventInterfaceList to which this EventInterface belongs to.
EventInterfaceGetEventInterfaceNext ()
 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

EventInterfaceListmEventInterfaceList
 The next EventInterface in the list.
EventInterfacemEventInterfaceNext
 The next EventInterface in the list.

Detailed Description

General Event Interface.

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.


The documentation for this class was generated from the following file:
Generated on Wed Jun 1 09:19:07 2005 for libmip by doxygen 1.3.8