cExpression Class Reference
[Simulation core classes]

Abstract base class for expression evaluators. More...

#include <cexpression.h>

Inheritance diagram for cExpression:
cObject cDynamicExpression

List of all members.

Public Member Functions

Constructors, destructor, assignment.

 cExpression ()
 cExpression (const cExpression &other)
virtual ~cExpression ()
cExpressionoperator= (const cExpression &other)
Redefined cObject functions

virtual cExpressiondup () const
virtual std::string info () const
virtual void parsimPack (cCommBuffer *buffer)
virtual void parsimUnpack (cCommBuffer *buffer)
Getter functions. Note that overloaded conversion operators also exist.

virtual cNEDValue evaluate (cComponent *context=NULL) const
virtual bool boolValue (cComponent *context=NULL)=0
virtual long longValue (cComponent *context=NULL, const char *expectedUnit=NULL)=0
virtual double doubleValue (cComponent *context=NULL, const char *expectedUnit=NULL)=0
virtual std::string stringValue (cComponent *context=NULL)=0
virtual cXMLElementxmlValue (cComponent *context=NULL)=0
Miscellaneous utility functions.

virtual std::string str () const =0
virtual void parse (const char *text)=0
virtual int compare (const cExpression *other) const =0
virtual bool containsConstSubexpressions () const =0
virtual void evaluateConstSubexpressions (cComponent *context)=0

Detailed Description

Abstract base class for expression evaluators.

See also:
cPar

Member Function Documentation

virtual int cExpression::compare ( const cExpression other  )  const [pure virtual]

Compares two expressions.

Makes it possible to use cExpression as (part of) a key in std::map or std::set.

Implemented in cDynamicExpression.

virtual double cExpression::doubleValue ( cComponent context = NULL,
const char *  expectedUnit = NULL 
) [pure virtual]

Evaluate the expression and convert the result to double if possible; throw an error if conversion from that type is not supported.

Also throws an error if the actual unit does not match the expected unit.

Implemented in cDynamicExpression.

virtual void cExpression::evaluateConstSubexpressions ( cComponent context  )  [pure virtual]

Evaluates const subexpressions, and replaces them with their values.

See cDynamicExpression::Elem::CONSTSUBEXPR.

Implemented in cDynamicExpression.

virtual std::string cExpression::info (  )  const [inline, virtual]

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

See cObject for more details.

Reimplemented from cObject.

Reimplemented in cDynamicExpression.

virtual long cExpression::longValue ( cComponent context = NULL,
const char *  expectedUnit = NULL 
) [pure virtual]

Evaluate the expression and convert the result to long if possible; throw an error if conversion from that type is not supported.

Also throws an error if the actual unit does not match the expected unit.

Implemented in cDynamicExpression.

virtual void cExpression::parse ( const char *  text  )  [pure virtual]

Interprets the string as an expression, and store it.

If the text cannot be parsed, an exception is thrown, which can be caught as std::runtime_error& if necessary. An exception is also thrown if the particular cExpression subclass does not support parsing.

Implemented in cDynamicExpression.


The documentation for this class was generated from the following file:
Generated on Tue Dec 2 11:16:28 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3