Microsimulation API: ssim::cProcess Class Reference

Microsimulation API

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

cProcess class for OMNET++ API compatibility. More...

`#include <microsimulation.h>`

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

## Public Member Functions
| cProcess (Time startTime=Time(0.0))
virtual void | handleMessage (const cMessage *msg)=0
| Abstract method to handle each message. More...
virtual void | init ()=0
| Abstract method to initialise a given process. More...
virtual void | scheduleAt (Time t, cMessage *msg)
| schedules at time t a message msg to the current process. Adds the sendingTime, process_id and sender_process_id to the message. More...
virtual void | scheduleAt (Time t, string name)
| schedules at time t a message msg with a specific name to the current process. More...
virtual void | scheduleAt (Time t, short k)
| schedules at time t a message msg with a specific kind to the current process. More...
virtual void | send (ProcessId process_id, Time t, cMessage *msg)
| send to a given process at time t a message msg. Adds the sendingTime, process_id and sender_process_id to the message. More...
virtual void | send (ProcessId process_id, Time t, string name)
| sends to a given process at time t a message msg with a specific name. More...
virtual void | send (ProcessId process_id, Time t, short kind)
| sends to a given process at time t a message msg with a specific kind. More...
void | cancel (std::function< bool(const cMessage *msg)> pred)
| Given a predicate, remove the messages for this process. More...
void | cancel_kind (short kind)
| Given a kind, remove the messages for this process. More...
void | cancel_name (string name)
| Given a name, remove the messages for this process. More...
void | cancel_events ()
| Remove all of the messages for this process. More...
double | previous ()
| Returns the value of the previous event time for this process. More...
void | initialize ()
| Implements the method required by ssim::ProcessWithPId. Calls init() and sets the previousEventTime to the startTime. More...
virtual void | process_event (const ssim::Event *e)
| Implements the method required by ssim::ProcessWithPId This requires that the event* can be cast to a cMessage*. This calls the handleMessage(const cMessage*) method and updates previousEventTime. More...
Public Member Functions inherited from ssim::ProcessWithPId
ProcessId | activate () throw ()
| activates this process within the simulator. More...
ProcessId | pid () const throw ()
| process id of this process. More...
| ProcessWithPId () throw ()
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 implementations for the ProcessWithPId including:

1. process_event(const Event*) that calls handleMessage(const cMessage*)
2. initialize() that calls init().

The user can also implement a stop() method which is called at the end of a process. The scheduleAt() and send() methods insert cMessages into the current and other process event queues, respectively. Messages for this process can be cancelled using cancel(), cancel_kind(), cancel_name() and cancel_events(). The previous event time for this process can be found using previous().

Definition at line 314 of file microsimulation.h.

## Constructor & Destructor Documentation

## ◆ cProcess()

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

Definition at line 317 of file microsimulation.h.

## Member Function Documentation

## ◆ cancel()

void ssim::cProcess::cancel | ( | std::function< bool(const cMessage *msg)> | pred | ) |
| inline

Given a predicate, remove the messages for this process.

Definition at line 375 of file microsimulation.h.

## ◆ cancel_events()

void ssim::cProcess::cancel_events | ( |  | ) |
| inline

Remove all of the messages for this process.

Definition at line 402 of file microsimulation.h.

## ◆ cancel_kind()

void ssim::cProcess::cancel_kind | ( | short | kind | ) |
| inline

Given a kind, remove the messages for this process.

Definition at line 384 of file microsimulation.h.

## ◆ cancel_name()

void ssim::cProcess::cancel_name | ( | string | name | ) |
| inline

Given a name, remove the messages for this process.

Definition at line 393 of file microsimulation.h.

## ◆ handleMessage()

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

Abstract method to handle each message.

Implemented in illnessDeath::SimplePerson.

## ◆ init()

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

Abstract method to initialise a given process.

Implemented in illnessDeath::SimplePerson.

## ◆ initialize()

void ssim::cProcess::initialize | ( |  | ) |
| inlinevirtual

Implements the method required by ssim::ProcessWithPId. Calls init() and sets the previousEventTime to the startTime.

Reimplemented from ssim::Process.

Definition at line 417 of file microsimulation.h.

## ◆ previous()

double ssim::cProcess::previous | ( |  | ) |
| inline

Returns the value of the previous event time for this process.

Definition at line 410 of file microsimulation.h.

## ◆ process_event()

virtual void ssim::cProcess::process_event | ( | const ssim::Event * | e | ) |
| inlinevirtual

Implements the method required by ssim::ProcessWithPId This requires that the event* can be cast to a cMessage*. This calls the handleMessage(const cMessage*) method and updates previousEventTime.

Reimplemented from ssim::Process.

Definition at line 424 of file microsimulation.h.

## ◆ scheduleAt() [1/3]

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

schedules at time t a message msg to the current process. Adds the sendingTime, process_id and sender_process_id to the message.

Definition at line 331 of file microsimulation.h.

## ◆ scheduleAt() [2/3]

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

schedules at time t a message msg with a specific kind to the current process.

Definition at line 346 of file microsimulation.h.

## ◆ scheduleAt() [3/3]

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

schedules at time t a message msg with a specific name to the current process.

Definition at line 340 of file microsimulation.h.

## ◆ send() [1/3]

virtual void ssim::cProcess::send | ( | ProcessId | process_id,
|  | Time | t,
|  | cMessage * | msg
| ) |  |
| inlinevirtual

send to a given process at time t a message msg. Adds the sendingTime, process_id and sender_process_id to the message.

Definition at line 353 of file microsimulation.h.

## ◆ send() [2/3]

virtual void ssim::cProcess::send | ( | ProcessId | process_id,
|  | Time | t,
|  | short | kind
| ) |  |
| inlinevirtual

sends to a given process at time t a message msg with a specific kind.

Definition at line 369 of file microsimulation.h.

## ◆ send() [3/3]

virtual void ssim::cProcess::send | ( | ProcessId | process_id,
|  | Time | t,
|  | string | name
| ) |  |
| inlinevirtual

sends to a given process at time t a message msg with a specific name.

Definition at line 363 of file microsimulation.h.

## Member Data Documentation

## ◆ previousEventTime

Time ssim::cProcess::previousEventTime

Definition at line 316 of file microsimulation.h.

## ◆ startTime

Time ssim::cProcess::startTime

Definition at line 316 of file microsimulation.h.

The documentation for this class was generated from the following file:

- /home/marcle/src/R/microsimulation/inst/include/microsimulation.h