#include <cenvir.h>
Public Methods | |
Constructor, destructor. | |
cEnvir () | |
~cEnvir () | |
Methods called from main(). | |
void | setup (int ac, char *av[]) |
int | run () |
void | shutdown () |
Methods to be called by the simulation kernel to notify the environment about events. | |
void | objectDeleted (cObject *object) |
void | messageSent (cMessage *msg) |
void | messageDelivered (cMessage *msg) |
void | breakpointHit (const char *lbl, cSimpleModule *mod) |
Methods called by the simulation kernel to access configuration settings. | |
const char* | getParameter (int run_no, const char *parname) |
const char* | getPhysicalMachineFor (const char *logical_mach) |
const char* | getDisplayString (int run_no, const char *name) |
Input/output methods called from simple modules or the simulation kernel. | |
void | printfmsg (const char *fmt,...) |
void | printf (const char *fmt="\n",...) |
void | puts (const char *s) |
void | flush () |
bool | gets (const char *prompt, char *buf, int len=255) |
bool | askf (char *buf, int len, const char *promptfmt,...) |
bool | askYesNo (const char *msgfmt,...) |
cEnvir& | setPrompt (const char *s) |
const char* | prompt () const |
void | foreignPuts (const char *hostname, const char *mod, const char *str) |
Methods for recording data from output vectors. | |
These are functions cOutVector internally relies on.
The behavior of these functions can be changed by plugging in a different cOutputVectorManager object into the user interface library. (Or alternatively, by reimplementing the whole cEnvir of course). | |
void* | registerOutputVector (const char *modulename, const char *vectorname, int tuple) |
void | deregisterOutputVector (void *vechandle) |
bool | recordInOutputVector (void *vechandle, simtime_t t, double value) |
bool | recordInOutputVector (void *vechandle, simtime_t t, double value1, double value2) |
Scalar statistics. | |
These are the functions the cSimpleModule::recordScalar() functions internally rely on.
The behavior of these functions can be changed by plugging in a different cOutputScalarManager object into the user interface library. (Or alternatively, by reimplementing the whole cEnvir of course). | |
void | recordScalar (cModule *module, const char *name, double value) |
void | recordScalar (cModule *module, const char *name, const char *text) |
void | recordScalar (cModule *module, const char *name, cStatistic *stats) |
Management of streams where snapshots can be written. | |
The behavior of these functions can be changed by plugging in a different cSnapshotManager object into the user interface library. (Or alternatively, by reimplementing the whole cEnvir of course). | |
ostream* | getStreamForSnapshot () |
void | releaseStreamForSnapshot (ostream *os) |
Miscellaneous functions. | |
unsigned | extraStackForEnvir () |
int | runningMode () const |
int | argCount () |
char** | argVector () |
cEnvir has only one instance, the ev global variable.
cEnvir member functions can be rougly divided into two groups:
The implementation of cEnvir is not part of the simulation kernel, it's in a separate library (the Envir library; see src/envir). This means that customizers are free to replace the environment of the simulation as they like, by simply linking the executable with a different library.
The default (Envir library) implementation of cEnvir delegates its task to an internal "simulation application" object. Cmdenv and Tkenv inherit from the default simulation application class.
The default (src/envir) implementation of cEnvir can be customized without changing the via classes declared in the envirext.h header (e.g. cOutputVectorManager, cOutputScalarManager).
|
Constructor. |
|
Destructor. |
|
Access to original command-line arguments. |
|
Access to original command-line arguments. |
|
Puts a yes/no question to the user. The question itself is expected in the printf() format (format string + arguments). The true return value means yes, false means no. |
|
Pops up a dialog, displays the message given in 'promptfmt' and following arguments in printf() format and reads a line (maximum len characters) from the user into the buffer 'buf'. Returns true if the user pressed the Cancel button. |
|
Notifies the environment that a simple module executed a breakpoint() call. |
|
cOutVector objects must deregister themselves when they are no longer needed. |
|
Called from cSimpleModule; it returns how much extra stack space the user interface recommends for the simple modules. |
|
Flushes the output buffer of ev.printf() and ev<< operations. Only some user interfaces need it: it can be useful with Cmdenv which writes to the standard output, but no need for it with Tkenv which displays all output immediately anyway. |
|
Used with parallel execution. It is called internally by the simulation kernel when something was written to ev by another segment. |
|
Returns display string for an object given with its full name. |
|
Called by the simulation kernel (cModulePar) to obtain value for an input module parameter. |
|
User by distributed execution. Returns physical name for a logical machine name. |
|
Returns a stream where a snapshot can be written. Called from cSimulation::snapshot(). |
|
Similar to cEnvir::askf(), but just writes out the prompt message string with no formatting. |
|
Notifies the environment that a message was delivered to its destination module, that is, a message arrival event occurred. Details can be extracted from the message object itself. The user interface implementation may use the notification to animate the message on a network diagram, to write a log entry, etc. |
|
Notifies the environment that a message was sent. Details can be extracted from the message object itself. The user interface implementation may use the notification to animate the message on a network diagram, to write a log entry, etc. |
|
Notifies the environment that the object no longer exists. The user interface should close all inspector windows for the object and remove it from object lists currently displayed. cObject's destructor automatically calls this function. |
|
Simple modules can output text into their own window through this function. The text is expected in printf() format (format string + arguments). |
|
Displays a message in dialog box. This function should not be used too much by simple modules, if ever. |
|
Returns the prompt string. |
|
Similar to ev.printf(), but just writes out its argument string with no formatting. |
|
This method is intended to be called by cOutVector objects to write a value pair into the output vector. The return value is true if the data was actually recorded, and false if it was not recorded (because of filtering, etc.) |
|
This method is intended to be called by cOutVector objects to write a value into the output vector. The return value is true if the data was actually recorded, and false if it was not recorded (because of filtering, etc.) |
|
Records a statistics object, in a default configuration into the scalar result file. |
|
Records a string result, in a default configuration into the scalar result file. |
|
Records a double scalar result, in a default configuration into the scalar result file. |
|
This method is intended to be called by cOutVector objects to register themselves. The return value is a handle of type void*; this handle has to be passed to record() to identify the vector each time a value is written. |
|
Releases a stream after a snapshot was written. |
|
Called from main(). This function should encapsulate the whole functionality of running the application. The return value may be used as exit code for the simulation program. |
|
Returns whether the simulation is distributed, and if yes, if this process is master or slave. |
|
Sets the prompt for >> operators. |
|
This function is called by main() at the beginning of the program. It receives the command-line arguments as parameters. |
|
Called from main() before exiting. |