Macros for registering various classes, functions and other extension items with the simulation kernel. Registration is necessary for allowing instantiation by class name and attaching meta-information.
Macros | |
#define | Register_ResultFilter(NAME, CLASSNAME) |
Registers a result filter. More... | |
#define | Register_ResultFilter2(NAME, CLASSNAME, DESCRIPTION) |
Registers a result filter with a description string. More... | |
#define | Register_ResultRecorder(NAME, CLASSNAME) |
Registers a result recorder class. More... | |
#define | Register_ResultRecorder2(NAME, CLASSNAME, DESCRIPTION) |
Registers a result recorder class with a description string. More... | |
#define | Define_NED_Math_Function(NAME, ARGCOUNT) |
Registers a C/C++ mathematical function for use in NED and ini files. The function may take 0, 1, 2 or 3 double arguments, and must return a double. Corresponding C/C++ typedefs: MathFuncNoArg, MathFunc1Arg, MathFunc2Args, MathFunc3Args, MathFunc4Args. More... | |
#define | Define_NED_Math_Function2(NAME, FUNCTION, ARGCOUNT) |
Like Define_NED_Math_Function(), but takes three arguments, the second one being the pointer to the function. This macro allows registering a function with a different name from its implementation. More... | |
#define | Define_NED_Math_Function3(NAME, ARGCOUNT, CATEGORY, DESCRIPTION) |
Like Define_NED_Math_Function(), but takes category and description strings as well. More... | |
#define | Define_NED_Math_Function4(NAME, FUNCTION, ARGCOUNT, CATEGORY, DESCRIPTION) |
Like Define_NED_Math_Function2(), but takes category and description strings as well. More... | |
#define | Define_NED_Function(FUNCTION, SIGNATURE) |
Registers a C/C++ function for use in NED and ini files; see cNedFunction. FUNCTION is a pointer to the function, and SIGNATURE is the function's signature in NED. More... | |
#define | Define_NED_Function2(FUNCTION, SIGNATURE, CATEGORY, DESCRIPTION) |
Like Define_NED_Function(), but allows one to specify a category string and documentation as well. More... | |
#define | Register_Class(CLASSNAME) |
Register class. This defines a factory object which makes it possible to create an object by the passing class name to the createOne() function. The class must be a subclass of cObject, otherwise a compile-time error will occur: "cannot convert..." More... | |
#define | Register_Abstract_Class(CLASSNAME) |
Register an abstract class. Registration makes it possible to dynamically test whether an object is a subclass of the registered class (see cObjectFactory::isInstance()). The class must be a subclass of cObject, otherwise a compile-time error will occur: "cannot convert..." More... | |
#define | Define_Module(CLASSNAME) |
Announces the C++ simple module class to OMNeT++, and couples it with the NED simple module declaration of the same name. More... | |
#define | Define_Channel(CLASSNAME) |
Announces the C++ channel class to OMNeT++, and couples it with the NED channel declaration of the same name. More... | |
#define | Register_ClassDescriptor(DESCRIPTORCLASS) |
Internal. Registers a class descriptor which provides reflection information. More... | |
#define | Register_GlobalConfigOption(ID, NAME, TYPE, DEFAULTVALUE, DESCRIPTION) |
Registers a global configuration option. More... | |
#define | Register_PerRunConfigOption(ID, NAME, TYPE, DEFAULTVALUE, DESCRIPTION) |
Registers a per-run configuration option. More... | |
#define | Register_GlobalConfigOptionU(ID, NAME, UNIT, DEFAULTVALUE, DESCRIPTION) |
Registers a global configuration option with type==CFG_DOUBLE and an expected unit of measurement. More... | |
#define | Register_PerRunConfigOptionU(ID, NAME, UNIT, DEFAULTVALUE, DESCRIPTION) |
Registers a per-run configuration option with type==CFG_DOUBLE and an expected unit of measurement. More... | |
#define | Register_PerObjectConfigOption(ID, NAME, KIND, TYPE, DEFAULTVALUE, DESCRIPTION) |
Registers a per-object configuration option. More... | |
#define | Register_PerObjectConfigOptionU(ID, NAME, KIND, UNIT, DEFAULTVALUE, DESCRIPTION) |
Registers a per-object configuration option with type==CFG_DOUBLE and an expected unit of measurement. More... | |
#define | Register_MessagePrinter(CLASSNAME) |
Registers a message printer class (cMessagePrinter) More... | |
#define | Register_Enum(NAME, VALUES) |
Registers an enum. More... | |
#define | Register_Enum2(VAR, NAMESTR, VALUES) |
Registers an enum, and makes it accessible via a global cEnum* pointer, using explicit strings for the enum type and it member names. More... | |
#define | Register_Enum_WithVar(VAR, NAME, VALUES) |
Registers an enum while giving access to the resulting cEnum object (Its pointer will be stored in the cEnum* variable given as the first argument). More... | |
#define | Register_Enum_Custom(VAR, NAME, NAME_VALUE_PAIRS) |
Registers an enum and makes it accessible via a global cEnum* pointer, allowing custom names for enum members. More... | |
#define | Register_Figure(NAME, CLASSNAME) |
Registers a new figure type. The macro expects a type name string (an identifier that can be used in the type attribute of the @figure property), and a C++ class name. The class must be derived from cFigure. More... | |
#define Register_ResultFilter | ( | NAME, | |
CLASSNAME | |||
) |
Registers a result filter.
The class must be a subclass of cResultFilter. Registered result filters can be used in the source=
and record=
attributes of @statistic
properties in NED files, and with the **.result-recording-modes=
configuration option.
#define Register_ResultFilter2 | ( | NAME, | |
CLASSNAME, | |||
DESCRIPTION | |||
) |
Registers a result filter with a description string.
The class must be a subclass of cResultFilter. Registered result filters can be used in the source=
and record=
attributes of @statistic
properties in NED files, and with the **.result-recording-modes=
configuration option.
#define Register_ResultRecorder | ( | NAME, | |
CLASSNAME | |||
) |
Registers a result recorder class.
The class must be a subclass of cResultRecorder.
Registered result recorders can be used in the record=
attributes of @statistic
properties in NED files, and with the **.result-recording-modes=
configuration option.
#define Register_ResultRecorder2 | ( | NAME, | |
CLASSNAME, | |||
DESCRIPTION | |||
) |
Registers a result recorder class with a description string.
The class must be a subclass of cResultRecorder.
Registered result recorders can be used in the record=
attributes of @statistic
properties in NED files, and with the **.result-recording-modes=
configuration option.
#define Define_NED_Math_Function | ( | NAME, | |
ARGCOUNT | |||
) |
Registers a C/C++ mathematical function for use in NED and ini files. The function may take 0, 1, 2 or 3 double arguments, and must return a double. Corresponding C/C++ typedefs: MathFuncNoArg, MathFunc1Arg, MathFunc2Args, MathFunc3Args, MathFunc4Args.
Commonly used <math.h> functions have Define_NED_Math_Function() lines in the OMNeT++ simulation kernel.
#define Define_NED_Math_Function2 | ( | NAME, | |
FUNCTION, | |||
ARGCOUNT | |||
) |
Like Define_NED_Math_Function(), but takes three arguments, the second one being the pointer to the function. This macro allows registering a function with a different name from its implementation.
#define Define_NED_Math_Function3 | ( | NAME, | |
ARGCOUNT, | |||
CATEGORY, | |||
DESCRIPTION | |||
) |
Like Define_NED_Math_Function(), but takes category and description strings as well.
#define Define_NED_Math_Function4 | ( | NAME, | |
FUNCTION, | |||
ARGCOUNT, | |||
CATEGORY, | |||
DESCRIPTION | |||
) |
Like Define_NED_Math_Function2(), but takes category and description strings as well.
#define Define_NED_Function | ( | FUNCTION, | |
SIGNATURE | |||
) |
Registers a C/C++ function for use in NED and ini files; see cNedFunction. FUNCTION is a pointer to the function, and SIGNATURE is the function's signature in NED.
The C++ function can have either of the following two signatures:
cValue f(cComponent *context, cValue argv[], int argc); // typedef NedFunction cValue f(cExpression::Context *context, cValue argv[], int argc); // typedef NedFunctionExt
SIGNATURE is a string with the following syntax: returntype functionname(argtype1 argname1, ...)
, where a type can be one of 'bool', 'int', 'double', 'quantity' ('double' with measurement unit), 'string', 'xml' and 'any'. Optional arguments are denoted by appending a '?' to their names. To let the function accept any number of additional arguments of arbitrary types, add ',...' to the signature.
Example:
Define_NED_Function(uniformFunc,"quantity uniform(quantity a, quantity b, long rng?)")
#define Define_NED_Function2 | ( | FUNCTION, | |
SIGNATURE, | |||
CATEGORY, | |||
DESCRIPTION | |||
) |
Like Define_NED_Function(), but allows one to specify a category string and documentation as well.
#define Register_Class | ( | CLASSNAME | ) |
Register class. This defines a factory object which makes it possible to create an object by the passing class name to the createOne() function. The class must be a subclass of cObject, otherwise a compile-time error will occur: "cannot convert..."
#define Register_Abstract_Class | ( | CLASSNAME | ) |
Register an abstract class. Registration makes it possible to dynamically test whether an object is a subclass of the registered class (see cObjectFactory::isInstance()). The class must be a subclass of cObject, otherwise a compile-time error will occur: "cannot convert..."
#define Define_Module | ( | CLASSNAME | ) |
Announces the C++ simple module class to OMNeT++, and couples it with the NED simple module declaration of the same name.
#define Define_Channel | ( | CLASSNAME | ) |
Announces the C++ channel class to OMNeT++, and couples it with the NED channel declaration of the same name.
#define Register_ClassDescriptor | ( | DESCRIPTORCLASS | ) |
Internal. Registers a class descriptor which provides reflection information.
#define Register_GlobalConfigOption | ( | ID, | |
NAME, | |||
TYPE, | |||
DEFAULTVALUE, | |||
DESCRIPTION | |||
) |
Registers a global configuration option.
#define Register_PerRunConfigOption | ( | ID, | |
NAME, | |||
TYPE, | |||
DEFAULTVALUE, | |||
DESCRIPTION | |||
) |
Registers a per-run configuration option.
#define Register_GlobalConfigOptionU | ( | ID, | |
NAME, | |||
UNIT, | |||
DEFAULTVALUE, | |||
DESCRIPTION | |||
) |
Registers a global configuration option with type==CFG_DOUBLE and an expected unit of measurement.
#define Register_PerRunConfigOptionU | ( | ID, | |
NAME, | |||
UNIT, | |||
DEFAULTVALUE, | |||
DESCRIPTION | |||
) |
Registers a per-run configuration option with type==CFG_DOUBLE and an expected unit of measurement.
#define Register_PerObjectConfigOption | ( | ID, | |
NAME, | |||
KIND, | |||
TYPE, | |||
DEFAULTVALUE, | |||
DESCRIPTION | |||
) |
Registers a per-object configuration option.
#define Register_PerObjectConfigOptionU | ( | ID, | |
NAME, | |||
KIND, | |||
UNIT, | |||
DEFAULTVALUE, | |||
DESCRIPTION | |||
) |
Registers a per-object configuration option with type==CFG_DOUBLE and an expected unit of measurement.
#define Register_MessagePrinter | ( | CLASSNAME | ) |
Registers a message printer class (cMessagePrinter)
#define Register_Enum | ( | NAME, | |
VALUES | |||
) |
Registers an enum.
Example:
enum State { STATE_IDLE, STATE_BUSY, STATE_SLEEPING }; Register_Enum(State, (STATE_IDLE, STATE_BUSY, STATE_SLEEPING));
enum class Mode { ACTIVE, PASSIVE, AUTO }; Register_Enum(Mode, (Mode::ACTIVE, Mode::PASSIVE, Mode::AUTO));
#define Register_Enum2 | ( | VAR, | |
NAMESTR, | |||
VALUES | |||
) |
Registers an enum, and makes it accessible via a global cEnum* pointer, using explicit strings for the enum type and it member names.
NOTE: This macro is deprecated – use Register_Enum_Custom() instead!
Example:
enum State { IDLE, BUSY, SLEEPING }; Register_Enum2(stateEnum, "State", ( "idle", State::IDLE, "busy", State::BUSY, "sleeping", State::SLEEPING, nullptr)); // see note below
#define Register_Enum_WithVar | ( | VAR, | |
NAME, | |||
VALUES | |||
) |
Registers an enum while giving access to the resulting cEnum object (Its pointer will be stored in the cEnum* variable given as the first argument).
Example:
enum State { IDLE, BUSY, SLEEPING }; Register_Enum_WithVar(stateEnum, State, (IDLE, BUSY, SLEEPING));
enum class Mode { ACTIVE, PASSIVE, AUTO }; Register_Enum_WithVar(modeEnum, Mode, (Mode::ACTIVE, Mode::PASSIVE, Mode::AUTO));
#define Register_Enum_Custom | ( | VAR, | |
NAME, | |||
NAME_VALUE_PAIRS | |||
) |
Registers an enum and makes it accessible via a global cEnum* pointer, allowing custom names for enum members.
Example:
enum State { STATE_IDLE, STATE_BUSY, STATE_SLEEPING }; Register_Enum_Custom(stateEnum, State, ( { "idle", STATE_IDLE }, { "busy", STATE_BUSY }, { "sleeping", STATE_SLEEPING } )
#define Register_Figure | ( | NAME, | |
CLASSNAME | |||
) |
Registers a new figure type. The macro expects a type name string (an identifier that can be used in the type attribute of the @figure property), and a C++ class name. The class must be derived from cFigure.
Note: Register_Figure() includes registration the figure class via a Register_Class().
Example:
Register_Figure("polyline", cPolylineFigure);