OMNeT++ Simulation Library  5.6.1
Simulation Support

Description

Classes and other items in this group are important part of the simulation kernel, but they are not of primary interest to simulation model authors.

Central classes are:

Classes

class  cComponentType
 Common base class for cModuleType and cChannelType. More...
 
class  cModuleType
 Abstract class for creating a module of a specific type. More...
 
class  cChannelType
 Abstract base class for creating a channel of a given type. More...
 
class  cConfigOption
 Describes a configuration option. More...
 
class  cCoroutine
 Low-level coroutine library. Coroutines are used by cSimpleModule. More...
 
class  cDefaultList
 Internal class, used as a base class for modules and channels. It is not intended for subclassing outside the simulation kernel. More...
 
class  cDisplayString
 Represents a display string. More...
 
class  cDynamicExpression
 A stack-based expression evaluator class, for dynamically created expressions. More...
 
class  cEnum
 Provides string representation for enums. More...
 
class  cEnvir
 cEnvir represents the "environment" or user interface of the simulation. More...
 
class  cRunnableEnvir
 A cEnvir that can be instantiated as a user interface, like Cmdenv and Tkenv. More...
 
class  cEvent
 Represents an event in the discrete event simulator. More...
 
class  cEventHeap
 The default, binary heap based implementation of the future event set. More...
 
class  cException
 Exception class. More...
 
class  cTerminationException
 Thrown when the simulation is completed without error. More...
 
class  cRuntimeError
 Thrown when the simulation kernel or other components detect a runtime error. More...
 
class  cExpression
 Abstract base class for expression evaluators. More...
 
class  cFutureEventSet
 Abstract base class for the future event set (FES), a central data structure for discrete event simulation. FES is also known as FEL (future event list). More...
 
class  cISimulationLifecycleListener
 A callback interface for receiving notifications at various stages simulations, including setting up, running, and tearing down.. More...
 
class  cMsgPar
 Allows a value (string, bool, double, etc) to be attached to a cMessage object. More...
 
class  cNamedObject
 Extends cObject with a name string. Also includes a "flags" member, with bits open for use by subclasses. More...
 
class  cNedValue
 Value used during evaluating NED expressions. More...
 
class  cNullEnvir
 A do-nothing cEnvir implementation. More...
 
class  cObject
 Root of the OMNeT++ class hierarchy. cObject is a lightweight class without any data members. More...
 
class  cOwnedObject
 A cObject that keeps track of its owner. It serves as base class for many classes in the OMNeT++ library. More...
 
class  cNoncopyableOwnedObject
 Base class for cOwnedObject-based classes that do not wish to support assignment and duplication. More...
 
class  cProperties
 A collection of properties (cProperty). More...
 
class  cProperty
 Stores a (NED) property with its (possibly compound) value. More...
 
class  cNumericResultFilter
 Base class for filters that expect to receive an numeric value. More...
 
class  cObjectResultFilter
 Base class for filters that expect to receive an object. More...
 
class  cResultListener
 Common abstract base class for result filters and result recorders. More...
 
class  cNumericResultRecorder
 Abstract base class for numeric result recorders. More...
 
class  cScheduler
 Abstract class to encapsulate event scheduling. More...
 
class  cSequentialScheduler
 Event scheduler for sequential simulation. More...
 
class  cRealTimeScheduler
 Real-time scheduler class. More...
 
class  cSimulation
 Simulation manager class. More...
 
class  cVisitor
 Enables traversing the tree of (cObject-rooted) simulation objects. More...
 
class  cXMLElement
 Represents an XML element in an XML configuration file. More...
 

Macros

#define Enter_Method
 Denotes module class member function as callable from other modules. More...
 
#define Enter_Method_Silent
 Denotes module class member function as callable from other modules. More...
 

Typedefs

typedef void(* CoroutineFnp) (void *)
 Prototype for functions that can be used with cCoroutine objects as coroutine bodies. More...
 
typedef cNedValue(* NedFunction) (cComponent *context, cNedValue argv[], int argc)
 A function that can be used with cDynamicExpression. More...
 
typedef double(* MathFunc) (...)
 Prototype for mathematical functions. More...
 
typedef double(* MathFuncNoArg) ()
 Prototype for mathematical functions taking no arguments. More...
 
typedef double(* MathFunc1Arg) (double)
 Prototype for mathematical functions taking one argument. More...
 
typedef double(* MathFunc2Args) (double, double)
 Prototype for mathematical functions taking two arguments. More...
 
typedef double(* MathFunc3Args) (double, double, double)
 Prototype for mathematical functions taking three arguments. More...
 
