cNedMathFunction Class Reference

API: cNedMathFunction Class Reference
API
cNedMathFunction Class Reference
Inheritance diagram for cNedMathFunction:
[legend]

Public Member Functions

Constructors, destructor, assignment
 cNedMathFunction (const char *name, MathFuncNoArg f, int argc=-1, const char *category=nullptr, const char *description=nullptr)
 cNedMathFunction (const char *name, MathFunc1Arg f, int argc=-1, const char *category=nullptr, const char *description=nullptr)
 cNedMathFunction (const char *name, MathFunc2Args f, int argc=-1, const char *category=nullptr, const char *description=nullptr)
 cNedMathFunction (const char *name, MathFunc3Args f, int argc=-1, const char *category=nullptr, const char *description=nullptr)
 cNedMathFunction (const char *name, MathFunc4Args f, int argc=-1, const char *category=nullptr, const char *description=nullptr)
virtual ~cNedMathFunction ()
Redefined cObject member functions.
virtual std::string str () const override
Public Member Functions inherited from cNoncopyableOwnedObject
 cNoncopyableOwnedObject (const char *name=nullptr, bool namepooling=true)
virtual cNoncopyableOwnedObjectdup () const override
Public Member Functions inherited from cOwnedObject
 cOwnedObject ()
 cOwnedObject (const char *name, bool namepooling=true)
 cOwnedObject (const cOwnedObject &obj)
virtual ~cOwnedObject ()
cOwnedObjectoperator= (const cOwnedObject &o)
virtual cObjectgetOwner () const override
virtual bool isOwnedObject () const override
Public Member Functions inherited from cNamedObject
 cNamedObject ()
 cNamedObject (const char *name, bool namepooling=true)
 cNamedObject (const cNamedObject &obj)
virtual ~cNamedObject ()
cNamedObjectoperator= (const cNamedObject &o)
virtual void setName (const char *s)
virtual const char * getName () const override
virtual void setNamePooling (bool b)
virtual bool getNamePooling ()
Public Member Functions inherited from cObject
 cObject ()
 cObject (const cObject &other)=default
virtual ~cObject ()
virtual const char * getClassName () const
bool isName (const char *s) const
virtual const char * getFullName () const
virtual std::string getFullPath () const
virtual std::string getClassAndFullName () const
virtual std::string getClassAndFullPath () const
const cObjectgetThisPtr () const
virtual std::ostream & printOn (std::ostream &os) const
virtual bool isSoftOwner () const
virtual void forEachChild (cVisitor *v)
cObjectfindObject (const char *name, bool deep=true)
virtual cClassDescriptorgetDescriptor () const
void copyNotSupported () const

Member access.

int getNumArgs () const
MathFunc getMathFunc () const
MathFuncNoArg getMathFuncNoArg () const
MathFunc1Arg getMathFunc1Arg () const
MathFunc2Args getMathFunc2Args () const
MathFunc3Args getMathFunc3Args () const
MathFunc4Args getMathFunc4Args () const
const char * getCategory () const
const char * getDescription () const
static cNedMathFunctionfind (const char *name, int numArgs)
static cNedMathFunctionget (const char *name, int numArgs)
static cNedMathFunctionfindByPointer (MathFunc f)

Additional Inherited Members

Static Public Member Functions inherited from cOwnedObject
static long getTotalObjectCount ()
static long getLiveObjectCount ()
static void resetObjectCounters ()
static cSoftOwnergetOwningContext ()
Protected Member Functions inherited from cObject
virtual void take (cOwnedObject *obj)
virtual void drop (cOwnedObject *obj)
void dropAndDelete (cOwnedObject *obj)

Description

Registration class for extending NED with new mathematical functions.

Objects of this class are usually created via the Define_NED_Math_Function() macro. It stores a pointer to a function taking up to 4 doubles as args and returning a double.

Constructor & Destructor Documentation

◆ cNedMathFunction() [1/5]

cNedMathFunction ( const char * name,
MathFuncNoArg f,
int argc = -1,
const char * category = nullptr,
const char * description = nullptr )

Constructor.

Referenced by find(), findByPointer(), and get().

◆ cNedMathFunction() [2/5]

cNedMathFunction ( const char * name,
MathFunc1Arg f,
int argc = -1,
const char * category = nullptr,
const char * description = nullptr )

Constructor.

◆ cNedMathFunction() [3/5]

cNedMathFunction ( const char * name,
MathFunc2Args f,
int argc = -1,
const char * category = nullptr,
const char * description = nullptr )

Constructor.

◆ cNedMathFunction() [4/5]

cNedMathFunction ( const char * name,
MathFunc3Args f,
int argc = -1,
const char * category = nullptr,
const char * description = nullptr )

Constructor.

◆ cNedMathFunction() [5/5]

cNedMathFunction ( const char * name,
MathFunc4Args f,
int argc = -1,
const char * category = nullptr,
const char * description = nullptr )

Constructor.

◆ ~cNedMathFunction()

virtual ~cNedMathFunction ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ str()

virtual std::string str ( ) const
overridevirtual

Produces a one-line description of the object's contents.

Reimplemented from cObject.

◆ getNumArgs()

int getNumArgs ( ) const
inline

Argument count to function.

◆ getMathFunc()

MathFunc getMathFunc ( ) const
inline

Returns function pointer as double function with unchecked arg list (no type safety!)

◆ getMathFuncNoArg()

MathFuncNoArg getMathFuncNoArg ( ) const

Returns function pointer as double function with no args. Throws exception if actual arg count is different.

◆ getMathFunc1Arg()

MathFunc1Arg getMathFunc1Arg ( ) const

Returns function pointer as double function with 1 double arg. Throws exception if actual arg count is different.

◆ getMathFunc2Args()

MathFunc2Args getMathFunc2Args ( ) const

Returns function pointer as double function with 2 double args. Throws exception if actual arg count is different.

◆ getMathFunc3Args()

MathFunc3Args getMathFunc3Args ( ) const

Returns function pointer as double function with 3 double args. Throws exception if actual arg count is different.

◆ getMathFunc4Args()

MathFunc4Args getMathFunc4Args ( ) const

Returns function pointer as double function with 4 double args. Throws exception if actual arg count is different.

◆ getCategory()

const char * getCategory ( ) const
inline

Returns a string that can be useful in classifying NED functions, e.g. "trigonometric".

◆ getDescription()

const char * getDescription ( ) const
inline

Returns the function's documentation as a string.

◆ find()

cNedMathFunction * find ( const char * name,
int numArgs )
static

Finds a registered function by name. Returns nullptr if not found.

References cNedMathFunction().

◆ get()

cNedMathFunction * get ( const char * name,
int numArgs )
static

Finds a registered function by name. Throws an error if not found.

References cNedMathFunction().

◆ findByPointer()

cNedMathFunction * findByPointer ( MathFunc f)
static

Finds a registered function by function pointer.

References cNedMathFunction().