#include <simulator/simulator.h>
Inheritance diagram for Simulator:
simulatedTime |factor systemTime
simut = (syst - syst_ref) * factor + simut_ref
Public Member Functions | |
template<class A> | |
const GenericDispatcher * | post (void(*method)(A), A argument) |
Post an event at current time. | |
template<class A1, class A2> | |
const GenericDispatcher * | post (void(*method)(A1, A2), A1 argument1, A2 argument2) |
Post an event at current time. | |
template<class A1, class A2, class A3> | |
const GenericDispatcher * | post (void(*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post an event at current time. | |
template<class T> | |
const GenericDispatcher * | post (T *object, void(T::*method)()) |
Post an event at current time. | |
template<class T, class A> | |
const GenericDispatcher * | post (T *object, void(T::*method)(A), A argument) |
Post an event at current time. | |
template<class T, class A1, class A2> | |
const GenericDispatcher * | post (T *object, void(T::*method)(A1, A2), A1 argument1, A2 argument2) |
Post an event at current time. | |
template<class T, class A1, class A2, class A3> | |
const GenericDispatcher * | post (T *object, void(T::*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post an event at current time. | |
template<class T> | |
const GenericDispatcher * | postCyclic (double cycle, T *object, void(T::*method)()) |
Post a cyclic event at current time. | |
template<class T, class A> | |
const GenericDispatcher * | postCyclic (double cycle, T *object, void(T::*method)(A), A argument) |
Post a cyclic event at current time. | |
template<class T, class A1, class A2> | |
const GenericDispatcher * | postCyclic (double cycle, T *object, void(T::*method)(A1, A2), A1 argument1, A2 argument2) |
Post a cyclic event at current time. | |
template<class T, class A1, class A2, class A3> | |
const GenericDispatcher * | postCyclic (double cycle, T *object, void(T::*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post a cyclic event at current time. | |
template<class A> | |
const GenericDispatcher * | postCyclic (double cycle, void(*method)(A), A argument) |
Post a cyclic event at current time. | |
template<class A1, class A2> | |
const GenericDispatcher * | postCyclic (double cycle, void(*method)(A1, A2), A1 argument1, A2 argument2) |
Post a cyclic event at current time. | |
template<class A1, class A2, class A3> | |
const GenericDispatcher * | postCyclic (double cycle, void(*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post a cyclic event at current time. | |
template<class A> | |
const GenericDispatcher * | postIn (double delay, void(*method)(A), A argument) |
Post an event at current time + a certain delay in simulated time Any C "void method(..)" with one argument can be called this way. | |
template<class A1, class A2> | |
const GenericDispatcher * | postIn (double delay, void(*method)(A1, A2), A1 argument1, A2 argument2) |
Post an event at current time + a certain delay in simulated time Any C "void method(..)" with two arguments can be called this way. | |
template<class A1, class A2, class A3> | |
const GenericDispatcher * | postIn (double delay, void(*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post an event at current time + a certain delay in simulated time Any C "void method(..)" with three arguments can be called this way. | |
template<class T> | |
const GenericDispatcher * | postIn (double delay, T *object, void(T::*method)()) |
Post an event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way. | |
template<class T, class A> | |
const GenericDispatcher * | postIn (double delay, T *object, void(T::*method)(A), A argument) |
Post an event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way. | |
template<class T, class A1, class A2> | |
const GenericDispatcher * | postIn (double delay, T *object, void(T::*method)(A1, A2), A1 argument1, A2 argument2) |
Post an event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way. | |
template<class T, class A1, class A2, class A3> | |
const GenericDispatcher * | postIn (double delay, T *object, void(T::*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post an event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way. | |
template<class T> | |
const GenericDispatcher * | postCyclicIn (double delay, double cycle, T *object, void(T::*method)()) |
Post a cyclic event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way. | |
template<class T, class A> | |
const GenericDispatcher * | postCyclicIn (double delay, double cycle, T *object, void(T::*method)(A), A argument) |
Post a cyclic event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way. | |
template<class T, class A1, class A2> | |
const GenericDispatcher * | postCyclicIn (double delay, double cycle, T *object, void(T::*method)(A1, A2), A1 argument1, A2 argument2) |
Post a cyclic event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way. | |
template<class T, class A1, class A2, class A3> | |
const GenericDispatcher * | postCyclicIn (double delay, double cycle, T *object, void(T::*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post a cyclic event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way. | |
template<class A> | |
const GenericDispatcher * | postCyclicIn (double delay, double cycle, void(*method)(A), A argument) |
Post a cyclic event at current time + a certain delay in simulated time Any C "void method(..)" with one argument can be called this way. | |
template<class A1, class A2> | |
const GenericDispatcher * | postCyclicIn (double delay, double cycle, void(*method)(A1, A2), A1 argument1, A2 argument2) |
Post a cyclic event at current time + a certain delay in simulated time Any C "void method(..)" with two arguments can be called this way. | |
template<class A1, class A2, class A3> | |
const GenericDispatcher * | postCyclicIn (double delay, double cycle, void(*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post a cyclic event at current time + a certain delay in simulated time Any C "void method(..)" with three arguments can be called this way. | |
template<class A> | |
const GenericDispatcher * | postAt (double absoluteTime, void(*method)(A), A argument) |
Post an event at an absolute simulated time. | |
template<class A1, class A2> | |
const GenericDispatcher * | postAt (double absoluteTime, void(*method)(A1, A2), A1 argument1, A2 argument2) |
Post an event at an absolute simulated time. | |
template<class A1, class A2, class A3> | |
const GenericDispatcher * | postAt (double absoluteTime, void(*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post an event at an absolute simulated time. | |
template<class T> | |
const GenericDispatcher * | postAt (double absoluteTime, T *object, void(T::*method)()) |
Post an event at an absolute simulated time. | |
template<class T, class A> | |
const GenericDispatcher * | postAt (double absoluteTime, T *object, void(T::*method)(A), A argument) |
Post an event at an absolute simulated time. | |
template<class T, class A1, class A2> | |
const GenericDispatcher * | postAt (double absoluteTime, T *object, void(T::*method)(A1, A2), A1 argument1, A2 argument2) |
Post an event at an absolute simulated time. | |
template<class T, class A1, class A2, class A3> | |
const GenericDispatcher * | postAt (double absoluteTime, T *object, void(T::*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post an event at an absolute simulated time. | |
template<class T> | |
const GenericDispatcher * | postCyclicAt (double absoluteTime, double cycle, T *object, void(T::*method)()) |
Post a cyclic event at an absolute simulated time. | |
template<class T, class A> | |
const GenericDispatcher * | postCyclicAt (double absoluteTime, double cycle, T *object, void(T::*method)(A), A argument) |
Post a cyclic event at an absolute simulated time. | |
template<class T, class A1, class A2> | |
const GenericDispatcher * | postCyclicAt (double absoluteTime, double cycle, T *object, void(T::*method)(A1, A2), A1 argument1, A2 argument2) |
Post a cyclic event at an absolute simulated time. | |
template<class T, class A1, class A2, class A3> | |
const GenericDispatcher * | postCyclicAt (double absoluteTime, double cycle, T *object, void(T::*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post a cyclic event at an absolute simulated time. | |
template<class A> | |
const GenericDispatcher * | postCyclicAt (double absoluteTime, double cycle, void(*method)(A), A argument) |
Post a cyclic event at an absolute simulated time. | |
template<class A1, class A2> | |
const GenericDispatcher * | postCyclicAt (double absoluteTime, double cycle, void(*method)(A1, A2), A1 argument1, A2 argument2) |
Post a cyclic event at an absolute simulated time. | |
template<class A1, class A2, class A3> | |
const GenericDispatcher * | postCyclicAt (double absoluteTime, double cycle, void(*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post a cyclic event at an absolute simulated time. | |
template<class T> | |
const GenericDispatcher * | postAtStop (T *object, void(T::*method)()) |
Post an event to be executed when the simulation stops. | |
template<class T, class A> | |
const GenericDispatcher * | postAtStop (T *object, void(T::*method)(A), A argument) |
Post an event to be executed when the simulation stops. | |
template<class T, class A1, class A2> | |
const GenericDispatcher * | postAtStop (T *object, void(T::*method)(A1, A2), A1 argument1, A2 argument2) |
Post an event to be executed when the simulation stops. | |
template<class T, class A1, class A2, class A3> | |
const GenericDispatcher * | postAtStop (T *object, void(T::*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post an event to be executed when the simulation stops. | |
template<class A> | |
const GenericDispatcher * | postAtStop (void(*method)(A), A argument) |
Post an event to be executed when the simulation stops. | |
template<class A1, class A2> | |
const GenericDispatcher * | postAtStop (void(*method)(A1, A2), A1 argument1, A2 argument2) |
Post an event to be executed when the simulation stops. | |
template<class A1, class A2, class A3> | |
const GenericDispatcher * | postAtStop (void(*method)(A1, A2, A3), A1 argument1, A2 argument2, A3 argument3) |
Post an event to be executed when the simulation stops. | |
virtual void | cancel (const GenericDispatcher *dispatcher) |
Cancels the selected event. | |
virtual void | flush () |
Flush all posted events without executing them. | |
virtual const GenericDispatcher * | post (const GenericDispatcher *dispatcher) |
Post an event at current time. | |
const GenericDispatcher * | post (void(*method)()) |
Post an event at current time. | |
const GenericDispatcher * | postCyclic (double cycle, void(*method)()) |
Post a cyclic event at current time. | |
virtual const GenericDispatcher * | postIn (double delay, const GenericDispatcher *dispatcher) |
Post an event at current time + a certain delay in simulated time Use this function together with a specialized dispatcher to post methods with more than 3 arguments, or to pass static methods and global functions Note: Template methods are provided, included postCyclic methods. | |
const GenericDispatcher * | postIn (double delay, void(*method)()) |
Post an event at current time + a certain delay in simulated time Any C "void method()" can be called this way. | |
const GenericDispatcher * | postCyclicIn (double delay, double cycle, void(*method)()) |
Post a cyclic event at current time + a certain delay in simulated time Any C "void method()" can be called this way. | |
virtual const GenericDispatcher * | postAt (double absoluteTime, const GenericDispatcher *dispatcher) |
Post an event at an absolute simulated time Use this function together with a specialized dispatcher to post methods with more than 3 arguments, or to pass static methods and global functions Note: Template methods are provided, included postCyclic methods. | |
const GenericDispatcher * | postAt (double absoluteTime, void(*method)()) |
Post an event at an absolute simulated time. | |
const GenericDispatcher * | postCyclicAt (double absoluteTime, double cycle, void(*method)()) |
Post a cyclic event at an absolute simulated time. | |
virtual bool | step () |
Process next event in the queue, if possible. | |
virtual bool | step (double absoluteTime) |
Process next events in the queue, if possible, till the given simulated time is reached. | |
virtual void | setTimeFactor (double factor) |
Correspondance between once unit of time in system time and one unit in simulated time. | |
virtual double | getTimeFactor () const |
virtual double | getTime () const |
Gets the current simulated time since the simulation started or the last reset. | |
virtual void | resetTime () |
Resets the current simulated time parameter to 0. | |
virtual void | stop (bool waitForStop=false) |
Stop processing events automatically. | |
virtual const GenericDispatcher * | postAtStop (const GenericDispatcher *dispatcher) |
Post an event to be executed when the simulation stops. | |
const GenericDispatcher * | postAtStop (void(*method)()) |
Post an event to be executed when the simulation stops. | |
virtual void | start (bool threaded=true) |
Start processing events at a rate determined by the time factor. | |
virtual double | getSystemTime () |
Override this method to return the current system time, expressed in system time units (usually seconds). | |
Static Public Member Functions | |
static Simulator * | newInstance (const char *ID=0) |
Gets a new simulator instance for your particular system. | |
Protected Member Functions | |
virtual void | internalPostInsideLock (double absoluteTime, const GenericDispatcher *dispatcher) |
This common portion is called by all post functions It is necessary separated so as to put reading the current time in the lock for the 2 simple post functions. | |
virtual const GenericDispatcher * | internalStepInsideLock () |
Common portion between the 2 step functions This code is designed to be executed inside a lock, and it is very important that the returned dispatcher is called oustide the lock, because the called function may re-post itself for cyclic activation and will thus need a lock during post. | |
virtual bool | internalStepInsideControl (double absoluteTime) |
Common portion between the step to absolute date and the event loop This code is designed to be executed in a section protected from concurrent simulation control. | |
virtual void | eventLoop () |
To be run in a thread, should be used by the start function. | |
virtual void | stopEvent () |
This stop event is posted by the stop method to cleanly exit from the event loop. | |
virtual void | waitTimerCallBack () |
Must be called when the wait timer expires. | |
Simulator () | |
protected constructor: User API is the public newInstance, or a public constructor of a subtype | |
virtual void | eventMutexLock () |
Override this method to lock the mutex that will be used for event related functions. | |
virtual void | eventMutexUnlock () |
Override this method to unlock the mutex that will be used for event related functions No locking by default, see CPP. | |
virtual bool | stepControlMutexTryLock () |
Override this method to try locking a mutex that will be used for controlling the simulation. | |
virtual void | stepControlMutexLock () |
Override this method to locking the mutex that will be used for controlling the simulation. | |
virtual void | stepControlMutexUnlock () |
Override this method to unlock the mutex that will be used for controlling the simulation. | |
virtual void | waitSemaphorePost () |
Override this method to increment a semaphore that will be used for waiting for a new event in the event loop. | |
virtual void | waitSemaphoreFlush () |
Override this method to flush a semaphore that will be used for waiting for a new event in the event loop. | |
virtual void | waitSemaphoreWait () |
Override this method to implement the "standard wait till semaphore count >0" call on a semaphore that will be used for waiting for a new event in the event loop. | |
virtual void | startWaitTimer (double delay) |
Override this method to start some kind of timer, that will call the timer callback provided after the given delay. | |
virtual void | cancelWaitTimer () |
Override this method to immediately stop the timer started by the startWaitTimer method. | |
Protected Attributes | |
double | time |
double | timeReference |
double | systemTimeReference |
double | timeFactor |
double | timeFactorInverse |
bool | isRunning |
this flag is used by stop events to stop the event loop it should never be set to true outside the event loop but can be set to false to stop it | |
Event * | events |
Event * | firstEvent |
Event * | nextEvent |
const GenericDispatcher ** | stopEvents |
int | numberOfStopEvents |
const GenericDispatcher * | currentDispatcherInExecution |
Friends | |
class | GenericDispatcher |
This file is intended to be included directly inside the simulator class. | |
Classes | |
struct | AbstractFactory |
See struct Factory. More... | |
struct | CyclicDispatcher |
struct | CyclicDispatcher1 |
struct | CyclicDispatcher2 |
struct | CyclicDispatcher3 |
struct | Dispatcher |
struct | Dispatcher1 |
struct | Dispatcher2 |
struct | Dispatcher3 |
struct | Event |
struct | Factory |
Subclasses should provide an ID and a priority to compare this implementation with the default ones. More... | |
struct | GenericCyclicDispatcher |
class | GenericDispatcher |
This base class of object method wrappers is put in the public namespace of the Simulator so it can be used with the generic post methods. More... | |
struct | StaticCyclicDispatcher |
struct | StaticCyclicDispatcher1 |
struct | StaticCyclicDispatcher2 |
struct | StaticCyclicDispatcher3 |
struct | StaticDispatcher |
struct | StaticDispatcher1 |
struct | StaticDispatcher2 |
struct | StaticDispatcher3 |
|
Override this method to immediately stop the timer started by the startWaitTimer method. If you system does not provide such an operation, a clean implementation may be waiting for either a timout or a condition in a separate thread, and this cancel function triggers the condition. Then, by testing which of the timer or condition stopped the waiting, you can either call the timer callback or return immediately.
Reimplemented in OpenThreadSimulator, and POSIX_Simulator. |
|
Override this method to lock the mutex that will be used for event related functions. The function should block as expected until the mutex is available No locking by default, see CPP. Reimplemented in OpenThreadSimulator, and POSIX_Simulator. |
|
Override this method to return the current system time, expressed in system time units (usually seconds).
Reimplemented in OpenThreadSimulator, and POSIX_Simulator. |
|
Gets the current simulated time since the simulation started or the last reset. The simulated time may not be the same at all as the system time, even if a factor of 1.0 is set. Indeed, the simulation may have stopped and restarted (operator takes a coffee break), or the system may not be able to process the events fast enough to keep up with real-time. In any case, both share the same time unit, usually seconds but this maybe changed by overloading the getSystemTime function. This function can be used any time, even when events are pending. Be aware that it is not thread-synchronized, so multiple runs of the same program may not return the same values. This was done on purpose for many reasons, good ones including not blocking the step and post functions, and also because most of the time thread-synchronization would be completely useless. Indeed, there is no way to guaranty that an event won't be processed during 2 consecutive unprotected instructions in your program. Rather than protecting only the getTime function, you would need to put it together with the other instructions inside a mutex protected block, which cleary cannot be done automatically for you. If this is what you really, really want, then think twice about it and see if posting an event at the right date (possibly with a 0 delay) doesn't help. If it is really not the case, overload this class to make the eventMutexLock/Unlock functions accessible, and you're on your own. |
|
|
|
Common portion between the 2 step functions This code is designed to be executed inside a lock, and it is very important that the returned dispatcher is called oustide the lock, because the called function may re-post itself for cyclic activation and will thus need a lock during post.
|
|
Gets a new simulator instance for your particular system. Depending on the current system environment, more than one simulator implementation may be available. You can choose a specific implementation if you know its ID, or let the implementor decide which is the best implementation. This is the default, and silent fallback when the ID does not exist. If you really wish to check on a specific ID, you may consider dynamic casting the result to the type for this ID. You may also simply call the constructor of that implementation!
|
|
Post an event at current time. Any C "void method()" can be called this way.
|
|
Post an event at current time. Use this function together with a specialized dispatcher to post methods with more than 3 arguments. Note: Template methods are provided, included postCyclic methods. Note2: You can use this method with a cyclic dispatcher too.
|
|
Post an event at current time. Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at current time. Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at current time. Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at current time. Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at current time. Any C "void method(..)" with three arguments can be called this way.
|
|
Post an event at current time. Any C "void method(..)" with two arguments can be called this way.
|
|
Post an event at current time. Any C "void method(..)" with one argument can be called this way.
|
|
Post an event at an absolute simulated time. Any C "void method()" can be called this way.
|
|
Post an event at an absolute simulated time Use this function together with a specialized dispatcher to post methods with more than 3 arguments, or to pass static methods and global functions Note: Template methods are provided, included postCyclic methods. Note2: You can use this method with a cyclic dispatcher too.
|
|
Post an event at an absolute simulated time. Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at an absolute simulated time. Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at an absolute simulated time. Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at an absolute simulated time. Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at an absolute simulated time. Any C "void method(..)" with three arguments can be called this way.
|
|
Post an event at an absolute simulated time. Any C "void method(..)" with two arguments can be called this way.
|
|
Post an event at an absolute simulated time. Any C "void method(..)" with one argument can be called this way.
|
|
Post an event to be executed when the simulation stops. Any C "void method()" can be called this way. These events have no execution date, but are called when the simulation stops in the order they were posted by postAtStop. The events are then consumed. No more then MAX_STOP_EVENTS can be posted this way.
|
|
Post an event to be executed when the simulation stops. These events have no execution date, but are called when the simulation stops in the order they were posted by postAtStop. The events are then consumed. No more then MAX_STOP_EVENTS can be posted this way. Use this function together with a specialized dispatcher to post methods with more than 3 arguments, or to pass static methods and global functions
|
|
Post an event to be executed when the simulation stops. Any C++ method on any arbitrary object can be called this way. These events have no execution date, but are called when the simulation stops in the order they were posted by postAtStop. The events are then consumed. No more then MAX_STOP_EVENTS can be posted this way.
|
|
Post an event to be executed when the simulation stops. Any C++ method on any arbitrary object can be called this way. These events have no execution date, but are called when the simulation stops in the order they were posted by postAtStop. The events are then consumed. No more then MAX_STOP_EVENTS can be posted this way.
|
|
Post an event to be executed when the simulation stops. Any C++ method on any arbitrary object can be called this way. These events have no execution date, but are called when the simulation stops in the order they were posted by postAtStop. The events are then consumed. No more then MAX_STOP_EVENTS can be posted this way.
|
|
Post an event to be executed when the simulation stops. Any C++ method on any arbitrary object can be called this way. These events have no execution date, but are called when the simulation stops in the order they were posted by postAtStop. The events are then consumed. No more then MAX_STOP_EVENTS can be posted this way.
|
|
Post an event to be executed when the simulation stops. Any C++ method on any arbitrary object can be called this way. These events have no execution date, but are called when the simulation stops in the order they were posted by postAtStop. The events are then consumed. No more then MAX_STOP_EVENTS can be posted this way.
|
|
Post an event to be executed when the simulation stops. Any C++ method on any arbitrary object can be called this way. These events have no execution date, but are called when the simulation stops in the order they were posted by postAtStop. The events are then consumed. No more then MAX_STOP_EVENTS can be posted this way.
|
|
Post an event to be executed when the simulation stops. Any C++ method on any arbitrary object can be called this way. These events have no execution date, but are called when the simulation stops in the order they were posted by postAtStop. The events are then consumed. No more then MAX_STOP_EVENTS can be posted this way.
|
|
Post a cyclic event at current time. Any C "void method()" can be called this way.
|
|
Post a cyclic event at current time. Any C "void method(..)" with three arguments can be called this way.
|
|
Post a cyclic event at current time. Any C "void method(..)" with two arguments can be called this way.
|
|
Post a cyclic event at current time. Any C "void method(..)" with one argument can be called this way.
|
|
Post a cyclic event at current time. Any C++ method on any arbitrary object can be called this way.
|
|
Post a cyclic event at current time. Any C++ method on any arbitrary object can be called this way.
|
|
Post a cyclic event at current time. Any C++ method on any arbitrary object can be called this way.
|
|
Post a cyclic event at current time. Any C++ method on any arbitrary object can be called this way.
|
|
Post a cyclic event at an absolute simulated time. Any C "void method()" can be called this way.
|
|
Post a cyclic event at an absolute simulated time. Any C "void method(..)" with three arguments can be called this way.
|
|
Post a cyclic event at an absolute simulated time. Any C "void method(..)" with two arguments can be called this way.
|
|
Post a cyclic event at an absolute simulated time. Any C "void method(..)" with one argument can be called this way.
|
|
Post a cyclic event at an absolute simulated time. Any C++ method on any arbitrary object can be called this way.
|
|
Post a cyclic event at an absolute simulated time. Any C++ method on any arbitrary object can be called this way.
|
|
Post a cyclic event at an absolute simulated time. Any C++ method on any arbitrary object can be called this way.
|
|
Post a cyclic event at an absolute simulated time. Any C++ method on any arbitrary object can be called this way.
|
|
Post a cyclic event at current time + a certain delay in simulated time Any C "void method()" can be called this way.
|
|
Post a cyclic event at current time + a certain delay in simulated time Any C "void method(..)" with three arguments can be called this way.
|
|
Post a cyclic event at current time + a certain delay in simulated time Any C "void method(..)" with two arguments can be called this way.
|
|
Post a cyclic event at current time + a certain delay in simulated time Any C "void method(..)" with one argument can be called this way.
|
|
Post a cyclic event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way.
|
|
Post a cyclic event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way.
|
|
Post a cyclic event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way.
|
|
Post a cyclic event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at current time + a certain delay in simulated time Any C "void method()" can be called this way.
|
|
Post an event at current time + a certain delay in simulated time Use this function together with a specialized dispatcher to post methods with more than 3 arguments, or to pass static methods and global functions Note: Template methods are provided, included postCyclic methods. Note2: You can use this method with a cyclic dispatcher too.
|
|
Post an event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at current time + a certain delay in simulated time Any C++ method on any arbitrary object can be called this way.
|
|
Post an event at current time + a certain delay in simulated time Any C "void method(..)" with three arguments can be called this way.
|
|
Post an event at current time + a certain delay in simulated time Any C "void method(..)" with two arguments can be called this way.
|
|
Post an event at current time + a certain delay in simulated time Any C "void method(..)" with one argument can be called this way.
|
|
Resets the current simulated time parameter to 0.
Pending events are translated so they keep the same delay between current date and activation date. |
|
Correspondance between once unit of time in system time and one unit in simulated time. Default is a factor of 1.0, meaning the simulation will try to run in soft real-time when start()ed. Higher factors mean faster than real-time, lower factors mean slower than real-time.
|
|
Start processing events at a rate determined by the time factor. This function returns immediately by default, and process the events in another thread. You may change this by setting the argument to false Of course, there is a limit at how fast you can process events, that is how small you can set the time factor for a fixed amount of events, depending on your system performances. Below this value, you'll probably see a large drift between simulated time and system time. In this case, you can gain an extra bit of performance by setting the factor to 0, which means "process the events as fast as possible".
Reimplemented in OpenThreadSimulator, and POSIX_Simulator. |
|
Override this method to start some kind of timer, that will call the timer callback provided after the given delay. The delay is expressed in system time units, so implementations don't need to use the time factor. If your system does not provide timers, an implementation may be to wait in another thread for either some amount of time or some unblocking condition :
Reimplemented in OpenThreadSimulator, and POSIX_Simulator. |
|
Process next events in the queue, if possible, till the given simulated time is reached.
|
|
Process next event in the queue, if possible.
|
|
Override this method to locking the mutex that will be used for controlling the simulation. Only one thread can call step, or the event loop at the same time. The function should block as expected until the mutex is available No locking by default, see CPP. Reimplemented in OpenThreadSimulator, and POSIX_Simulator. |
|
Override this method to try locking a mutex that will be used for controlling the simulation. Only one thread can call step, or the event loop at the same time. The function should return true on success, or return immediately false otherwise No locking by default, see CPP. Reimplemented in OpenThreadSimulator, and POSIX_Simulator. |
|
Stop processing events automatically. You can use the step functions to advance in time.
|
|
Override this method to flush a semaphore that will be used for waiting for a new event in the event loop. By flushing, we mean that the semaphore count should be zero after this call. This call is done in a protected section such that no post will be done to the semaphore while calling this function. If your system doesn't propose better, you might thus try creating a new semaphore with 0 count. Reimplemented in OpenThreadSimulator, and POSIX_Simulator. |
|
This file is intended to be included directly inside the simulator class. It has been separated for the sake of clarity of the simulator interface. TODO: Generate this file automatically (with perl, etc.) to ease maintainance |