OMNeT++ Simulation Library  5.6.1
cDynamicExpression::Elem Class Reference

#include <cdynamicexpression.h>

Description

One element in a (reverse Polish) expression.

Public Member Functions

void operator= (const Elem &other)
 
void operator= (bool b)
 
void operator= (intpar_t i)
 
void operator= (double d)
 
void setUnit (const char *s)
 
void operator= (const char *s)
 
void operator= (cXMLElement *x)
 
void operator= (cNedMathFunction *f)
 
void set (cNedFunction *f, int argc)
 
void operator= (Functor *f)
 
void operator= (OpType op)
 
void operator= (cExpression *expr)
 
Type getType () const
 
bool isNumericConstant () const
 
void negate ()
 
bool getBoolConstant () const
 
intpar_t getIntConstant () const
 
double getDoubleConstant () const
 
const char * getUnit () const
 
const char * getStringConstant () const
 
cXMLElementgetXMLElement () const
 
cNedMathFunctiongetMathFunction () const
 
cNedFunctiongetNedFunction () const
 
int getNedFunctionNumArgs () const
 
FunctorgetFunctor () const
 
OpType getOperation () const
 
cExpressiongetConstSubexpression () const
 
int compare (const Elem &other) const
 
std::string str () const
 

Static Public Member Functions

static const char * getOpName (OpType op)
 

Member Function Documentation

◆ operator=() [1/10]

void operator= ( const Elem other)

Assignment operator – we need to copy Elem at a hundred places

◆ operator=() [2/10]

void operator= ( bool  b)

Effect during evaluation of the expression: pushes the given boolean constant to the evaluation stack.

◆ operator=() [3/10]

void operator= ( intpar_t  i)

Effect during evaluation of the expression: pushes the given number (which is converted to double) to the evaluation stack.

◆ operator=() [4/10]

void operator= ( double  d)

Effect during evaluation of the expression: pushes the given number to the evaluation stack.

◆ setUnit()

void setUnit ( const char *  s)

Sets the unit of an Elem previously set to a double or integer value. The type must already be DBL or INT, or an error gets thrown.

◆ operator=() [5/10]

void operator= ( const char *  s)

Effect during evaluation of the expression: pushes the given string to the evaluation stack.

◆ operator=() [6/10]

void operator= ( cXMLElement x)

Effect during evaluation of the expression: pushes the given cXMLElement pointer to the evaluation stack.

◆ operator=() [7/10]

void operator= ( cNedMathFunction f)

Effect during evaluation of the expression: Call a function taking 0..4 doubles and returning a double.

◆ set()

void set ( cNedFunction f,
int  argc 
)

Effect during evaluation of the expression: call a function that function takes an array of cNedValues and returns a cNedValue.

◆ operator=() [8/10]

void operator= ( Functor f)

Function object, with an interface not unlike cNedFunction. This object will be deleted by expression's destructor.

◆ operator=() [9/10]

void operator= ( OpType  op)

Unary, binary or tertiary (?:) operations.

◆ operator=() [10/10]

void operator= ( cExpression expr)

Constant subexpression.

◆ getType()

Type getType ( ) const
inline

Returns the element type

◆ isNumericConstant()

bool isNumericConstant ( ) const
inline

Returns true if the element is a numeric constant (type INT or DBL).

◆ negate()

void negate ( )

Negates the element. It must be a numeric constant (type INT or DBL).

◆ getBoolConstant()

bool getBoolConstant ( ) const
inline

Returns the value if the element is a boolean constant (type BOOL).

◆ getIntConstant()

intpar_t getIntConstant ( ) const
inline

Returns the value if the element is an integer constant (type INT).

◆ getDoubleConstant()

double getDoubleConstant ( ) const
inline

Returns the value if the element is a double constant (type DBL).

◆ getUnit()

const char* getUnit ( ) const
inline

Returns the unit if the element is a numeric constant (type INT or DBL).

◆ getStringConstant()

const char* getStringConstant ( ) const
inline

Returns the value if the element is a string constant (type STR).

◆ getXMLElement()

cXMLElement* getXMLElement ( ) const
inline

Returns the value if the element is an XML element (type XML).

◆ getMathFunction()

cNedMathFunction* getMathFunction ( ) const
inline

Returns the function pointer if the element is a math function (type MATHFUNC).

◆ getNedFunction()

cNedFunction* getNedFunction ( ) const
inline

Returns the function pointer if the element is a NED function (type NEDFUNC).

◆ getNedFunctionNumArgs()

int getNedFunctionNumArgs ( ) const
inline

Returns the argument count if the element is a NED function (type NEDFUNC).

◆ getFunctor()

Functor* getFunctor ( ) const
inline

Returns the functor pointer if the element is a functor (type FUNCTOR).

◆ getOperation()

OpType getOperation ( ) const
inline

Returns the operation if the element is an operation (type OP).

◆ getConstSubexpression()

cExpression* getConstSubexpression ( ) const
inline

Returns the subexpression if the element is a NED function (type CONSTSUBEXPR).

◆ compare()

int compare ( const Elem other) const

◆ getOpName()

static const char* getOpName ( OpType  op)
static

Returns the string representation of the given operator.

◆ str()

std::string str ( ) const

Returns the string representation of this element.


The documentation for this class was generated from the following file: