OMNeT++ Simulation Library
5.6.1
|
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, NAME, 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_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 should have the following signature:
cNedValue f(cComponent *context, cNedValue argv[], int argc)
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 { IDLE, BUSY, SLEEPING }; Register_Enum(State, ( State::IDLE, State::BUSY, State::SLEEPING));
#define Register_Enum2 | ( | VAR, | |
NAME, | |||
VALUES | |||
) |
Registers an enum, and makes it accessible via a global cEnum* pointer, using explicit strings for the enum type and it member names.
Example:
enum State { IDLE, BUSY, SLEEPING }; Register_Enum2(stateEnum, "State", ( "idle", State::IDLE, "busy", State::BUSY, "sleeping", State::SLEEPING, nullptr)); // see note below
Note: One may need to put (void*)nullptr as the last item, due to a bug in certain compilers (they push a 32-bit zero value instead a of a 64-bit one in the "..." arg list, causing the called function to be unable to determine the end of the argument list).
#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);