COPASI API  4.40.278
CUnitValidator Class Reference

#include <CUnitValidator.h>

Public Member Functions

 CUnitValidator (const CMathContainer &math, const CEvaluationTree &tree)
 
 CUnitValidator (const CUnitValidator &src)
 
const CValidatedUnitgetObjectUnit (const CObjectInterface *pObject) const
 
const std::map< CObjectInterface *, CValidatedUnit > & getObjectUnits () const
 
const CValidatedUnitgetUnit () const
 
const std::vector< CValidatedUnit > & getVariableUnits () const
 
bool validateUnits (const CUnit &unit=CUnit(CBaseUnit::undefined), const std::vector< CUnit > &variableUnits=std::vector< CUnit >())
 
bool validateUnits (const CValidatedUnit &unit, const std::vector< CValidatedUnit > &variableUnits)
 
 ~CUnitValidator ()
 

Private Member Functions

 CUnitValidator ()
 
void getUnits ()
 
bool setUnits ()
 
bool validate ()
 

Private Attributes

CMathContainermMathContainer
 
std::map< CEvaluationNode *, CValidatedUnitmNodeUnits
 
std::map< CObjectInterface *, CValidatedUnitmObjectUnits
 
std::vector< CValidatedUnitmProvidedVariableUnits
 
CValidatedUnit mTargetUnit
 
const CEvaluationTreemTree
 
std::vector< CValidatedUnitmVariableUnits
 

Constructor & Destructor Documentation

◆ CUnitValidator() [1/3]

CUnitValidator::CUnitValidator ( )
private

Default constructor

◆ CUnitValidator() [2/3]

CUnitValidator::CUnitValidator ( const CMathContainer math,
const CEvaluationTree tree 
)

Function constructor

Parameters
constCMathContainer & math
constCEvaluationTree & tree
conststd::vector< CUnit > & variableUnits (default: std::vector< CUnit >)

References CEvaluationTree::Expression, CEvaluationTree::Function, CEvaluationTree::getType(), CEvaluationTree::MassAction, CEvaluationTree::MathExpression, mTree, mVariableUnits, CEvaluationTree::PreDefined, and CEvaluationTree::UserDefined.

◆ CUnitValidator() [3/3]

CUnitValidator::CUnitValidator ( const CUnitValidator src)

Copy constructor

Parameters
constCUnitValidator & src

◆ ~CUnitValidator()

CUnitValidator::~CUnitValidator ( )

Destructor

Member Function Documentation

◆ getObjectUnit()

const CValidatedUnit & CUnitValidator::getObjectUnit ( const CObjectInterface pObject) const

Retrieve the validated unit of the object units

Parameters
constCObjectInterface * pObject
Returns
const CValidatedUnit & objectUnit

References CMathContainer::getMathObject(), mMathContainer, and mObjectUnits.

◆ getObjectUnits()

const std::map< CObjectInterface *, CValidatedUnit > & CUnitValidator::getObjectUnits ( ) const

Retrieve the validated object units

Returns
const std::map< CObjectInterface *, CValidatedUnit > & objectUnits

References mObjectUnits.

Referenced by CModelParameterGroup::getObjectUnit().

◆ getUnit()

const CValidatedUnit & CUnitValidator::getUnit ( ) const

Retrieve the validated unit

Returns
const CValidatedUnit & unit

References CEvaluationTree::getRoot(), mNodeUnits, and mTree.

Referenced by CEvaluationNodeCall::getUnit(), and CEvaluationNodeCall::setUnit().

◆ getUnits()

◆ getVariableUnits()

const std::vector< CValidatedUnit > & CUnitValidator::getVariableUnits ( ) const

Retrieve the validated variable units

Returns
const std::vector< CValidatedUnit > &variableUnits

References mVariableUnits.

Referenced by CEvaluationNodeCall::setUnit().

◆ setUnits()

◆ validate()

◆ validateUnits() [1/2]

bool CUnitValidator::validateUnits ( const CUnit unit = CUnit(CBaseUnit::undefined),
const std::vector< CUnit > &  variableUnits = std::vector< CUnit >() 
)

Validate the units in the tree and check whether the result matches the optional argument

Parameters
constCUnit & unit (default: CBaseUnit::undefined)
conststd::vector< CUnit > & variableUnits (default: std::vector< CUnit >)
Returns
bool valid

References mProvidedVariableUnits, mTargetUnit, and validate().

Referenced by CModelParameterGroup::getObjectUnit(), CEvaluationNodeCall::getUnit(), and CEvaluationNodeCall::setUnit().

◆ validateUnits() [2/2]

bool CUnitValidator::validateUnits ( const CValidatedUnit unit,
const std::vector< CValidatedUnit > &  variableUnits 
)

Validate the units in the tree and check whether the result matches the optional argument

Parameters
constCUnit & unit (default: CBaseUnit::undefined)
Returns
bool valid

References mProvidedVariableUnits, mTargetUnit, and validate().

Member Data Documentation

◆ mMathContainer

CMathContainer& CUnitValidator::mMathContainer
private

Referenced by getObjectUnit(), getUnits(), and setUnits().

◆ mNodeUnits

std::map< CEvaluationNode *, CValidatedUnit > CUnitValidator::mNodeUnits
private

Referenced by getUnit(), getUnits(), setUnits(), and validate().

◆ mObjectUnits

std::map< CObjectInterface *, CValidatedUnit > CUnitValidator::mObjectUnits
private

◆ mProvidedVariableUnits

std::vector< CValidatedUnit > CUnitValidator::mProvidedVariableUnits
private

Referenced by validate(), and validateUnits().

◆ mTargetUnit

CValidatedUnit CUnitValidator::mTargetUnit
private

Referenced by setUnits(), and validateUnits().

◆ mTree

const CEvaluationTree& CUnitValidator::mTree
private

◆ mVariableUnits

std::vector< CValidatedUnit > CUnitValidator::mVariableUnits
private

The documentation for this class was generated from the following files: