#include <UAPUtilities.hpp>

Public Member Functions | |
| UAPUtilities (UAPNode *_UAPRootNode) | |
| Creates a new collection of utilities for use with the specified UAPNode. | |
| ~UAPUtilities () | |
| Destructor. | |
| void | setUAPRootNode (UAPNode *_UAPRootNode) |
| Sets the root UAP node to use for this class. | |
| UAPNode * | getUAPRootNode () |
| Returns the root UAP node used by this class. | |
| int | evaluate () |
| Evaluates arithmetic expressions. | |
| int | evaluate (UAPNode *node, UAPNode *context=0) |
| Evaluates arithmetic expressions starting from the specified node. | |
| double | evaluate (const std::string attrib, UAPNode *context=NULL) throw (UAPParserException) |
| Returns the evaluted value of the specified attribute. | |
| int | getParameterValue (UAPNode *node, std::string ¶m_name, std::string ¶m_value) |
| Returns the value for the specified parameter or controller element. | |
| void | addConstant (const std::string &name, double value, bool allow_overwrite=false) |
| Appends the specified constant to the list of constants. | |
| int | removeConstant (const std::string &name) |
| Removes the constant with the specified name from the list of constants. | |
| std::list< std::string > | parseIdentifiers (const std::string &expr) throw (UAPParserException) |
| Parses the specified expression and returns a list of identifiers in the expression. | |
| double | nextGaussian () |
| Returns the next pseudorandom, Gaussian distributed, number with mean 0.0 and variance 1.0. | |
| double | nextDouble () |
| Returns the next pseudorandom number between 0.0 and 1.0. | |
Definition at line 51 of file UAPUtilities.hpp.
| UAPUtilities::UAPUtilities | ( | UAPNode * | _UAPRootNode | ) |
Creates a new collection of utilities for use with the specified UAPNode.
| _UAPRootNode | the root node of the UAP model |
Definition at line 42 of file UAPUtilities.cpp.
| UAPUtilities::~UAPUtilities | ( | ) |
| void UAPUtilities::addConstant | ( | const std::string & | name, | |
| double | value, | |||
| bool | allow_overwrite = false | |||
| ) |
Appends the specified constant to the list of constants.
If the argument allow_overwrite is true any existing value for the constant will be overwritten with specified value.
| name | The name of the constant | |
| value | The value of the constant | |
| allow_overwrite | true to overwrite the value of the constant if it exists; false otherwise (default: false). |
Definition at line 209 of file UAPUtilities.cpp.
| double UAPUtilities::evaluate | ( | const std::string | attrib, | |
| UAPNode * | context = NULL | |||
| ) | throw (UAPParserException) |
Returns the evaluted value of the specified attribute.
| attrb | The attribute to evaluate | |
| context | The UAPNode object to use to resolve element attribute names (default: NULL) |
| UAPParserException | if evaluation failed |
The result of this evaluation.
The chain of exceptions for missing parameters.
Definition at line 153 of file UAPUtilities.cpp.
Evaluates arithmetic expressions starting from the specified node.
This method reduces all arithmetic expressions to a constant.
| node | The node to evaluate | |
| context | The UAPNode object to use to resolve element attribute names (default: NULL) |
-1. Definition at line 98 of file UAPUtilities.cpp.
| int UAPUtilities::evaluate | ( | ) |
Evaluates arithmetic expressions.
This method reduces all arithmetic expressions to a constant starting from the root node.
Definition at line 93 of file UAPUtilities.cpp.
| int UAPUtilities::getParameterValue | ( | UAPNode * | node, | |
| std::string & | param_name, | |||
| std::string & | param_value | |||
| ) |
Returns the value for the specified parameter or controller element.
This method stores the value of the specified parameter in the variable specified by the argument param_value.
| node | The root node for the search for a parameter with name = param_name. | |
| param_name | The parameter name. | |
| param_value | The variable to store the value. |
Definition at line 73 of file UAPUtilities.cpp.
| UAPNode * UAPUtilities::getUAPRootNode | ( | ) |
Returns the root UAP node used by this class.
Definition at line 68 of file UAPUtilities.cpp.
| double UAPUtilities::nextDouble | ( | ) |
Returns the next pseudorandom number between 0.0 and 1.0.
Definition at line 248 of file UAPUtilities.cpp.
| double UAPUtilities::nextGaussian | ( | ) |
Returns the next pseudorandom, Gaussian distributed, number with mean 0.0 and variance 1.0.
Definition at line 243 of file UAPUtilities.cpp.
| list< string > UAPUtilities::parseIdentifiers | ( | const std::string & | expr | ) | throw (UAPParserException) |
Parses the specified expression and returns a list of identifiers in the expression.
| expr | the expression to parse |
| UAPParserException | if the expression is malformed or invalid |
Definition at line 228 of file UAPUtilities.cpp.
| int UAPUtilities::removeConstant | ( | const std::string & | name | ) |
Removes the constant with the specified name from the list of constants.
| name | the name of the constant |
-1 if constant was removed; 0 if the constant does not exist. Definition at line 219 of file UAPUtilities.cpp.
| void UAPUtilities::setUAPRootNode | ( | UAPNode * | _UAPRootNode | ) |
Sets the root UAP node to use for this class.
| _UAPRootNode | the node |
Definition at line 63 of file UAPUtilities.cpp.
1.5.7