Hopsan
|
Public Member Functions | |
ParameterEvaluatorHandler (Component *pComponent) | |
Constructor. | |
~ParameterEvaluatorHandler () | |
Destructor. | |
bool | addParameter (const HString &rName, const HString &rValue, const HString &rDescription, const HString &rQuantity, const HString &rUnit, const HString &rType, void *pData=0, bool internal=false, bool force=false, std::vector< HString > conditions=std::vector< HString >()) |
Add a new parameter. | |
void | deleteParameter (const HString &rName) |
Deletes a parameter. | |
bool | renameParameter (const HString &rOldName, const HString &rNewName) |
Rename a parameter (only useful for system parameters) | |
const std::vector< ParameterEvaluator * > * | getParametersVectorPtr () const |
const ParameterEvaluator * | getParameter (const HString &rName) const |
void | getParameterNames (std::vector< HString > &rParameterNames) |
bool | setParameter (const HString &rName, const HString &rValue, const HString &rDescription="", const HString &rQuantity="", const HString &rUnit="", const HString &rType="", const bool internal=false, const bool force=false) |
void | getParameterValue (const HString &rName, HString &rValue) |
Get the value of specified parameter. | |
bool | setParameterValue (const HString &rName, const HString &rValue, bool force=false) |
Set the parameter value for an existing parameter. | |
void * | getParameterDataPtr (const HString &rName) |
Returns a pointer directly to the parameter data variable. | |
bool | refreshParameterValueText (const HString &rParameterName) |
bool | evaluateParameters () |
Evaluate all parameters. | |
bool | evaluateInComponent (const HString &rName, HString &rEvaluatedParameterValue, const HString &rType) |
Evaluate a specific parameter. | |
bool | evaluateRecursivelyInSystemParents (const HString &rName, HString &rEvaluatedParameterValue, const HString &rType) |
bool | evaluateParameterExpression (const HString &rExpression, HString &rEvaluatedParameterValue) |
bool | hasParameter (const HString &rName) const |
Check if a parameter with given name exist among the parameters. | |
bool | checkParameters (HString &rErrParName) |
Check all parameters that need evaluation are able to be evaluated. | |
void | setParameterTriggersReconfiguration (const HString &rParameterName) |
bool | parameterTriggersReconfiguration (const HString &rParameterName) |
Component * | getComponent () const |
Protected Attributes | |
Component * | mComponent |
std::vector< ParameterEvaluator * > | mParameters |
std::vector< ParameterEvaluator * > | mParametersNeedEvaluation |
ParameterEvaluatorHandler | ( | Component * | pComponent | ) |
Constructor.
[in] | pParentComponent | A pointer to the Component that contains the Parameters |
bool addParameter | ( | const HString & | rName, |
const HString & | rValue, | ||
const HString & | rDescription, | ||
const HString & | rQuantity, | ||
const HString & | rUnit, | ||
const HString & | rType, | ||
void * | pData = 0, | ||
bool | internal = false, | ||
bool | force = false, | ||
std::vector< HString > | conditions = std::vector<HString>() ) |
Add a new parameter.
[in] | rName | The desired parameter name, e.g. m |
[in] | rValue | The value of the parameter, always a string |
[in] | rDescription | The description of the parameter e.g. Mass |
[in] | rQuantity | The physical quantity of the parameter e.g. mass |
[in] | rUnit | The physical unit of the parameter e.g. kg |
[in] | rType | The type of the parameter e.g. double |
[in] | pData | Only used by Components, system parameters don't use this, default: 0 |
[in] | force | Should we force to add parameter even if it fails to evaluate |
[in] | conditions | Conditions for a conditional constant parameter |
bool checkParameters | ( | HString & | rErrParName | ) |
Check all parameters that need evaluation are able to be evaluated.
[out] | rErrParName | The name of the parameter that could not be evaluated |
Check all parameters that need evaluation are able to be evaluated. The function will stop as soon as one parameter turns out to be faulty. So in the case of many bad parameters only the name of the first one is returned.
void deleteParameter | ( | const HString & | rName | ) |
Deletes a parameter.
[in] | rName | The name of the parameter to delete |
bool evaluateInComponent | ( | const HString & | rName, |
HString & | rEvaluatedParameterValue, | ||
const HString & | rType ) |
Evaluate a specific parameter.
[in] | rName | The name of the parameter to be evaluated |
[out] | rEvaluatedParameterValue | The result of the evaluation |
[in] | rType | The type of how the parameter should be interpreted |
bool evaluateParameterExpression | ( | const HString & | rExpression, |
HString & | rEvaluatedParameterValue ) |
bool evaluateParameters | ( | ) |
Evaluate all parameters.
void * getParameterDataPtr | ( | const HString & | rName | ) |
Returns a pointer directly to the parameter data variable.
Get the value of specified parameter.
[in] | rName | The parameter name to get value of |
[out] | rValue | Reference to the string variable that will contain the parameter value. The variable will be "" if parameter not found |
bool hasParameter | ( | const HString & | rName | ) | const |
Check if a parameter with given name exist among the parameters.
[in] | rName | The name of the parameter to check for |
Rename a parameter (only useful for system parameters)
Set the parameter value for an existing parameter.
[in] | rName | The name of the parameter to be set |
[in] | rValue | The new value for the parameter |
[in] | force | Should we force the value to be set |