typedef double(* MathFunc4Args) (double, double, double, double)
 Prototype for mathematical functions taking four arguments. More...
 
typedef int64_t eventnumber_t
 Sequence number of events during the simulation. Events are numbered from one. (Event number zero is reserved for network setup and initialization.) More...
 
typedef int64_t intpar_t
 Type for NED parameter values that store integers. It is guaranteed to be signed and at least as wide as "long". More...
 

Enumerations

enum  SimulationLifecycleEventType {
  LF_ON_STARTUP, LF_PRE_NETWORK_SETUP, LF_POST_NETWORK_SETUP, LF_PRE_NETWORK_INITIALIZE,
  LF_POST_NETWORK_INITIALIZE, LF_ON_SIMULATION_START, LF_ON_SIMULATION_PAUSE, LF_ON_SIMULATION_RESUME,
  LF_ON_SIMULATION_SUCCESS, LF_ON_SIMULATION_ERROR, LF_PRE_NETWORK_FINISH, LF_POST_NETWORK_FINISH,
  LF_ON_RUN_END, LF_PRE_NETWORK_DELETE, LF_POST_NETWORK_DELETE, LF_ON_SHUTDOWN
}
 Event type for cISimulationLifecycleListener's lifecycleEvent() method. More...
 

Functions

cObjectcreateOne (const char *classname)
 Shortcut to cObjectFactory::createOne(). More...
 
cObjectcreateOneIfClassIsKnown (const char *classname)
 Shortcut to cObjectFactory::createOneIfClassIsKnown(). More...
 
cSimulationgetSimulation ()
 Returns the currently active simulation, or nullptr if there is none. More...
 
cEnvirgetEnvir ()
 Returns the environment object for the currently active simulation. This function never returns nullptr (not even during shutdown). More...
 

Macro Definition Documentation

◆ Enter_Method

#define Enter_Method

Denotes module class member function as callable from other modules.

Usage: Enter_Method(fmt, arg1, arg2...);

Example: Enter_Method("requestPacket(%d)",n);

The macro should be put at the top of every module member function that may be called from other modules. This macro arranges to temporarily switch the context to the called module (the old context will be restored automatically when the method returns), and also lets the graphical user interface animate the method call.

The argument(s) should specify the method name (and parameters) – it will be used for the animation. The argument list works as in printf(), so it is easy to include the actual parameter values.

See also
Enter_Method_Silent() macro

◆ Enter_Method_Silent

#define Enter_Method_Silent

Denotes module class member function as callable from other modules.

This macro is similar to the Enter_Method() macro, only it does not animate the call on the GUI; the call is still recorded into the the event log file.

The macro may be called with or without arguments. When called with arguments, they should be a printf-style format string, and parameters to be substituted into it; the resulting string should contain the method name and the actual arguments.

Usage: Enter_Method_Silent();, Enter_Method_Silent(fmt, arg1, arg2...);

Example: Enter_Method_Silent("getRouteFor(address=%d)",address);

See also
Enter_Method() macro

Typedef Documentation

◆ CoroutineFnp

typedef void(* CoroutineFnp) (void *)

Prototype for functions that can be used with cCoroutine objects as coroutine bodies.

◆ NedFunction

typedef cNedValue(* NedFunction) (cComponent *context, cNedValue argv[], int argc)

A function that can be used with cDynamicExpression.

See also
cNedFunction, Define_NED_Function().

◆ MathFunc

typedef double(* MathFunc) (...)

Prototype for mathematical functions.

See also
cNedMathFunction, Define_NED_Math_Function().

◆ MathFuncNoArg

typedef double(* MathFuncNoArg) ()

Prototype for mathematical functions taking no arguments.

See also
cNedMathFunction, Define_NED_Math_Function().

◆ MathFunc1Arg

typedef double(* MathFunc1Arg) (double)

Prototype for mathematical functions taking one argument.

See also
cNedMathFunction, Define_NED_Math_Function().

◆ MathFunc2Args

typedef double(* MathFunc2Args) (double, double)

Prototype for mathematical functions taking two arguments.

See also
cNedMathFunction, Define_NED_Math_Function().

◆ MathFunc3Args

typedef double(* MathFunc3Args) (double, double, double)

Prototype for mathematical functions taking three arguments.

See also
cNedMathFunction, Define_NED_Math_Function().

◆ MathFunc4Args

typedef double(* MathFunc4Args) (double, double, double, double)

Prototype for mathematical functions taking four arguments.

See also
cNedMathFunction, Define_NED_Math_Function().

◆ eventnumber_t

typedef int64_t eventnumber_t

Sequence number of events during the simulation. Events are numbered from one. (Event number zero is reserved for network setup and initialization.)

