#include <csimul.h>
Inheritance diagram for cSimulation::
Public Methods | |
Constructor, destructor. | |
cSimulation (const cSimulation &r) | |
cSimulation (const char *name, cHead *h=NULL) | |
virtual | ~cSimulation () |
Redefined cObject member functions. | |
virtual const char* | className () const |
virtual cObject* | dup () const |
virtual const char* | inspectorFactoryName () 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 | add (cModule *mod) |
void | del (int id) |
int | lastModuleIndex () 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 | resetClock () |
void | startClock () |
void | stopClock () |
bool | setupNetwork (cNetworkType *net, int run_num) |
void | startRun () |
void | callFinish () |
void | endRun () |
void | deleteNetwork () |
void | setTimeLimit (long t) |
void | setSimTimeLimit (simtime_t t) |
void | setNetIfCheckFreq (int f) |
Information about the current simulation run. | |
cNetworkType* | networkType () const |
int | runNumber () const |
long | timeLimit () const |
simtime_t | simTimeLimit () const |
simtime_t | simTime () const |
long | eventNumber () const |
Scheduling and context switching during simulation. | |
cSimpleModule* | selectNextModule () |
void | doOneEvent (cSimpleModule *m) |
void | incEventNumber () |
void | checkTimes () |
int | transferTo (cSimpleModule *p) |
int | 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) |
Errors and warnings. | |
bool | warnings () const |
void | setWarnings (bool w) |
void | terminate (int errcode, const char *message) |
void | error (int errcode, const char *message) |
void | warning (int errcode, const char *message) |
bool | ok () const |
int | errorCode () const |
void | setErrorCode (int e) |
bool | normalTermination () const |
void | resetError () |
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 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. |
|
Checks if the current simulation has reached the simulation or real time limits, and if so, stops the simulation with the appropriate message. |
|
Returns pointer to a string containing the class name, "cSimulation". Reimplemented from cObject. |
|
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 simulation network currently set up. Deletes modules, message queue etc. |
|
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. |
|
Dupping is not implemented for this class. This function gives an error via operator= when called. Reimplemented from cObject. |
|
Should be called at the end of a simulation run. Closes open files, etc. |
|
Issue error message. |
|
Returns current error code. |
|
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. |
|
Increments the event number. |
|
Returns the name of the inspector factory class associated with this class. See cObject for more details. 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. |
|
Examines error code and returns true if simulation terminated normally. |
|
Returns true if no errors happened (i.e. error code is zero, eOK). |
|
Assignment is not supported for this class. This function raises an error when called. |
|
Same as module(int), only this returns reference instead of pointer. |
|
Resets the clock measuring the elapsed (real) time spent in this simulation run. |
|
Reset error code. |
|
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. |
|
Sets the module in context. Used internally. |
|
Sets error code without giving error message. |
|
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 a simulation time limit for the current simulation run. |
|
Sets the system module. |
|
Sets an execution time limit for the current simulation run. The value is understood in seconds. |
|
Globally disable/enable warnings. |
|
Builds a new network. |
|
Returns current simulation time. |
|
Returns simulation time limit for the current simulation run. |
|
Writes a snapshot of the given object and its children to the textual snapshot file. This method is called internally from cSimpleModule's snapshot(). |
|
Start measuring elapsed (real) time spent in this simulation run. |
|
Initializes network. |
|
Stop measuring elapsed (real) time spent in this simulation run. |
|
Returns pointer to the system module. |
|
Prints a termination message and sets the error number. |
|
Returns CPU time limit for the current simulation run. |
|
Switches to simple module's coroutine. This method is invoked from doOneEvent() for activity()-based modules. |
|
Switches to main coroutine. |
|
Issues simulation warning. message + question:continue/abort? |
|
Return true if warnings are globally enabled. |
|
Writes textual information about this object to the stream. See cObject for more details. Reimplemented from cObject. |