#include <csimul.h>
Inheritance diagram for cSimulation::
Public Methods | |
Constructor, destructor. | |
cSimulation (const cSimulation &r) | |
cSimulation (const char *name) | |
virtual | ~cSimulation () |
Redefined cObject member functions. | |
virtual cObject* | dup () const |
virtual void | forEach (ForeachFunc f) |
virtual void | writeContents (ostream &os) |
virtual const char* | fullPath () const |
virtual const char* | fullPath (char *buffer, int bufsize) const |
cSimulation& | operator= (const cSimulation &) |
Accessing modules. | |
int | addModule (cModule *mod) |
void | deleteModule (int id) |
int | lastModuleId () const |
cModule* | moduleByPath (const char *modulepath) const |
cModule* | module (int id) const |
cModule& | operator[] (int id) const |
void | setSystemModule (cModule *p) |
cModule* | systemModule () const |
Setting up and finishing a simulation run. | |
void | setNetInterface (cNetMod *netif) |
cNetMod* | netInterface () const |
void | setupNetwork (cNetworkType *net, int run_num) |
void | startRun () |
void | callFinish () |
void | endRun () |
void | deleteNetwork () |
void | setNetIfCheckFreq (int f) |
Information about the current simulation run. | |
cNetworkType* | networkType () const |
int | runNumber () const |
simtime_t | simTime () const |
long | eventNumber () const |
Scheduling and context switching during simulation. | |
cSimpleModule* | selectNextModule () |
void | doOneEvent (cSimpleModule *m) |
void | transferTo (cSimpleModule *p) |
void | transferToMain () |
void | setContextModule (cModule *p) |
void | setGlobalContext () |
void | setLocalList (cHead *p) |
cSimpleModule* | runningModule () const |
cModule* | contextModule () const |
cSimpleModule* | contextSimpleModule () const |
cHead* | localList () |
Snapshots. | |
bool | snapshot (cObject *obj, const char *label) |
simulation
. It holds the modules, it manages setting up a simulation, running and finishing it, etc.
cSimulation should normally be of little interest to the simulation programmer. Most of its methods are called by the user interface libraries (Envir, Cmdenv, Tkenv) to set up and run simulations.
|
Copy constructor is not supported: This function gives an error (throws cException) via operator= when called. |
|
Constructor. |
|
Destructor. |
|
Adds a new module and return its ID. |
|
Recursively calls finish() on the modules of the network. This method simply invokes callfinish() on the system module. |
|
Returns the module currently in context. |
|
Returns the module currently in context as a simple module. If the module in context is not a simple module, returns NULL. This is a convenience function which simply calls contextModule(). |
|
Deletes a module identified by its ID. |
|
Cleans up the network currently set up. With distributed simulation, also notifies other segments that they should clean up their networks. |
|
Executes one event. The argument should be the module returned by selectNextModule(); that is, the module to which the next event (lowest timestamp event in the FES) belongs. Also increments the event number (returned by eventNumber()). |
|
Dupping is not implemented for this class. This function gives an error (throws cException) via operator= when called. Reimplemented from cObject. |
|
Should be called at the end of a simulation run. With distributed simulation, this signals other segments that they should stop execution. |
|
Returns sequence number of current event. |
|
Call the passed function for each contained object. See cObject for more details. Reimplemented from cObject. |
|
Returns the name of the simulation object, "simulation". Reimplemented from cObject. |
|
Redefined. (Reason: a C++ rule that overloaded virtual methods must be redefined together.) Reimplemented from cObject. |
|
Returns highest used module ID. |
|
Returns the currently active 'locals' object. This object is usually the |
|
Looks up a module by ID. |
|
Finds a module by its path. |
|
Returns network interface module. |
|
Returns the cNetworkType object that was used to set up the current simulation model. |
|
Assignment is not supported by this class: this method throws a cException when called. |
|
DEPRECATED because it might return null reference; use module(int) instead. Same as module(int), only this returns reference instead of pointer. |
|
Returns the current run number. A run is the execution of a model with a given set of parameter settings. Runs can be defined in omnetpp.ini. |
|
Returns the currently executing simple module. |
|
The scheduler function. Returns the module to which the next event (lowest timestamp event in the FES) belongs. If the FES is empty, returns NULL. |
|
Sets the module in context. Used internally. |
|
Sets global context. Used internally. |
|
Sets the 'locals' object for the current context. |
|
Used with distributed simulation, sets the frequency of checking messages arriving from other segments. This setting is mostly useful for performance tuning. The meaning of the value is: "check the network interface after every f local events." |
|
Sets network interface module. |
|
Sets the system module. |
|
Builds a new network and initializes it. With distributed simulation, also sets up network on other segments. |
|
Returns current simulation time. |
|
Writes a snapshot of the given object and its children to the textual snapshot file. This method is called internally from cSimpleModule's snapshot(). |
|
Should be called after setupNetwork(), just before the first doOneEvent() call. The initialize() methods of modules are called here. With distributed simulation, also tells other segments that to begin executing the simulation. |
|
Returns pointer to the system module. |
|
Switches to simple module's coroutine. This method is invoked from doOneEvent() for activity()-based modules. |
|
Switches to main coroutine. |
|
Writes textual information about this object to the stream. See cObject for more details. Reimplemented from cObject. |