COPASI API  4.40.278
CEvaluationNodeCall Class Reference

#include <CEvaluationNodeCall.h>

Inheritance diagram for CEvaluationNodeCall:
[legend]

Public Member Functions

virtual bool addChild (CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL) override
 
virtual void calculate () override
 
bool calls (std::set< std::string > &list) const
 
 CEvaluationNodeCall (const CEvaluationNodeCall &src)
 
 CEvaluationNodeCall (const SubType &subType, const Data &data)
 
virtual CIssue compile () override
 
virtual std::string getBerkeleyMadonnaString (const std::vector< std::string > &children) const override
 
CFunctiongetCalledTree ()
 
const CFunctiongetCalledTree () const
 
virtual std::string getCCodeString (const std::vector< std::string > &children) const override
 
virtual const DatagetData () const override
 
virtual std::string getDisplayString (const std::vector< std::string > &children) const override
 
virtual std::string getInfix (const std::vector< std::string > &children) const override
 
const std::vector< CEvaluationNode * > getListOfChildNodes () const
 
virtual std::string getMMLString (const std::vector< std::string > &children, bool expand, const std::vector< std::vector< std::string > > &variables) const override
 
virtual CValidatedUnit getUnit (const CMathContainer &container, const std::vector< CValidatedUnit > &units) const override
 
virtual std::string getXPPString (const std::vector< std::string > &children) const override
 
virtual bool isBoolean () const override
 
const bool & isBooleanRequired () const
 
virtual bool removeChild (CCopasiNode< Data > *pChild) override
 
virtual bool setData (const Data &data) override
 
virtual CValidatedUnit setUnit (const CMathContainer &container, const std::map< CEvaluationNode *, CValidatedUnit > &currentUnits, std::map< CEvaluationNode *, CValidatedUnit > &targetUnits) const override
 
virtual CIssue setValueType (const ValueType &valueType) override
 
virtual ASTNode * toAST (const CDataModel *pDataModel) const override
 
virtual ~CEvaluationNodeCall ()
 
- Public Member Functions inherited from CEvaluationNode
void addChildren (const std::vector< CEvaluationNode * > &children)
 
std::string buildBerkeleyMadonnaString () const
 
std::string buildCCodeString () const
 
std::string buildDisplayString () const
 
std::string buildInfix () const
 
std::string buildMMLString (bool expand, const std::vector< std::vector< std::string > > &variables) const
 
std::string buildXPPString () const
 
 CEvaluationNode ()
 
 CEvaluationNode (const CEvaluationNode &src)
 
CEvaluationNodecopyBranch () const
 
CEvaluationNodecopyNode (CEvaluationNode *child1, CEvaluationNode *child2) const
 
CEvaluationNodecopyNode (const std::vector< CEvaluationNode * > &children) const
 
const CEvaluationNodefindTopMinus (const std::vector< CFunctionAnalyzer::CValue > &callParameters) const
 
const CEvaluationTreegetTree () const
 
const C_FLOAT64getValuePointer () const
 
const ValueTypegetValueType () const
 
const MainTypemainType () const
 
bool operator!= (const CEvaluationNode &right) const
 
bool operator< (const CEvaluationNode &rhs)
 
bool operator< (const CEvaluationNode &right) const
 
bool operator== (const CEvaluationNode &right) const
 
void printRecursively () const
 
void printRecursively (std::ostream &os, int indent=0) const
 
void setTree (const CEvaluationTree *pTree)
 
virtual CEvaluationNodesimplifyNode (const std::vector< CEvaluationNode * > &children) const
 
CEvaluationNodesplitBranch (const CEvaluationNode *splitnode, bool left) const
 
const SubTypesubType () const
 
virtual ~CEvaluationNode ()
 
