Abstract base class for expression evaluators. More...
#include <cexpression.h>
Public Member Functions | |
Constructors, destructor, assignment. | |
| cExpression () | |
| cExpression (const cExpression &other) | |
| virtual | ~cExpression () |
| cExpression & | operator= (const cExpression &other) |
Redefined cObject functions | |
| virtual cExpression * | dup () 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 cXMLElement * | xmlValue (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 |
Abstract base class for expression evaluators.
| 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.
1.6.3