◆ intpar_t

typedef int64_t intpar_t

Type for NED parameter values that store integers. It is guaranteed to be signed and at least as wide as "long".

Enumeration Type Documentation

◆ SimulationLifecycleEventType

Event type for cISimulationLifecycleListener's lifecycleEvent() method.

Enumerator
LF_ON_STARTUP 

Fired on the startup of the simulation program, after global configuration has been applied, but before any simulation has been set up.

LF_PRE_NETWORK_SETUP 

Fired before network setup. At the time of the call, cSimulation's network type pointer (see getNetworkType()) already points to the type of the network that will be set up.

LF_POST_NETWORK_SETUP 

Fired immediately after a network has been set up, and before callInitialize() has been invoked. If there has been an error during network setup, then only LF_SIMULATION_ERROR will be fired but not this event. For practical purposes, this event is almost the same as LF_PRE_NETWORK_INITIALIZE.

LF_PRE_NETWORK_INITIALIZE 

Fired just before the network is initialized, i.e. before callInitialize() has been invoked on the system module.

LF_POST_NETWORK_INITIALIZE 

Fired just after the network was initialized, i.e. after callInitialize() was invoked on the system module. If there is has been an error during initialization, then only LF_SIMULATION_ERROR will be fired but not this event.

LF_ON_SIMULATION_START 

Fired immediately before the first event is processed by the simulation. This is similar to, but not the same as LF_POST_NETWORK_INITIALIZE, because on the GUI there might be a delay between the user setting up the network and actually hitting the Run button.

LF_ON_SIMULATION_PAUSE 

Fired when simulation execution has been temporarily stopped by the user between two events.

LF_ON_SIMULATION_RESUME 

Fired when the user resumes simulation execution after it has been paused. This event may be used e.g. by the real-time scheduler to resynchronize with wall clock time.

LF_ON_SIMULATION_SUCCESS 

Fired just after processing the last event of the simulation (i.e. still before finalization). If the simulation stops with an error, LF_ON_SIMULATION_ERROR will be fired instead of this event.

LF_ON_SIMULATION_ERROR 

Fired on a runtime error, in any stage of a simulation run's lifecycle (during network setup, initialization, in an event during simulation, during finalization and network deletion.)

LF_PRE_NETWORK_FINISH 

Fired just before the network is finalized, i.e. before callFinish() has been invoked on the system module. This only happens if the simulation has completed successfully (did not stop with an error).

LF_POST_NETWORK_FINISH 

Fired immediately after the network has been finalized, i.e. after callFinish() invocation has taken place on the system module. If there has been an error during finalization, then only LF_ON_SIMULATION_ERROR will be fired but not this event.

LF_ON_RUN_END 

Fired after the simulation has been terminated, either by calling finish() or because of an error any previous state (including network setup). This event is distinct from LF_PRE_NETWORK_DELETE, because when using a GUI, there might be a delay between the simulation terminating and the user action that causes the network to be deleted. Note that using the GUI, it is also possible for the user to skip finalization of the network (even if there was no error), so LF_PRE_NETWORK_FINISH / LF_POST_NETWORK_FINISH are not guaranteed to have been fired prior to this event.

LF_PRE_NETWORK_DELETE 

Fired before the network is deleted, i.e. before cSimulation's deleteNetwork() has been called. This event is fired even if there was an error during network setup.

LF_POST_NETWORK_DELETE 

Fired after the network has been deleted, i.e. cSimulation's deleteNetwork() was called. At the time of the call, the network type pointer in cSimulation (see getNetworkType()) is still valid. This event is not fired if an error occurs during deleteNetwork().

LF_ON_SHUTDOWN 

Fired before the simulation program exits. At the time of the call, the simulated network has been torn down, but the simulation infrastructure (scheduler object, etc) is still in place.

Function Documentation

◆ createOne()

cObject* omnetpp::createOne ( const char *  classname)
inline

◆ createOneIfClassIsKnown()

cObject* omnetpp::createOneIfClassIsKnown ( const char *  classname)
inline

◆ getSimulation()

cSimulation* omnetpp::getSimulation ( )
inline

Returns the currently active simulation, or nullptr if there is none.

References cSimulation::getActiveSimulation().

Referenced by cMessage::getArrivalModule(), cTopology::Node::getModule(), cMessage::getSenderModule(), cComponent::getThisPtr(), and cMessage::setTimestamp().

◆ getEnvir()

cEnvir* omnetpp::getEnvir ( )
inline

Returns the environment object for the currently active simulation. This function never returns nullptr (not even during shutdown).

References cSimulation::getActiveEnvir().