Hopsan
ParameterEvaluator Class Reference

Public Member Functions

 ParameterEvaluator (const HString &rName, const HString &rValue, const HString &rDescription, const HString &rQuantity, const HString &rUnit, const HString &rType, void *pDataPtr=0, ParameterEvaluatorHandler *pParameterEvalHandler=0)
 Constructor. More...
 
bool setParameterValue (const HString &rValue, ParameterEvaluator **ppNeedEvaluation=0, bool force=false)
 Set the parameter value for an existing parameter. More...
 
bool setParameter (const HString &rValue, const HString &rDescription, const HString &rQuantity, const HString &rUnit, const HString &rType, ParameterEvaluator **pNeedEvaluation=0, bool force=false)
 
bool evaluate (HString &rResult)
 Evaluate the parameter. More...
 
bool evaluate ()
 Evaluate the parameter. More...
 
bool refreshParameterValueText ()
 
void * getDataPtr ()
 Returns a pointer directly to the parameter data variable. More...
 
const HStringgetType () const
 Returns the type of the parameter. More...
 
const HStringgetName () const
 
const HStringgetValue () const
 
const HStringgetUnit () const
 
const HStringgetDescription () const
 
const HStringgetQuantity () const
 
const std::vector< HString > & getConditions () const
 
void setTriggersReconfiguration ()
 
bool triggersReconfiguration ()
 

Protected Member Functions

void resolveSignPrefix (HString &rSignPrefix) const
 
void splitSignPrefix (const HString &rString, HString &rPrefix, HString &rValue)
 

Protected Attributes

HString mParameterName
 
HString mParameterValue
 
HString mDescription
 
HString mUnit
 
HString mQuantity
 
HString mType
 
void * mpData
 
size_t mDepthCounter
 
ParameterEvaluatorHandlermpParameterEvaluatorHandler
 
std::vector< HStringmConditions
 
bool mTriggersReconfiguration
 

Friends

class ParameterEvaluatorHandler
 

Constructor & Destructor Documentation

◆ ParameterEvaluator()

ParameterEvaluator ( const HString rName,
const HString rValue,
const HString rDescription,
const HString rQuantity,
const HString rUnit,
const HString rType,
void *  pDataPtr = 0,
ParameterEvaluatorHandler pParameterEvalHandler = 0 
)

Constructor.

Parameters
[in]rNameThe desired parameter name, e.g. m
[in]rValueThe value of the parameter, always a string
[in]rDescriptionThe description of the parameter e.g. Mass
[in]rQuantityThe physical quantity of the parameter e.g. Mass
[in]rUnitThe physical unit of the parameter e.g. kg
[in]rTypeThe type of the parameter e.g. double
[in]pDataPtrOnly used by Components, system parameters don't use this, default: 0
[in]pParentParametersA pointer to the Parameters object that contains the Parameter

Member Function Documentation

◆ evaluate() [1/2]

bool evaluate ( )

Evaluate the parameter.

Returns
true if success, otherwise false

This function is used by Parameters. The point with run this function is to write the right value to the mData pointer.

See also
evaluate(HString &result)

◆ evaluate() [2/2]

bool evaluate ( HString rResult)

Evaluate the parameter.

Parameters
[out]rResultThe result of the evaluation
Returns
true if success, otherwise false

This function is used by Parameters

See also
evaluate()

◆ getDataPtr()

void * getDataPtr ( )

Returns a pointer directly to the parameter data variable.

Warning
Don't use this function unless YOU REALLY KNOW WHAT YOU ARE DOING

◆ getType()

const HString & getType ( ) const

Returns the type of the parameter.

Returns
The type of the parameter

◆ setParameterValue()

bool setParameterValue ( const HString rValue,
ParameterEvaluator **  ppNeedEvaluation = 0,
bool  force = false 
)

Set the parameter value for an existing parameter.

Parameters
[in]rValueThe new value for the parameter
[out]ppNeedEvaluationTell if the parameter needs evaluation, e.g. is a system parameter or an expression
Returns
true if success, otherwise false

This function is used by Parameters