Added timer/timeout-event support (+ event handler for addition, deletion and triggering).
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1244 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -119,8 +119,35 @@ class SimulatorController
|
||||
* @param opcode the opcode of the conrecete jump instruction
|
||||
*/
|
||||
void onJumpEvent(bool flagTriggered, unsigned opcode);
|
||||
/**
|
||||
* This method is called when an experiment flow adds a new event by
|
||||
* calling \c simulator.addEvent(pev) or \c simulator.addEventAndWait(pev).
|
||||
* More specifically, the event will be added to the event-list first
|
||||
* (buffer-list, to be precise) and then this event handler is called.
|
||||
* @param pev the event which has been added
|
||||
* @return You should return \c true to continue and \c false to prevent
|
||||
* the addition of the event \a pev, yielding an error in the
|
||||
* experiment flow (i.e. -1 is returned).
|
||||
*/
|
||||
virtual bool onEventAddition(fi::BaseEvent* pev) { return true; }
|
||||
/**
|
||||
* This method is called when an experiment flow removes an event from
|
||||
* the event-management by calling \c removeEvent(prev), \c clearEvents()
|
||||
* or by deleting a complete flow (\c removeFlow). More specifically, this
|
||||
* event handler will be called *before* the event is actually deleted.
|
||||
* @param pev the event to be deleted when returning from the event handler
|
||||
*/
|
||||
virtual void onEventDeletion(fi::BaseEvent* pev) { }
|
||||
/**
|
||||
* This method is called when an previously added event is about to be
|
||||
* triggered by the simulator-backend. More specifically, this event handler
|
||||
* will be called *before* the event is actually triggered, i.e. before the
|
||||
* corresponding coroutine is toggled.
|
||||
* @param pev the event to be triggered when returning from the event handler
|
||||
*/
|
||||
virtual void onEventTrigger(fi::BaseEvent* pev) { }
|
||||
/* ********************************************************************
|
||||
* Simulator Controller & Access API (SCA-API):
|
||||
* Simulator Controller & Access API:
|
||||
* ********************************************************************/
|
||||
/**
|
||||
* Save simulator state.
|
||||
@ -186,7 +213,7 @@ class SimulatorController
|
||||
*/
|
||||
void setMemoryManager(MemoryManager* pMem) { m_Mem = pMem; }
|
||||
/* ********************************************************************
|
||||
* Experiment-Flow & Event Management API (EFEM-API):
|
||||
* Experiment-Flow & Event Management API:
|
||||
* ********************************************************************/
|
||||
/**
|
||||
* Adds the specified experiment or plugin and creates a coroutine to
|
||||
@ -204,7 +231,8 @@ class SimulatorController
|
||||
* Add event ev to the event management. This causes the event to be
|
||||
* active.
|
||||
* @param ev the event pointer to be added for the current flow
|
||||
* @return the id of the event used to identify the object on occurrence
|
||||
* @return the id of the event used to identify the object on occurrence;
|
||||
* -1 is returned on errors
|
||||
*/
|
||||
fi::EventId addEvent(fi::BaseEvent* ev);
|
||||
/**
|
||||
@ -221,9 +249,11 @@ class SimulatorController
|
||||
void clearEvents(fi::ExperimentFlow *flow = 0) { m_EvList.remove(flow); }
|
||||
/**
|
||||
* Waits on any events which have been added to the event management. If
|
||||
* one of those events occour, waitAny() will return the id of that
|
||||
* event.
|
||||
* one of those events occour, waitAny() will return the id of that event.
|
||||
* @return the previously occurred event
|
||||
*
|
||||
* FIXME: Maybe this should return immediately if there are not events?
|
||||
* (additional parameter flag?)
|
||||
*/
|
||||
fi::BaseEvent* waitAny();
|
||||
/**
|
||||
@ -232,9 +262,21 @@ class SimulatorController
|
||||
* @param ev the event pointer to be added
|
||||
* @return the pointer of the occurred event (it is not guaranteed that
|
||||
* this pointer will be equal to ev)
|
||||
* FIXME rename to make clear this returns when *any* event occurs
|
||||
*
|
||||
* FIXME: Rename to make clear this returns when *any* event occurs
|
||||
*/
|
||||
fi::BaseEvent* addEventAndWait(fi::BaseEvent* ev);
|
||||
/**
|
||||
* Checks whether any experiment flow has events in the event-list.
|
||||
* @return \c true if there are still events, or \c false otherwise
|
||||
*/
|
||||
bool hasEvents() const { return getEventCount() > 0; }
|
||||
/**
|
||||
* Determines the number of (stored) events in the event-list which have
|
||||
* not been triggered so far.
|
||||
* @return the actual number of events
|
||||
*/
|
||||
unsigned getEventCount() const { return m_EvList.getEventCount(); }
|
||||
/**
|
||||
* Fetches data for the experiments from the Job-Server.
|
||||
* @return the Experiment-Data from the Job-Server.
|
||||
|
||||
Reference in New Issue
Block a user