Microsimulation API
Public Member Functions | Public Attributes | List of all members
ssim::cProcess Class Referenceabstract

cProcess class for OMNET++ API compatibility. This provides a default for Process::process_event() that calls cProcess::handleMessage(). This class also provides scheduleAt() methods for insert cMessages into the process event queue. More...

#include <microsimulation.h>

Inheritance diagram for ssim::cProcess:
Inheritance graph
[legend]
Collaboration diagram for ssim::cProcess:
Collaboration graph
[legend]

Public Member Functions

 cProcess (Time startTime=Time(0.0))
 
virtual void handleMessage (const cMessage *msg)=0
 
virtual void process_event (const ssim::Event *e)
 action executed in response to an event signaled to this process. More...
 
virtual void scheduleAt (Time t, cMessage *msg)
 
virtual void scheduleAt (Time t, string s)
 
virtual void scheduleAt (Time t, short k)
 
virtual void init ()=0
 
void initialize ()
 action executed when the process is initialized. More...
 
- Public Member Functions inherited from ssim::Process
virtual ~Process ()
 
virtual void stop (void)
 executed when the process is explicitly stopped. More...
 

Public Attributes

Time startTime
 
Time previousEventTime
 

Detailed Description

cProcess class for OMNET++ API compatibility. This provides a default for Process::process_event() that calls cProcess::handleMessage(). This class also provides scheduleAt() methods for insert cMessages into the process event queue.

Definition at line 236 of file microsimulation.h.

Constructor & Destructor Documentation

◆ cProcess()

ssim::cProcess::cProcess ( Time  startTime = Time(0.0))
inline

Definition at line 238 of file microsimulation.h.

Member Function Documentation

◆ handleMessage()

virtual void ssim::cProcess::handleMessage ( const cMessage msg)
pure virtual

Implemented in illnessDeath::SimplePerson.

◆ init()

virtual void ssim::cProcess::init ( )
pure virtual

Implemented in illnessDeath::SimplePerson.

◆ initialize()

void ssim::cProcess::initialize ( )
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. BREAKING CHANGE: this method was called init().

Reimplemented from ssim::Process.

Definition at line 262 of file microsimulation.h.

◆ process_event()

virtual void ssim::cProcess::process_event ( const ssim::Event msg)
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:

class Payment : public Event {
public:
int dollars;
//...
};
class Delivery : public Event {
public:
int count;
string model;
//...
};
class GuitarShop : public Process {
//...
virtual void process_event(const Event * e) {
const Payment * p;
const Delivery * d;
if ((p = dynamic_cast<const Payment *>(e)) != 0) {
cout << "I got a payment for $" << p->dollars << endl;
} else if ((d = dynamic_cast<const Delivery *>(e)) != 0) {
cout << "I got a delivery of " << d->count
<< " " << d->model << " guitars" << endl;
} else {
cerr << "GuitarShop: error: unknown event." << endl;
}
}
};
See also
Sim::advance_delay(Time).

Reimplemented from ssim::Process.

Definition at line 240 of file microsimulation.h.

◆ scheduleAt() [1/3]

virtual void ssim::cProcess::scheduleAt ( Time  t,
cMessage msg 
)
inlinevirtual

Definition at line 250 of file microsimulation.h.

◆ scheduleAt() [2/3]

virtual void ssim::cProcess::scheduleAt ( Time  t,
short  k 
)
inlinevirtual

Definition at line 258 of file microsimulation.h.

◆ scheduleAt() [3/3]

virtual void ssim::cProcess::scheduleAt ( Time  t,
string  s 
)
inlinevirtual

Definition at line 255 of file microsimulation.h.

Member Data Documentation

◆ previousEventTime

Time ssim::cProcess::previousEventTime

Definition at line 263 of file microsimulation.h.

◆ startTime

Time ssim::cProcess::startTime

Definition at line 263 of file microsimulation.h.


The documentation for this class was generated from the following file:
ssim::cProcess::process_event
virtual void process_event(const ssim::Event *e)
action executed in response to an event signaled to this process.
Definition: microsimulation.h:240