OMNeT++ Simulation Library
5.4.1
|
#include <cnedfunction.h>
Registration class for extending NED with arbitrary new functions.
Objects of this class are usually created via the Define_NED_Function() macro.
Public Member Functions | |
Constructors, destructor, assignment | |
cNedFunction (NedFunction f, const char *signature, const char *category=nullptr, const char *description=nullptr) | |
virtual | ~cNedFunction () |
Redefined cObject member functions. | |
virtual std::string | str () const override |
Member access. | |
cNedValue | invoke (cComponent *context, cNedValue argv[], int argc) |
NedFunction | getFunctionPointer () const |
const char * | getSignature () const |
char | getReturnType () const |
char | getArgType (int k) const |
int | getMinArgs () const |
int | getMaxArgs () const |
bool | hasVarArgs () const |
const char * | getCategory () const |
const char * | getDescription () const |
![]() | |
cNoncopyableOwnedObject (const char *name=nullptr, bool namepooling=true) | |
virtual cNoncopyableOwnedObject * | dup () const override |
virtual void | parsimPack (cCommBuffer *buffer) const override |
virtual void | parsimUnpack (cCommBuffer *buffer) override |
![]() | |
cOwnedObject () | |
cOwnedObject (const char *name, bool namepooling=true) | |
cOwnedObject (const cOwnedObject &obj) | |
virtual | ~cOwnedObject () |
cOwnedObject & | operator= (const cOwnedObject &o) |
virtual cObject * | getOwner () const override |
virtual bool | isOwnedObject () const override |
virtual bool | isSoftOwner () const |
![]() | |
cNamedObject () | |
cNamedObject (const char *name, bool namepooling=true) | |
cNamedObject (const cNamedObject &obj) | |
virtual | ~cNamedObject () |
cNamedObject & | operator= (const cNamedObject &o) |
virtual void | setName (const char *s) |
virtual const char * | getName () const override |
virtual void | setNamePooling (bool b) |
virtual bool | getNamePooling () |
![]() | |
cObject () | |
cObject (const cObject &other) | |
virtual | ~cObject () |
virtual const char * | getClassName () const |
bool | isName (const char *s) const |
virtual const char * | getFullName () const |
virtual std::string | getFullPath () const |
const cObject * | getThisPtr () const |
virtual _OPPDEPRECATED std::string | info () const |
virtual _OPPDEPRECATED std::string | detailedInfo () const |
virtual void | forEachChild (cVisitor *v) |
cObject * | findObject (const char *name, bool deep=true) |
void | copyNotSupported () const |
Static Public Member Functions | |
static cNedFunction * | find (const char *name) |
static cNedFunction * | get (const char *name) |
static cNedFunction * | findByPointer (NedFunction f) |
![]() | |
static long | getTotalObjectCount () |
static long | getLiveObjectCount () |
static void | resetObjectCounters () |
static cDefaultList * | getDefaultOwner () |
Additional Inherited Members | |
![]() | |
virtual void | take (cOwnedObject *obj) |
virtual void | drop (cOwnedObject *obj) |
void | dropAndDelete (cOwnedObject *obj) |
cNedFunction | ( | NedFunction | f, |
const char * | signature, | ||
const char * | category = nullptr , |
||
const char * | description = nullptr |
||
) |
Constructor. Signature is expected in the following syntax: returntype name(argtype argname,...), where types can be bool, long, double, quantity, intquantity, string, xml, any; names of optional arguments end in '?'. The object name will be the function name, as extracted from the signature string. The signature may end in an ellipsis, i.e. "...", to mean that any number of extra args of unspecified types should be accepted. (When there are both optional args and an ellipsis, then extra arguments can only be passed when all optional arguments are all supplied.)
Examples: "quantity uniform(quantity a, quantity b, long rng?)" "string sprintf(format, ...)" "any max(...)"
|
inlinevirtual |
Destructor.
|
overridevirtual |
Produces a one-line description of the object's contents.
Reimplemented from cObject.
cNedValue invoke | ( | cComponent * | context, |
cNedValue | argv[], | ||
int | argc | ||
) |
Performs argument type checking, and invokes the function.
|
inline |
Returns the function pointer. Do not call the function directly, because that would bypass argument type validation.
|
inline |
Returns the functions signature, as passed to the constructor
|
inline |
Returns the function return type, one of the characters B,L,D,Q,S,X,* for bool, long, double, quantity, string, xml and any, respectively.
|
inline |
Returns the type of the kth argument; result is one of the characters B,L,D,Q,S,X,* for bool, long, double, quantity, string, xml and any, respectively.
|
inline |
Returns the minimum number of arguments (i.e. the number of mandatory arguments).
|
inline |
Returns the maximum number of typed arguments (i.e. the last max-min args are optional). If hasVarArgs() is true, the function actually accepts more than getMaxArgs() arguments.
|
inline |
Returns true if the function signature ends in an ellipsis ("..."), that is, the function supports varargs.
|
inline |
Returns a string that can be useful in classifying NED functions, e.g. "trigonometric".
|
inline |
Returns the function's documentation as a string.
|
static |
Finds a registered function by name. Returns nullptr if not found.
|
static |
Finds a registered function by name. Throws an error if not found.
|
static |
Finds a registered function by function pointer.