|
Schnek
|
#include <variables.hpp>
Public Types | |
| enum | VariableTypeInfo { int_type, float_type, string_type } |
| Enum specifying which type the variable returns. | |
| typedef ExpressionVariant | ExpressionType |
Public Member Functions | |
| Variable (int value, bool initialised_=true, bool readonly_=false) | |
| construct with an integer | |
| Variable (double value, bool initialised_=true, bool readonly_=false) | |
| construct with a float | |
| Variable (std::string value, bool initialised_=true, bool readonly_=false) | |
| construct with a string | |
| Variable (pIntExpression expr, bool initialised_=true, bool readonly_=false) | |
| construct with an integer expression | |
| Variable (pFloatExpression expr, bool initialised_=true, bool readonly_=false) | |
| construct with an float expression | |
| Variable (pStringExpression expr, bool initialised_=true, bool readonly_=false) | |
| construct with an string expression | |
| Variable (const Variable &var) | |
| Variable & | operator= (const Variable &var) |
| assignment operator | |
| VariableTypeInfo | getType () |
| returns the type of the variable | |
| ValueVariant | getValue () |
| returns the fixed value of the variable | |
| const ExpressionVariant & | getExpression () |
| returns the expression kept in the variable | |
| const ValueVariant & | evaluateExpression () |
| evaluetes the expression kept in the variable and returns the value | |
| bool | isConstant () |
| returns true if the value of the variable is constant and does not depend on non-constant variables | |
| bool | isReadOnly () |
| returns true if the value of the variable is a read only variable | |
| bool | isInitialised () |
| returns true if the value of the variable has been initialised | |
| long | getId () |
| const ValueVariant & | evaluate () |
| returns the value of the variable | |
This stores a variable to be used in the simulation.
A variable can be either a fixed value or an expression. The two types ValueVariant and ExpressionType are boost::variants that can contain the variables or expressions of different return types.
| Variable::Variable | ( | const Variable & | var | ) |
copy constructor plain variables are copied by value, but expressions are shallow-copied