- Public Member Functions inherited from CCopasiNode< std::string >
virtual bool addChild (CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
 
bool addSibling (CCopasiNode< Data > *pSibling, CCopasiNode< Data > *pAfter=NULL)
 
 CCopasiNode (CCopasiNode< Data > *pParent=NULL)
 
 CCopasiNode (const CCopasiNode< Data > &src)
 
 CCopasiNode (const Data &data, CCopasiNode< Data > *pParent=NULL)
 
bool deleteChildren ()
 
CCopasiNode< Data > * getChild ()
 
const CCopasiNode< Data > * getChild () const
 
CCopasiNode< Data > * getChild (const size_t &index)
 
const CCopasiNode< Data > * getChild (const size_t &index) const
 
virtual DatagetData ()
 
CCopasiNode< Data > * getNext ()
 
const CCopasiNode< Data > * getNext () const
 
CCopasiNode< Data > * getNextNonChild ()
 
const CCopasiNode< Data > * getNextNonChild () const
 
size_t getNumChildren () const
 
CCopasiNode< Data > * getParent ()
 
const CCopasiNode< Data > * getParent () const
 
CCopasiNode< Data > * getSibling ()
 
const CCopasiNode< Data > * getSibling () const
 
virtual bool removeChild (CCopasiNode< Data > *pChild)
 
virtual bool setData (const Data &data)
 
virtual ~CCopasiNode ()
 

Static Public Member Functions

static CEvaluationNodefromAST (const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
 
- Static Public Member Functions inherited from CEvaluationNode
static CEvaluationNodecreate (const MainType &mainType, const SubType &subType, const std::string &data)
 
static bool isKeyword (const std::string &str)
 

Private Member Functions

 CEvaluationNodeCall ()
 

Static Private Member Functions

static CCallParameters< C_FLOAT64 > * buildParameters (const std::vector< CEvaluationNode * > &vector)
 
static void clearParameters (CCallParameters< C_FLOAT64 > *pCallParameters, const std::vector< CEvaluationNode * > &vector)
 
static bool verifyParameters (const std::vector< CEvaluationNode * > &vector, const CFunctionParameters &functionParameters)
 

Private Attributes

std::vector< CEvaluationNode * > mCallNodes
 
SubType mCompiledSubType
 
CCallParameters< C_FLOAT64 > * mpCallParameters
 
CExpressionmpExpression
 
CFunctionmpFunction
 
bool mQuotesRequired
 
CRegisteredCommonName mRegisteredFunctionCN
 

Additional Inherited Members

- Public Types inherited from CEvaluationNode
enum class  MainType {
  INVALID , NUMBER , CONSTANT , OPERATOR ,
  OBJECT , FUNCTION , CALL , STRUCTURE ,
  CHOICE , VARIABLE , WHITESPACE , LOGICAL ,
  MV_FUNCTION , VECTOR , DELAY , UNIT ,
  __SIZE
}
 
enum class  SubType {
  DEFAULT , DELAY , IF , VECTOR ,
  CN , DOUBLE , FUNCTION , LOG ,
  OPEN , PI , POWER , EXPRESSION ,
  POINTER , EXPONENTIALE , INTEGER , LOG10 ,
  MULTIPLY , OR , VECTOROPEN , COMMA ,
  DIVIDE , ENOTATION , EXP , True ,
  XOR , RATIONALE , AND , CLOSE ,
  False , MODULUS , SIN , VECTORCLOSE ,
  COS , EQ , Infinity , PLUS ,
  NaN , MINUS , NE , TAN ,
  REMAINDER , GT , SEC , CSC ,
  GE , COT , LT , LE ,
  SINH , COSH , TANH , SECH ,
  CSCH , COTH , ARCSIN , ARCCOS ,
  ARCTAN , ARCSEC , ARCCSC , ARCCOT ,
  ARCSINH , ARCCOSH , ARCTANH , ARCSECH ,
  ARCCSCH , ARCCOTH , SQRT , ABS ,
  FLOOR , CEIL , FACTORIAL , NOT ,
  RUNIFORM , RNORMAL , MAX , MIN ,
  RGAMMA , RPOISSON , SIGN , AVOGADRO ,
  INVALID , __SIZE
}
 
enum class  ValueType { Unknown , Boolean , Number , __SIZE }
 
- Public Types inherited from CCopasiNode< std::string >
typedef std::string Data
 
- Static Public Attributes inherited from CEvaluationNode
static const CEnumAnnotation< std::string, MainTypeMainTypeName
 
static const CEnumAnnotation< std::string, SubTypeSubTypeName
 
- Protected Member Functions inherited from CEvaluationNode
 CEvaluationNode (const MainType &type, const SubType &subType, const Data &data)
 
- Protected Member Functions inherited from CCopasiNode< std::string >
bool setChild (CCopasiNode< Data > *pChild)
 
bool setParent (CCopasiNode< Data > *pParent)
 
bool setSibling (CCopasiNode< Data > *pSibling)
 
- Protected Attributes inherited from CEvaluationNode
MainType mMainType
 
class CEvaluationNode::CPrecedence mPrecedence
 
const CEvaluationTreempTree
 
const C_FLOAT64mpValue
 
SubType mSubType
 
C_FLOAT64 mValue
 
ValueType mValueType
 
- Protected Attributes inherited from CCopasiNode< std::string >
Data mData
 

Detailed Description

This is the class for nodes presenting operators used in an evaluation trees.

Constructor & Destructor Documentation

◆ CEvaluationNodeCall() [1/3]

CEvaluationNodeCall::CEvaluationNodeCall ( )
private

Default constructor

References CEvaluationNode::mPrecedence, and PRECEDENCE_NUMBER.

Referenced by fromAST().

◆ CEvaluationNodeCall() [2/3]

CEvaluationNodeCall::CEvaluationNodeCall ( const SubType subType,
const Data data 
)

Default constructor

Parameters
constSubType & subType
constData & data

References CEvaluationNode::EXPRESSION, fatalError, CEvaluationNode::FUNCTION, CEvaluationNode::mPrecedence, PRECEDENCE_FUNCTION, setData(), and CEvaluationNode::subType().

◆ CEvaluationNodeCall() [3/3]

CEvaluationNodeCall::CEvaluationNodeCall ( const CEvaluationNodeCall src)

Copy constructor

Parameters
constCEvaluationNodeCall & src

References buildParameters(), mCallNodes, and mpCallParameters.

◆ ~CEvaluationNodeCall()

CEvaluationNodeCall::~CEvaluationNodeCall ( )
virtual

Destructor

References clearParameters(), mCallNodes, and mpCallParameters.

Member Function Documentation

◆ addChild()

bool CEvaluationNodeCall::addChild ( CCopasiNode< Data > *  pChild,
CCopasiNode< Data > *  pAfter = NULL 
)
overridevirtual

Add a child to a node. If pAfter == this the child will be inserted at the front of the list of children.

Parameters
CCopasiNode<Data > * pChild
CCopasiNode<Data > * pAfter (default: NULL appended to the list of children)
Returns
bool Success

References CCopasiNode< _Data >::addChild(), and mCallNodes.

Referenced by SBMLImporter::createCReactionFromReaction(), and CSBMLExporter::createKineticExpression().

◆ buildParameters()

CCallParameters< C_FLOAT64 > * CEvaluationNodeCall::buildParameters ( const std::vector< CEvaluationNode * > &  vector)
staticprivate

Build the list of call parameters which correspond to the list of call nodes.

References CCallParameters< Type >::begin(), CEvaluationNodeVector::getNodes(), and CEvaluationNode::VECTOR.

Referenced by CEvaluationNodeCall(), and compile().

◆ calculate()

void CEvaluationNodeCall::calculate ( void  )
overridevirtual

Calculate the numerical result of the node. It is assumed that all child nodes are up to date.

Reimplemented from CEvaluationNode.

References CExpression::calcValue(), CFunction::calcValue(), CEvaluationNode::EXPRESSION, CEvaluationNode::FUNCTION, mCompiledSubType, mpCallParameters, mpExpression, mpFunction, and CEvaluationNode::mValue.

◆ calls()

bool CEvaluationNodeCall::calls ( std::set< std::string > &  list) const

Check whether node the calls any tree in the list

Parameters
std::set<std::string > & list
Returns
bool calls

References CEvaluationTree::calls(), CFunctionDB::findFunction(), CRootContainer::getFunctionList(), and CCopasiNode< std::string >::mData.

Referenced by CEvaluationTree::calls().

◆ clearParameters()

void CEvaluationNodeCall::clearParameters ( CCallParameters< C_FLOAT64 > *  pCallParameters,
const std::vector< CEvaluationNode * > &  vector 
)
staticprivate

Clear the list of call parameters.

References CEvaluationNodeVector::getNodes(), and CEvaluationNode::VECTOR.

Referenced by compile(), and ~CEvaluationNodeCall().

◆ compile()

◆ fromAST()

CEvaluationNode * CEvaluationNodeCall::fromAST ( const ASTNode *  pASTNode,
const std::vector< CEvaluationNode * > &  children 
)
static

Creates a new CEvaluationNodeCall from an ASTNode and the given children

Parameters
constASTNode* pNode
conststd::vector< CEvaluationNode * > & children
Returns
CEvaluationNode * pCretedNode

References CEvaluationNode::addChildren(), CEvaluationNodeCall(), CEvaluationNode::FUNCTION, and CEvaluationNode::subType().

Referenced by CEvaluationTree::fromAST().

◆ getBerkeleyMadonnaString()

std::string CEvaluationNodeCall::getBerkeleyMadonnaString ( const std::vector< std::string > &  children) const
overridevirtual

Retrieve the display string of the node and its eventual child nodes in Berkeley Madonna format.

Returns
const Data & value

Reimplemented from CEvaluationNode.

References CCopasiNode< std::string >::mData, mQuotesRequired, and quote().

◆ getCalledTree() [1/2]

CFunction * CEvaluationNodeCall::getCalledTree ( )

◆ getCalledTree() [2/2]

◆ getCCodeString()

std::string CEvaluationNodeCall::getCCodeString ( const std::vector< std::string > &  children) const
overridevirtual

Retrieve the display string of the node and its eventual child nodes in C.

Returns
const Data & value

Reimplemented from CEvaluationNode.

References CEvaluationNode::EXPRESSION, CEvaluationNode::FUNCTION, getData(), CCopasiNode< std::string >::mData, mQuotesRequired, CEvaluationNode::mSubType, and quote().

◆ getData()

const CEvaluationNode::Data & CEvaluationNodeCall::getData ( ) const
overridevirtual

Retrieve the value of the node.

Returns
const Data & value

Reimplemented from CCopasiNode< std::string >.

References CDataObject::getObjectName(), CEvaluationNode::isKeyword(), CCopasiNode< std::string >::mData, mpExpression, mpFunction, mQuotesRequired, quote(), and unQuote().

Referenced by getCCodeString(), getInfix(), and toAST().

◆ getDisplayString()

std::string CEvaluationNodeCall::getDisplayString ( const std::vector< std::string > &  children) const
overridevirtual

Retrieve the display string of the node and its eventual child nodes.

Returns
const Data & value

Reimplemented from CEvaluationNode.

References CEvaluationNode::EXPRESSION, CEvaluationNode::FUNCTION, CCopasiNode< std::string >::mData, CEvaluationNode::mSubType, and quote().

◆ getInfix()

std::string CEvaluationNodeCall::getInfix ( const std::vector< std::string > &  children) const
overridevirtual

Retrieve the infix value of the node and its eventual child nodes.

Returns
const Data & value

Reimplemented from CEvaluationNode.

References CEvaluationNode::DEFAULT, CEvaluationNode::EXPRESSION, CEvaluationNode::FUNCTION, getData(), CEvaluationNode::mSubType, and quote().

◆ getListOfChildNodes()

const std::vector<CEvaluationNode *> CEvaluationNodeCall::getListOfChildNodes ( ) const
inline

returns the vector of child nodes, corresponding to the arguments of a function call

References mCallNodes.

Referenced by CDerive::deriveBranch(), and CFunctionAnalyzer::evaluateNode().

◆ getMMLString()

std::string CEvaluationNodeCall::getMMLString ( const std::vector< std::string > &  children,
bool  expand,
const std::vector< std::vector< std::string > > &  variables 
) const
overridevirtual

Build the MathML string

Parameters
conststd::vector< std::string > & children
boolexpand = true
conststd::vector< std::vector< std::string > > & variables
Returns
std::string MMLString

Reimplemented from CEvaluationNode.

References CEvaluationNode::EXPRESSION, CMathMl::fixName(), CEvaluationNode::FUNCTION, CCopasiNode< std::string >::mData, mpFunction, CEvaluationNode::mSubType, quote(), and CFunction::writeMathML().

◆ getUnit()

CValidatedUnit CEvaluationNodeCall::getUnit ( const CMathContainer container,
const std::vector< CValidatedUnit > &  units 
) const
overridevirtual

Figure out the appropriate CUnit to use, based on the child nodes. This sets the default, appropriate for many cases, as Dimensionless

Parameters
constCMathContainer & container
conststd::vector< CValidatedUnit > & units
Returns
CValidatedUnit unit

Reimplemented from CEvaluationNode.

References CEvaluationNode::EXPRESSION, CEvaluationNode::FUNCTION, CUnitValidator::getUnit(), mpExpression, mpFunction, CEvaluationNode::mSubType, CBaseUnit::undefined, and CUnitValidator::validateUnits().

◆ getXPPString()

std::string CEvaluationNodeCall::getXPPString ( const std::vector< std::string > &  children) const
overridevirtual

Retrieve the display string of the node and its eventual child nodes in XPPAUT format.

Returns
const Data & value

Reimplemented from CEvaluationNode.

References CCopasiNode< std::string >::mData, mQuotesRequired, and quote().

◆ isBoolean()

bool CEvaluationNodeCall::isBoolean ( ) const
overridevirtual

Check whether the result is Boolean

Returns
bool isBoolean

Reimplemented from CEvaluationNode.

References getCalledTree(), and CEvaluationTree::isBoolean().

◆ isBooleanRequired()

const bool& CEvaluationNodeCall::isBooleanRequired ( ) const

Check whether the result must be Boolean

Returns
const bool & isBooleanRequired

◆ removeChild()

bool CEvaluationNodeCall::removeChild ( CCopasiNode< Data > *  pChild)
overridevirtual

Remove a child from a node.

Parameters
CCopasiNode<Data > * pChild
Returns
bool Success

References mCallNodes, and CCopasiNode< _Data >::removeChild().

◆ setData()

bool CEvaluationNodeCall::setData ( const Data data)
overridevirtual

Set the data of the Node.

Parameters
constData & data
Returns
bool success

References CEvaluationNode::isKeyword(), CCopasiNode< std::string >::mData, mQuotesRequired, mRegisteredFunctionCN, quote(), and unQuote().

Referenced by CEvaluationNodeCall().

◆ setUnit()

CValidatedUnit CEvaluationNodeCall::setUnit ( const CMathContainer container,
const std::map< CEvaluationNode *, CValidatedUnit > &  currentUnits,
std::map< CEvaluationNode *, CValidatedUnit > &  targetUnits 
) const
overridevirtual

Set the unit for the node and return the resulting unit. The child node units are added to the map

Parameters
constCMathContainer & container
conststd::map < CEvaluationNode * , CValidatedUnit > & currentUnits
std::map< CEvaluationNode * , CValidatedUnit > & targetUnits
Returns
CUnit unit

Reimplemented from CEvaluationNode.

References CEvaluationNode::EXPRESSION, CEvaluationNode::FUNCTION, CUnitValidator::getUnit(), CUnitValidator::getVariableUnits(), mCallNodes, CValidatedUnit::merge(), mpExpression, mpFunction, CEvaluationNode::mSubType, CEvaluationNode::setUnit(), CBaseUnit::undefined, and CUnitValidator::validateUnits().

◆ setValueType()

CIssue CEvaluationNodeCall::setValueType ( const ValueType valueType)
overridevirtual

Set the type the result of the node

Parameters
constValueType & valueType
Returns
CIssue issue;

Reimplemented from CEvaluationNode.

References CEvaluationNode::mValueType, CEvaluationNode::setValueType(), and CEvaluationNode::Unknown.

Referenced by compile().

◆ toAST()

ASTNode * CEvaluationNodeCall::toAST ( const CDataModel pDataModel) const
overridevirtual

Create a new ASTNode corresponding to this choice node.

Returns
ASTNode* return a pointer to the newly created node;

Reimplemented from CEvaluationNode.

References CCopasiNode< _Data >::addChild(), fatalError, CFunctionDB::findFunction(), CCopasiNode< std::string >::getChild(), getData(), CRootContainer::getFunctionList(), CFunction::getSBMLId(), CCopasiNode< _Data >::getSibling(), and CEvaluationNode::toAST().

◆ verifyParameters()

bool CEvaluationNodeCall::verifyParameters ( const std::vector< CEvaluationNode * > &  vector,
const CFunctionParameters functionParameters 
)
staticprivate

Verifies that the parameters match the function parameters.

Parameters
conststd::vector<CEvaluationNode *> & vector
constCFunctionParameters & functionParameters
Returns
bool verified

References CFunctionParameters::size(), CEvaluationNode::VECTOR, and CFunctionParameter::VFLOAT64.

Referenced by compile().

Member Data Documentation

◆ mCallNodes

std::vector<CEvaluationNode *> CEvaluationNodeCall::mCallNodes
private

◆ mCompiledSubType

SubType CEvaluationNodeCall::mCompiledSubType
private

Referenced by calculate(), and compile().

◆ mpCallParameters

CCallParameters< C_FLOAT64 >* CEvaluationNodeCall::mpCallParameters
private

◆ mpExpression

CExpression* CEvaluationNodeCall::mpExpression
private

◆ mpFunction

CFunction* CEvaluationNodeCall::mpFunction
private

◆ mQuotesRequired

bool CEvaluationNodeCall::mQuotesRequired
mutableprivate

◆ mRegisteredFunctionCN

CRegisteredCommonName CEvaluationNodeCall::mRegisteredFunctionCN
private

The registered object name to track eventual renaming.

Referenced by compile(), and setData().


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