Virtual class (interface) representing processes running within the simulator. More...
#include <ssim.h>
Public Member Functions | |
virtual void | init (void) |
action executed when the process is initialized. | |
virtual void | process_event (const Event *msg) |
action executed in response to an event signaled to this process. | |
virtual void | stop (void) |
executed when the process is explicitly stopped. |
Virtual class (interface) representing processes running within the simulator.
A simulated process must implement this basic interface.
|
inlinevirtual |
action executed when the process is initialized.
This method is not a constructor. It is rather an initialization step that is executed during the simulation when the process is created within the simulation through Sim::create_process. This initialization is guaranteed to be executed before any event is signaled to the process.
|
inlinevirtual |
action executed in response to an event signaled to this process.
The Event object signaled through this method should not be used outside this method, other than by signaling it to other processes through Sim::signal_event(). In fact, the Event pointer passed to this method should be considered invalid outside this method, as the simulator proceeds to de-allocate every event object that is not signaled to any other process.
The implementation of this method may specify the duration of the actions associated with this response using the advance_delay method. By default, the duration of an action is 0.
The implementation of this method may use the C++ dynamic_cast feature to select an action on the basis of the actual type of the Event object. Here's an example that illustrates this feature:
|
inlinevirtual |
executed when the process is explicitly stopped.
A process is stopped by a call to Sim::stop_process(ProcessId). This method is executed immediately after the process has processed all the events scheduled before the call to Sim::stop_process.