COPASI API  4.16.103
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
CEvaluationTree Class Reference

#include <CEvaluationTree.h>

Inheritance diagram for CEvaluationTree:
Inheritance graph
[legend]
Collaboration diagram for CEvaluationTree:
Collaboration graph
[legend]

Public Types

enum  Type {
  Function = 0, MassAction, PreDefined, UserDefined,
  Expression, MathExpression
}
 
- Public Types inherited from CCopasiContainer
typedef std::multimap
< std::string, CCopasiObject * > 
objectMap
 
- Public Types inherited from CCopasiObject
typedef std::set< const
CCopasiObject * > 
DataObjectSet
 
typedef std::vector< Refresh * > DataUpdateSequence
 
- Public Types inherited from CObjectInterface
typedef std::set< const
CObjectInterface * > 
ObjectSet
 
typedef std::vector
< CObjectInterface * > 
UpdateSequence
 

Public Member Functions

bool calls (std::set< std::string > &list) const
 
 CEvaluationTree (const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
 
 CEvaluationTree (const CEvaluationTree &src, const CCopasiContainer *pParent=NULL)
 
virtual bool compile ()
 
bool dependsOnTree (const std::string &name) const
 
CCopasiObject::DataObjectSet getDeletedObjects () const
 
std::string::size_type getErrorPosition () const
 
const std::string & getInfix () const
 
const std::vector
< CEvaluationNode * > & 
getNodeList () const
 
CEvaluationNodegetRoot ()
 
const CEvaluationNodegetRoot () const
 
const CEvaluationTree::TypegetType () const
 
virtual size_t getVariableIndex (const std::string &name) const
 
virtual const C_FLOAT64getVariableValue (const size_t &index) const
 
bool hasCircularDependency () const
 
bool hasDiscontinuity () const
 
bool isBoolean () const
 
bool isUsable () const
 
bool operator== (const CEvaluationTree &rhs) const
 
virtual bool setInfix (const std::string &infix)
 
virtual bool setRoot (CEvaluationNode *pRootNode)
 
bool setTree (const ASTNode &pRootNode)
 
virtual ASTNode * toAST (const CCopasiDataModel *pDataModel) const
 
bool updateTree ()
 
virtual ~CEvaluationTree ()
 
- Public Member Functions inherited from CCopasiContainer
virtual bool add (CCopasiObject *pObject, const bool &adopt=true)
 
 CCopasiContainer (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=CCopasiObject::Container)
 
 CCopasiContainer (const CCopasiContainer &src, const CCopasiContainer *pParent=NULL)
 
virtual std::string getChildObjectUnits (const CCopasiObject *pObject) const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
virtual const objectMapgetObjects () const
 
virtual std::string getUnits () const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual bool remove (CCopasiObject *pObject)
 
virtual ~CCopasiContainer ()
 
- Public Member Functions inherited from CCopasiObject
void addDirectDependency (const CCopasiObject *pObject)
 
 CCopasiObject (const CCopasiObject &src, const CCopasiContainer *pParent=NULL)
 
void clearDirectDependencies ()
 
void clearRefresh ()
 
bool dependsOn (DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
 
void getAllDependencies (DataObjectSet &dependencies, const DataObjectSet &context) const
 
virtual CCopasiObjectName getCN () const
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
virtual const std::string & getKey () const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () const
 
virtual voidgetValuePointer () const
 
bool hasCircularDependencies (DataObjectSet &candidates, DataObjectSet &verified, const DataObjectSet &context) const
 
bool hasUpdateMethod () const
 
bool isArray () const
 
bool isContainer () const
 
bool isDataModel () const
 
bool isMatrix () const
 
bool isNameVector () const
 
bool isNonUniqueName () const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
 
bool isReference () const
 
bool isRoot () const
 
bool isSeparator () const
 
bool isStaticString () const
 
bool isValueBool () const
 
bool isValueDbl () const
 
bool isValueInt () const
 
bool isValueInt64 () const
 
bool isValueString () const
 
bool isVector () const
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) const
 
virtual void print (std::ostream *ostream) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
void setObjectValue (const C_FLOAT64 &value)
 
void setObjectValue (const C_INT32 &value)
 
void setObjectValue (const bool &value)
 
template<class CType >
void setRefresh (CType *pType, void(CType::*method)(void))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_FLOAT64 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_INT32 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const bool &))
 
virtual ~CCopasiObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
virtual ~CObjectInterface ()
 

Static Public Member Functions

static CEvaluationTreecopy (const CEvaluationTree &src)
 
static CEvaluationTreecreate (CEvaluationTree::Type type)
 
static CEvaluationNodefromAST (const ASTNode *pASTNode)
 
- Static Public Member Functions inherited from CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 

Static Public Attributes

static const std::string TypeName []
 
static const char * XMLType []
 
- Static Public Attributes inherited from CCopasiContainer
static const std::vector
< CCopasiContainer * > 
EmptyList
 

Protected Member Functions

void buildCalculationSequence ()
 
void calculate ()
 
bool compileNodes ()
 
bool parse ()
 
void setType (const CEvaluationTree::Type &type)
 
- Protected Member Functions inherited from CCopasiContainer
template<class CType >
CCopasiObjectaddMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
void initObjects ()
 
- Protected Member Functions inherited from CCopasiObject
 CCopasiObject ()
 
 CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0)
 

Protected Attributes

std::vector< CEvaluationNode * > mCalculationSequence
 
std::string mInfix
 
std::vector< CEvaluationNode * > * mpNodeList
 
CEvaluationNodempRoot
 
CEvaluationTree::Type mType
 
bool mUsable
 
C_FLOAT64 mValue
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 

Private Member Functions

void initObjects ()
 

Private Attributes

std::string::size_type mErrorPosition
 

Additional Inherited Members

- Protected Types inherited from CCopasiObject
enum  Flag {
  Container = 0x1, Vector = 0x2, Matrix = 0x4, NameVector = 0x8,
  Reference = 0x10, ValueBool = 0x20, ValueInt = 0x40, ValueInt64 = 0x80,
  ValueDbl = 0x100, NonUniqueName = 0x200, StaticString = 0x400, ValueString = 0x800,
  Separator = 0x1000, ModelEntity = 0x2000, Array = 0x4000, DataModel = 0x8000,
  Root = 0x10000, Gui = 0x20000
}
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 28 of file CEvaluationTree.h.

Member Enumeration Documentation

The valid types of a function

Enumerator
Function 
MassAction 
PreDefined 
UserDefined 
Expression 
MathExpression 

Definition at line 35 of file CEvaluationTree.h.

Constructor & Destructor Documentation

CEvaluationTree::CEvaluationTree ( const std::string &  name = "NoName",
const CCopasiContainer pParent = NULL,
const Type type = Function 
)

Default constructor

Parameters
conststd::string & name (default: "NoName")
constCCopasiContainer * pParent (default: NULL)
constCEvaluationTree::Type & type (default: Function)

Definition at line 129 of file CEvaluationTree.cpp.

References initObjects(), and setInfix().

131  :
132  CCopasiContainer(name, pParent, "Function"),
133  mType(type),
134  mInfix(),
135  mUsable(false),
136  mErrorPosition(std::string::npos),
137  mpNodeList(NULL),
138  mpRoot(NULL),
139  mValue(std::numeric_limits<C_FLOAT64>::quiet_NaN()),
141 {
142  initObjects();
143  setInfix("");
144 }
std::vector< CEvaluationNode * > * mpNodeList
std::string mInfix
std::vector< CEvaluationNode * > mCalculationSequence
std::string::size_type mErrorPosition
virtual bool setInfix(const std::string &infix)
CEvaluationNode * mpRoot
CEvaluationTree::Type mType
CEvaluationTree::CEvaluationTree ( const CEvaluationTree src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
constCEvaluationTree & src
constCCopasiContainer * pParent (default: NULL)

Definition at line 146 of file CEvaluationTree.cpp.

References initObjects(), mInfix, and setInfix().

147  :
148  CCopasiContainer(src, pParent),
149  mType(src.mType),
150  mInfix(),
151  mUsable(false),
152  mErrorPosition(std::string::npos),
153  mpNodeList(NULL),
154  mpRoot(NULL),
155  mValue(src.mValue),
157 {
158  initObjects();
159  setInfix(src.mInfix);
160 }
std::vector< CEvaluationNode * > * mpNodeList
std::string mInfix
std::vector< CEvaluationNode * > mCalculationSequence
std::string::size_type mErrorPosition
virtual bool setInfix(const std::string &infix)
CEvaluationNode * mpRoot
CEvaluationTree::Type mType
CEvaluationTree::~CEvaluationTree ( )
virtual

Destructor

Definition at line 162 of file CEvaluationTree.cpp.

References CEvaluationParserBase::freeNodeList(), and mpNodeList.

163 {
165 }
std::vector< CEvaluationNode * > * mpNodeList
static void freeNodeList(std::vector< CEvaluationNode * > *pNodeList)

Member Function Documentation

void CEvaluationTree::buildCalculationSequence ( )
protected

Build the sequence of calculations required to determine the value of the expression.

Definition at line 277 of file CEvaluationTree.cpp.

References CEvaluationNode::CONSTANT, CNodeContextIterator< Node, int >::end(), CEvaluationNode::getType(), mCalculationSequence, mpRoot, CNodeContextIterator< Node, int >::next(), CEvaluationNode::NUMBER, CEvaluationNode::OBJECT, and CEvaluationNode::type().

Referenced by CMathExpression::compile(), and compileNodes().

278 {
280 
281  while (itNode.next() != itNode.end())
282  {
283  switch (CEvaluationNode::type(itNode->getType()))
284  {
288  break;
289 
290  default:
291  mCalculationSequence.push_back(*itNode);
292  break;
293  }
294  }
295 }
std::vector< CEvaluationNode * > mCalculationSequence
static Type type(const Type &type)
CEvaluationNode * mpRoot
void CEvaluationTree::calculate ( void  )
protected

Calculate the value

Definition at line 394 of file CEvaluationTree.cpp.

References CEvaluationNode::getValue(), mCalculationSequence, mpRoot, and mValue.

Referenced by CExpression::calcValue(), CFunction::calcValue(), and CMathExpression::value().

395 {
396  try
397  {
398  if (mpRoot != NULL)
399  {
400  std::vector< CEvaluationNode * >::iterator it = mCalculationSequence.begin();
401  std::vector< CEvaluationNode * >::iterator end = mCalculationSequence.end();
402 
403  for (; it != end; ++it)
404  {
405  (*it)->calculate();
406  }
407 
408  mValue = mpRoot->getValue();
409  }
410  else
411  {
412  mValue = std::numeric_limits< C_FLOAT64 >::quiet_NaN();
413  }
414  }
415 
416  catch (...)
417  {
418  mValue = std::numeric_limits<C_FLOAT64>::quiet_NaN();
419  }
420 }
const C_FLOAT64 & getValue() const
std::vector< CEvaluationNode * > mCalculationSequence
CEvaluationNode * mpRoot
bool CEvaluationTree::calls ( std::set< std::string > &  list) const

Check whether the evaluation tree calls any tree in the list

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

Definition at line 663 of file CEvaluationTree.cpp.

References CEvaluationNode::CALL, CCopasiObject::getObjectName(), and mpNodeList.

Referenced by CEvaluationNodeCall::calls(), and hasCircularDependency().

664 {
665  if (!mpNodeList) return false;
666 
667  std::pair<std::set< std::string >::iterator, bool> Result = list.insert(getObjectName());
668 
669  if (!Result.second) return true;
670 
671  bool Calls = false;
672  std::vector< CEvaluationNode * >::iterator it;
673  std::vector< CEvaluationNode * >::iterator end = mpNodeList->end();
674 
675  for (it = mpNodeList->begin(); it != end; ++it)
676  if (((*it)->getType() & 0xFF000000) == CEvaluationNode::CALL &&
677  dynamic_cast<CEvaluationNodeCall *>(*it)->calls(list))
678  {
679  Calls = true;
680  break;
681  }
682 
683  list.erase(Result.first);
684 
685  return Calls;
686 }
std::vector< CEvaluationNode * > * mpNodeList
const std::string & getObjectName() const
bool CEvaluationTree::compile ( )
virtual
bool CEvaluationTree::compileNodes ( )
protected

Compile the individual nodes.

Returns
bool success

Definition at line 297 of file CEvaluationTree.cpp.

References CCopasiObject::addDirectDependency(), buildCalculationSequence(), CEvaluationNode::CALL, CCopasiObject::clearDirectDependencies(), CEvaluationNode::compile(), CNodeContextIterator< Node, int >::end(), CCopasiMessage::ERROR, Expression, CMathObject::getDataObject(), CCopasiObject::getObjectName(), mCalculationSequence, MCFunction, mErrorPosition, mInfix, mpNodeList, mpRoot, mType, mUsable, CNodeContextIterator< Node, int >::next(), and CEvaluationNode::OBJECT.

Referenced by CExpression::compile(), compile(), and CFunction::setInfix().

298 {
300  mCalculationSequence.clear();
301 
302  if (mInfix == "")
303  return mUsable = true;
304 
305  if (mpNodeList == NULL)
306  return mUsable = false;
307 
308  // The compile order must be child first.
310  CEvaluationNode *pErrorNode = NULL;
311  mUsable = true;
312 
313  while (itNode.next() != itNode.end())
314  {
315  if (*itNode != NULL)
316  {
317  if (!itNode->compile(this))
318  {
319  if (mUsable)
320  {
321  mUsable = false;
322  pErrorNode = *itNode;
323  }
324  }
325  }
326  }
327 
328  std::vector< CEvaluationNode * >::iterator it;
329  std::vector< CEvaluationNode * >::iterator end = mpNodeList->end();
330 
331  if (!mUsable)
332  {
333  // Find the error node in the node list
334  for (it = mpNodeList->begin(); it != end; ++it)
335  {
336  if (*it == pErrorNode)
337  {
338  end = it + 1;
339  break;
340  }
341  }
342 
343  mErrorPosition = 0;
344 
345  for (it = mpNodeList->begin(); it != end; ++it)
346  mErrorPosition += (*it)->getData().length();
347 
348  mErrorPosition -= (*--it)->getData().length();
350  }
351  else
352  {
353  const CObjectInterface * pObject;
354 
355  for (it = mpNodeList->begin(); it != end; ++it)
356  switch ((*it)->getType() & 0xFF000000)
357  {
359  {
360  if (mType == Expression &&
361  (pObject = static_cast< CEvaluationNodeObject *>(*it)->getObjectInterfacePtr()) != NULL)
362  {
363  const CCopasiObject * pDataObject = dynamic_cast< const CCopasiObject * >(pObject);
364 
365  if (pDataObject == NULL)
366  {
367  const CMathObject * pMathObject = dynamic_cast< const CMathObject * >(pObject);
368 
369  if (pMathObject != NULL)
370  {
371  pDataObject = pMathObject->getDataObject();
372  }
373  }
374 
375  addDirectDependency(pDataObject);
376  }
377  }
378  break;
379 
381  addDirectDependency(static_cast< CEvaluationNodeCall *>(*it)->getCalledTree());
382  break;
383 
384  default:
385  break;
386  }
387 
389  }
390 
391  return mUsable;
392 }
void clearDirectDependencies()
#define MCFunction
std::vector< CEvaluationNode * > * mpNodeList
const std::string & getObjectName() const
std::string mInfix
std::vector< CEvaluationNode * > mCalculationSequence
void buildCalculationSequence()
void addDirectDependency(const CCopasiObject *pObject)
std::string::size_type mErrorPosition
CEvaluationNode * mpRoot
const CCopasiObject * getDataObject() const
CEvaluationTree::Type mType
CEvaluationTree * CEvaluationTree::copy ( const CEvaluationTree src)
static

Copy an EvaluationTree of the specified type. Note: the returned object has to be released after use with delete.

Parameters
constEvaluationTree & src
Returns
EvaluationTree * pEvaluationTree

Definition at line 98 of file CEvaluationTree.cpp.

References Expression, fatalError, Function, getType(), MassAction, PreDefined, and UserDefined.

Referenced by FunctionWidget1::loadFromFunction().

99 {
100  CEvaluationTree * pNew = NULL;
101 
102  switch (src.getType())
103  {
104  case Function:
105  pNew = new CFunction(*static_cast<const CFunction *>(&src));
106  break;
107 
108  case MassAction:
109  pNew = new CMassAction(*static_cast<const CMassAction *>(&src));
110  break;
111 
112  case PreDefined:
113  case UserDefined:
114  pNew = new CKinFunction(*static_cast<const CKinFunction *>(&src));
115  break;
116 
117  case Expression:
118  pNew = new CExpression(*static_cast<const CExpression *>(&src));
119  break;
120 
121  default:
122  fatalError();
123  break;
124  }
125 
126  return pNew;
127 }
#define fatalError()
const CEvaluationTree::Type & getType() const
The class for handling a chemical kinetic function.
Definition: CFunction.h:29
CEvaluationTree * CEvaluationTree::create ( CEvaluationTree::Type  type)
static

Create an EvaluationTree of the specified type. Note: the returned object has to be released after use with delete.

Parameters
CEvaluationTree::Typetype
Returns
EvaluationTree * pEvaluationTree

Definition at line 62 of file CEvaluationTree.cpp.

References Expression, fatalError, Function, MassAction, PreDefined, setType(), and UserDefined.

Referenced by SBMLImporter::createExpressionFromFunction(), SBMLImporter::importEvent(), and CCopasiXMLParser::FunctionElement::start().

63 {
64  CEvaluationTree * pNew = NULL;
65 
66  switch (type)
67  {
68  case Function:
69  pNew = new CFunction();
70  break;
71 
72  case MassAction:
73  pNew = new CMassAction();
74  break;
75 
76  case PreDefined:
77  pNew = new CKinFunction();
78  pNew->setType(PreDefined);
79  break;
80 
81  case UserDefined:
82  pNew = new CKinFunction();
83  break;
84 
85  case Expression:
86  pNew = new CExpression();
87  break;
88 
89  default:
90  fatalError();
91  break;
92  }
93 
94  return pNew;
95 }
void setType(const CEvaluationTree::Type &type)
#define fatalError()
The class for handling a chemical kinetic function.
Definition: CFunction.h:29
bool CEvaluationTree::dependsOnTree ( const std::string &  name) const

Checks whether the tree has a call node referring to the expression with the given name

Parameters
conststd::string & name
Returns
bool dependsOn

Definition at line 648 of file CEvaluationTree.cpp.

References CEvaluationNode::CALL, and mpNodeList.

649 {
650  if (!mpNodeList) return false;
651 
652  std::vector< CEvaluationNode * >::const_iterator it = mpNodeList->begin();
653  std::vector< CEvaluationNode * >::const_iterator end = mpNodeList->end();
654 
655  for (; it != end; ++it)
656  if (((*it)->getType() & 0xFF000000) == CEvaluationNode::CALL &&
657  (*it)->getData() == name)
658  return true;
659 
660  return false;
661 }
std::vector< CEvaluationNode * > * mpNodeList
CEvaluationNode * CEvaluationTree::fromAST ( const ASTNode *  pASTNode)
static

Converts an SBML ASTNode to the corresponding CEvaluationNode tree.

Parameters
constASTNode * pASTNode
Returns
CEvaluationNode*

Definition at line 472 of file CEvaluationTree.cpp.

References CNodeContextIterator< Node, Context >::context(), CNodeContextIterator< Node, Context >::end(), CCopasiMessage::EXCEPTION, CEvaluationNodeNumber::fromAST(), CEvaluationNodeDelay::fromAST(), CEvaluationNodeConstant::fromAST(), CEvaluationNodeChoice::fromAST(), CEvaluationNodeObject::fromAST(), CEvaluationNodeCall::fromAST(), CEvaluationNodeOperator::fromAST(), CEvaluationNodeLogical::fromAST(), CEvaluationNodeFunction::fromAST(), MCMathML, CNodeContextIterator< Node, Context >::next(), and CNodeContextIterator< Node, Context >::parentContextPtr().

Referenced by create_normalform(), create_simplified_normalform(), SBMLImporter::createCReactionFromReaction(), and setTree().

473 {
474  if (pASTNode == NULL) return NULL;
475 
477  CEvaluationNode* pResultNode = NULL;
478 
479  while (itNode.next() != itNode.end())
480  {
481  if (*itNode != NULL)
482  {
484 
485  switch (itNode->getType())
486  {
487  case AST_LAMBDA:
488  // this nodetype will never be handled directly
489  break;
490 
491  case AST_PLUS:
492  case AST_MINUS:
493  case AST_TIMES:
494  case AST_DIVIDE:
495  case AST_POWER:
496  case AST_FUNCTION_POWER:
497  // create a CEvaluationNodeOperator
498  pResultNode = CEvaluationNodeOperator::fromAST(*itNode, itNode.context());
499  break;
500 
501  case AST_INTEGER:
502  case AST_REAL:
503  case AST_REAL_E:
504  case AST_RATIONAL:
505  // create a CEvaluationNodeNumber
506  pResultNode = CEvaluationNodeNumber::fromAST(*itNode, itNode.context());
507  break;
508 
509  case AST_NAME:
510  case AST_NAME_TIME:
511 #if LIBSBML_VERSION >= 40100
512  case AST_NAME_AVOGADRO:
513 #endif // LIBSBML_VERSION >= 40100
514  // create a CEvaluationNodeObject
515  pResultNode = CEvaluationNodeObject::fromAST(*itNode, itNode.context());
516  break;
517 
518  case AST_CONSTANT_E:
519  case AST_CONSTANT_PI:
520  case AST_CONSTANT_FALSE:
521  case AST_CONSTANT_TRUE:
522  // create a CEvaluationNodeConstant
523  pResultNode = CEvaluationNodeConstant::fromAST(*itNode, itNode.context());
524  break;
525 
526  case AST_FUNCTION:
527  // create a function call node
528  pResultNode = CEvaluationNodeCall::fromAST(*itNode, itNode.context());
529  break;
530 
531  case AST_FUNCTION_DELAY:
532  // create a function call node
533  pResultNode = CEvaluationNodeDelay::fromAST(*itNode, itNode.context());
534  break;
535 
536  case AST_FUNCTION_ABS:
537  case AST_FUNCTION_ARCCOS:
538  case AST_FUNCTION_ARCCOSH:
539  case AST_FUNCTION_ARCCOT:
540  case AST_FUNCTION_ARCCOTH:
541  case AST_FUNCTION_ARCCSC:
542  case AST_FUNCTION_ARCCSCH:
543  case AST_FUNCTION_ARCSEC:
544  case AST_FUNCTION_ARCSECH:
545  case AST_FUNCTION_ARCSIN:
546  case AST_FUNCTION_ARCSINH:
547  case AST_FUNCTION_ARCTAN:
548  case AST_FUNCTION_ARCTANH:
549  case AST_FUNCTION_CEILING:
550  case AST_FUNCTION_COS:
551  case AST_FUNCTION_COSH:
552  case AST_FUNCTION_COT:
553  case AST_FUNCTION_COTH:
554  case AST_FUNCTION_CSC:
555  case AST_FUNCTION_CSCH:
556  case AST_FUNCTION_EXP:
557  case AST_FUNCTION_FACTORIAL:
558  case AST_FUNCTION_FLOOR:
559  case AST_FUNCTION_LN:
560  case AST_FUNCTION_LOG:
561  case AST_FUNCTION_ROOT:
562  case AST_FUNCTION_SEC:
563  case AST_FUNCTION_SECH:
564  case AST_FUNCTION_SIN:
565  case AST_FUNCTION_SINH:
566  case AST_FUNCTION_TAN:
567  case AST_FUNCTION_TANH:
568  case AST_LOGICAL_NOT:
569  pResultNode = CEvaluationNodeFunction::fromAST(*itNode, itNode.context());
570  break;
571 
572  case AST_LOGICAL_AND:
573  case AST_LOGICAL_OR:
574  case AST_LOGICAL_XOR:
575  case AST_RELATIONAL_EQ:
576  case AST_RELATIONAL_GEQ:
577  case AST_RELATIONAL_GT:
578  case AST_RELATIONAL_LEQ:
579  case AST_RELATIONAL_LT:
580  case AST_RELATIONAL_NEQ:
581  pResultNode = CEvaluationNodeLogical::fromAST(*itNode, itNode.context());
582  break;
583 
584  case AST_FUNCTION_PIECEWISE:
585  pResultNode = CEvaluationNodeChoice::fromAST(*itNode, itNode.context());
586  break;
587 
588  case AST_UNKNOWN:
589  // create an unknown element error
591 
592  break;
593  }
594 
595  if (itNode.parentContextPtr() != NULL)
596  {
597  itNode.parentContextPtr()->push_back(pResultNode);
598  }
599  }
600  }
601 
602  return pResultNode;
603 }
static CEvaluationNode * fromAST(const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
#define MCMathML
static CEvaluationNode * fromAST(const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
static CEvaluationNode * fromAST(const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
static CEvaluationNode * fromAST(const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
static CEvaluationNode * fromAST(const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
static CEvaluationNode * fromAST(const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
static CEvaluationNode * fromAST(const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
static CEvaluationNode * fromAST(const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
struct MESSAGES Message
static CEvaluationNode * fromAST(const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
CCopasiObject::DataObjectSet CEvaluationTree::getDeletedObjects ( ) const

Retrieve the list of deleted objects.

Returns
CCopasiObject::DataObjectSet deletedObjects

Definition at line 626 of file CEvaluationTree.cpp.

References CCopasiContainer::getObject().

Referenced by FunctionWidget1::leave(), CQFunctionDM::removeRows(), and FunctionWidget1::slotBtnDelete().

627 {
629 
630  Deleted.insert(this);
631  Deleted.insert(static_cast< const CCopasiObject * >(getObject(CCopasiObjectName("Reference=Value"))));
632 
633  return Deleted;
634 }
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
std::set< const CCopasiObject * > DataObjectSet
std::string::size_type CEvaluationTree::getErrorPosition ( ) const

Retrieve the position of the error in the string description. std::string::npos indicates no error.

Returns
std::string::size_type errorPosition

Definition at line 196 of file CEvaluationTree.cpp.

References mErrorPosition.

197 {return mErrorPosition;}
std::string::size_type mErrorPosition
const std::string & CEvaluationTree::getInfix ( ) const
const std::vector< CEvaluationNode * > & CEvaluationTree::getNodeList ( ) const
CEvaluationNode * CEvaluationTree::getRoot ( )

Returns the root node of the tree.

Definition at line 610 of file CEvaluationTree.cpp.

References mpRoot.

Referenced by CMathEventN::CTrigger::allocate(), SBMLImporter::applyStoichiometricExpressions(), SBMLImporter::areEqualFunctions(), CSBMLExporter::checkForPiecewiseFunctions(), CSBMLExporter::checkForUnsupportedFunctionCalls(), CFunctionAnalyzer::checkKineticFunction(), CMathExpression::CMathExpression(), CMathEventN::CTrigger::compile(), CMathTrigger::compile(), CMathTrigger::compileFUNCTION(), CMathExpression::copy(), CMathContainer::copyBranch(), SBMLImporter::createCFunctionFromFunctionTree(), SBMLImporter::createCReactionFromReaction(), CMathContainer::createDiscontinuityEvents(), CSBMLExporter::createEvent(), SBMLImporter::createExpressionFromFunction(), CSBMLExporter::createInitialAssignment(), CSBMLExporter::createRule(), CFunctionAnalyzer::evaluateNode(), expand_function_call(), CSBMLExporter::exportEventAssignments(), CODEExporter::exportKineticFunction(), CODEExporterC::exportKineticFunctionGroup(), CODEExporter::exportModelEntityExpression(), CODEExporter::exportModelValuesExpressions(), CODEExporterC::exportSingleFunction(), CODEExporter::exportSingleFunction(), SBMLImporter::findCorrespondingFunction(), SBMLImporter::findFunctionCalls(), CODEExporter::findFunctionsCalls(), CODEExporterBM::getDisplayExpressionString(), CODEExporterXPPAUT::getDisplayExpressionString(), CODEExporterC::getDisplayExpressionString(), CODEExporterBM::getDisplayFunctionString(), CODEExporterXPPAUT::getDisplayFunctionString(), SBMLImporter::importEvent(), SBMLImporter::importInitialAssignments(), SBMLImporter::importRuleForModelEntity(), SBMLImporter::isConstantFlux(), CSBMLExporter::isEventAssignmentSBMLCompatible(), CSBMLExporter::isEventSBMLCompatible(), CSBMLExporter::isExpressionSBMLCompatible(), SBMLImporter::isMassAction(), SBMLImporter::isMassActionFunction(), CSBMLExporter::isModelSBMLCompatible(), CMathObject::isPrerequisiteForContext(), CODEExporter::modifyTreeForMassAction(), stress_test::normalizeFunctionDB(), CNormalTranslation::normAndSimplifyReptdly(), operator<<(), CSBMLExporter::orderRules(), CODEExporterC::preprocess(), SBMLImporter::removeUnusedFunctions(), CODEExporterC::setExportNameOfFunction(), CReaction::setFunctionFromExpressionTree(), test_depth_first_iterator::test_dfi(), test000082::test_import_delayAssignment_1(), test000082::test_import_delayAssignment_2(), test000082::test_import_delayAssignment_3(), test000082::test_import_delayAssignment_4(), test000082::test_import_delayAssignment_5(), test000082::test_import_delayAssignment_6(), test000082::test_import_delayAssignment_7(), test000082::test_import_delayAssignment_8(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_1(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_2(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_3(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_4(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_5(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_6(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_7(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_8(), test000095::test_import_l3_event_1(), test000095::test_import_l3_event_2(), test000095::test_import_l3_event_3(), test000095::test_import_l3_event_4(), test000095::test_import_l3_event_5(), test000078::test_l2v4_import_unordered_functions(), test000087::test_simulate_reaction_flux_reference_1(), test_biomodels217_expression::test_term_den1(), test_biomodels217_expression::test_term_den12(), test_biomodels217_expression::test_term_den123(), test_biomodels217_expression::test_term_den1234(), test_biomodels217_expression::test_term_den12345(), test_biomodels217_expression::test_term_den123456(), test_biomodels217_expression::test_term_den1234567(), test_biomodels217_expression::test_term_den2(), test_biomodels217_expression::test_term_den3(), test_biomodels217_expression::test_term_den3456(), test_biomodels217_expression::test_term_den346(), test_biomodels217_expression::test_term_den356(), test_biomodels217_expression::test_term_den36(), test_biomodels217_expression::test_term_den4(), test_biomodels217_expression::test_term_den456(), test_biomodels217_expression::test_term_den5(), test_biomodels217_expression::test_term_den56(), test_biomodels217_expression::test_term_den6(), test_biomodels217_expression::test_term_den67(), test_biomodels217_expression::test_term_den7(), test_biomodels217_expression::test_term_num1(), test_biomodels217_expression::test_term_num2(), test_biomodels217_expression::test_term_num3(), test_biomodels217_expression::test_term_num4(), test_biomodels217_expression::test_term_num5(), test_biomodels217_expression::test_term_num6(), test_biomodels217_expression::test_term_num7(), and CModelParameter::updateModel().

611 {
612  return this->mpRoot;
613 }
CEvaluationNode * mpRoot
const CEvaluationNode * CEvaluationTree::getRoot ( ) const

Returns the root node of the tree.

Definition at line 605 of file CEvaluationTree.cpp.

References mpRoot.

606 {
607  return this->mpRoot;
608 }
CEvaluationNode * mpRoot
const CEvaluationTree::Type & CEvaluationTree::getType ( ) const
size_t CEvaluationTree::getVariableIndex ( const std::string &  name) const
virtual

Retrieve the index to the value of the named variable.

Parameters
conststd::string & name
Returns
size_t

Reimplemented in CFunction.

Definition at line 207 of file CEvaluationTree.cpp.

References C_INVALID_INDEX.

Referenced by CEvaluationNodeVariable::compile().

208 {return C_INVALID_INDEX;}
#define C_INVALID_INDEX
Definition: copasi.h:222
const C_FLOAT64 & CEvaluationTree::getVariableValue ( const size_t &  index) const
virtual

Retrieve the value of the indexed variable

Parameters
constsize_t & index
Returns
const C_FLOAT64 & variableValue

Reimplemented in CFunction.

Definition at line 210 of file CEvaluationTree.cpp.

References C_FLOAT64.

Referenced by CEvaluationNodeVariable::calculate().

211 {
212  static C_FLOAT64 Value = std::numeric_limits<C_FLOAT64>::quiet_NaN();
213  return Value;
214 }
#define C_FLOAT64
Definition: copasi.h:92
bool CEvaluationTree::hasCircularDependency ( ) const

Check whether the the tree has circular dependencies.

Returns
bool hasCircularDependency

Definition at line 641 of file CEvaluationTree.cpp.

References calls().

Referenced by parse().

642 {
643  std::set< std::string > List;
644 
645  return calls(List);
646 }
bool calls(std::set< std::string > &list) const
bool CEvaluationTree::hasDiscontinuity ( ) const

Check whether tree may introduce discontinuities.

Returns
bool hasDiscontinity

Definition at line 688 of file CEvaluationTree.cpp.

References CEvaluationNode::CALL, CEvaluationNodeFunction::CEIL, CEvaluationNode::CHOICE, CEvaluationNodeCall::EXPRESSION, CEvaluationNodeFunction::FLOOR, CEvaluationNodeCall::FUNCTION, CEvaluationNode::FUNCTION, CEvaluationNodeChoice::IF, CEvaluationNodeOperator::MODULUS, mpNodeList, and CEvaluationNode::OPERATOR.

689 {
690  if (mpNodeList == NULL)
691  return false;
692 
693  std::vector< CEvaluationNode * >::iterator it = mpNodeList->begin();
694  std::vector< CEvaluationNode * >::iterator end = mpNodeList->end();
695 
696  for (; it != end; ++it)
697  {
698  switch ((int)(*it)->getType())
699  {
704  // We found a discontinuity.
705  return true;
706  break;
707 
710 
711  // If the called tree has a discontinuity so do we.
712  if (static_cast< CEvaluationNodeCall * >(*it)->getCalledTree()->hasDiscontinuity())
713  {
714  return true;
715  }
716 
717  break;
718  }
719  }
720 
721  return false;
722 }
std::vector< CEvaluationNode * > * mpNodeList
void CEvaluationTree::initObjects ( )
private

Initialize the contained CCopasiObjects

Definition at line 615 of file CEvaluationTree.cpp.

References CCopasiContainer::addObjectReference(), mValue, CCopasiObject::setDirectDependencies(), and CCopasiObject::ValueDbl.

Referenced by CEvaluationTree().

616 {
617  std::set< const CCopasiObject * > Self;
618  Self.insert(this);
619 
620  CCopasiObject * pObject =
622 
623  pObject->setDirectDependencies(Self);
624 }
void setDirectDependencies(const DataObjectSet &directDependencies)
CCopasiObject * addObjectReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
bool CEvaluationTree::isBoolean ( ) const

Check whether this function evaluates to a boolean value.

Returns
bool isBoolean

Definition at line 269 of file CEvaluationTree.cpp.

References CEvaluationNode::isBoolean(), and mpRoot.

Referenced by CEvaluationNodeCall::isBoolean(), and CExpression::setIsBoolean().

270 {
271  if (mpRoot != NULL)
272  return mpRoot->isBoolean();
273 
274  return false;
275 }
virtual bool isBoolean() const
CEvaluationNode * mpRoot
bool CEvaluationTree::isUsable ( ) const

Check whether this function is usable, i.e., properly defined

Returns
bool isUsable

Definition at line 266 of file CEvaluationTree.cpp.

References mUsable.

Referenced by CModelEntity::compile(), CMetab::compileInitialValueDependencies(), and FunctionWidget1::loadFromFunction().

267 {return mUsable;}
bool CEvaluationTree::operator== ( const CEvaluationTree rhs) const

Comparison operator

Parameters
constCEvaluationTree & rhs
Returns
bool equal

Definition at line 191 of file CEvaluationTree.cpp.

References mInfix, and mType.

192 {
193  return (mInfix == rhs.mInfix && mType == rhs.mType);
194 }
std::string mInfix
CEvaluationTree::Type mType
bool CEvaluationTree::parse ( )
protected

Parse the description

Returns
bool success

Definition at line 216 of file CEvaluationTree.cpp.

References CCopasiMessage::ERROR, CEvaluationParserBase::freeNodeList(), CEvaluationParserBase::getErrorPosition(), CEvaluationParserBase::getNodeList(), CEvaluationParserBase::getRootNode(), hasCircularDependency(), MassAction, MCFunction, mErrorPosition, mInfix, mpNodeList, mpRoot, mType, and CEvaluationParserBase::yyparse().

Referenced by setInfix().

217 {
218  bool success = true;
219 
220  // clean up
222  mpNodeList = NULL;
223  mpRoot = NULL;
224 
225  if (mType == MassAction) return true;
226 
227  if (mInfix == "")
228  {
229  mpNodeList = new std::vector< CEvaluationNode * >;
230  mpRoot = new CEvaluationNode();
231  mpNodeList->push_back(mpRoot);
232  return true;
233  }
234 
235  // parse the description into a linked node tree
236  std::istringstream buffer(mInfix);
237  CEvaluationLexer Parser(&buffer);
238 
239  success = (Parser.yyparse() == 0);
240 
241  mpNodeList = Parser.getNodeList();
242  mpRoot = Parser.getRootNode();
243 
244  // clean up if parsing failed
245  if (!success)
246  {
247  mErrorPosition = Parser.getErrorPosition();
248 
250  mpNodeList = NULL;
251  mpRoot = NULL;
252  }
253 
254  if (success && hasCircularDependency())
255  {
256  success = false;
258  }
259 
260  return success;
261 }
#define MCFunction
std::vector< CEvaluationNode * > * mpNodeList
std::string mInfix
std::string::size_type mErrorPosition
static void freeNodeList(std::vector< CEvaluationNode * > *pNodeList)
bool hasCircularDependency() const
CEvaluationNode * mpRoot
CEvaluationTree::Type mType
bool CEvaluationTree::setInfix ( const std::string &  infix)
virtual

Set the infix description of the tree and compile it.

Parameters
conststd::string & infix
Returns
bool success

Reimplemented in CMassAction, CExpression, and CFunction.

Definition at line 175 of file CEvaluationTree.cpp.

References mInfix, mUsable, and parse().

Referenced by CEvaluationTree(), CSBMLExporter::createEvent(), CSBMLExporter::createRule(), CSBMLExporter::exportEventAssignments(), CNormalTranslation::normAndSimplifyReptdly(), CQFunctionDM::setData(), CExpression::setInfix(), CFunction::setInfix(), test_depth_first_iterator::test_dfi(), test_biomodels217_expression::test_term_den1(), test_biomodels217_expression::test_term_den12(), test_biomodels217_expression::test_term_den123(), test_biomodels217_expression::test_term_den1234(), test_biomodels217_expression::test_term_den12345(), test_biomodels217_expression::test_term_den123456(), test_biomodels217_expression::test_term_den1234567(), test_biomodels217_expression::test_term_den2(), test_biomodels217_expression::test_term_den3(), test_biomodels217_expression::test_term_den3456(), test_biomodels217_expression::test_term_den346(), test_biomodels217_expression::test_term_den356(), test_biomodels217_expression::test_term_den36(), test_biomodels217_expression::test_term_den4(), test_biomodels217_expression::test_term_den456(), test_biomodels217_expression::test_term_den5(), test_biomodels217_expression::test_term_den56(), test_biomodels217_expression::test_term_den6(), test_biomodels217_expression::test_term_den67(), test_biomodels217_expression::test_term_den7(), test_biomodels217_expression::test_term_num1(), test_biomodels217_expression::test_term_num2(), test_biomodels217_expression::test_term_num3(), test_biomodels217_expression::test_term_num4(), test_biomodels217_expression::test_term_num5(), test_biomodels217_expression::test_term_num6(), and test_biomodels217_expression::test_term_num7().

176 {
177  if (infix == mInfix &&
178  infix != "") return true;
179 
180  // We assume until proven otherwise that the tree is not usable
181  mUsable = false;
182 
183  mInfix = infix;
184 
185  return parse();
186 }
std::string mInfix
bool CEvaluationTree::setRoot ( CEvaluationNode pRootNode)
virtual

Sets the root node of the tree.

Parameters
CEvaluationNode*root node of the tree
Returns
bool success

Reimplemented in CMathExpression.

Definition at line 422 of file CEvaluationTree.cpp.

References CEvaluationParserBase::freeNodeList(), CCopasiNode< _Data >::getParent(), mpNodeList, mpRoot, and updateTree().

Referenced by CMathTrigger::compile(), CMathTrigger::compileGE(), CMathTrigger::compileGT(), CMathTrigger::compileLE(), CMathTrigger::compileLT(), SBMLImporter::createCFunctionFromFunctionTree(), CFunction::createCopy(), SBMLImporter::createCReactionFromReaction(), SBMLImporter::createExpressionFromFunction(), SBMLImporter::importEvent(), SBMLImporter::importInitialAssignments(), SBMLImporter::importRuleForModelEntity(), CReaction::setFunctionFromExpressionTree(), CMathExpression::setRoot(), setTree(), CFunction::splitFunction(), and test000055::test_bug1004().

423 {
424  if (pRootNode == NULL) return false;
425 
426  assert(pRootNode->getParent() == NULL);
427 
428  if (mpNodeList != NULL)
430 
431  mpRoot = pRootNode;
432 
433  mpNodeList = new std::vector< CEvaluationNode * >();
434 
435  return this->updateTree();
436 }
std::vector< CEvaluationNode * > * mpNodeList
CCopasiNode< Data > * getParent()
Definition: CCopasiNode.h:139
static void freeNodeList(std::vector< CEvaluationNode * > *pNodeList)
CEvaluationNode * mpRoot
bool CEvaluationTree::setTree ( const ASTNode &  pRootNode)

Sets the complete tree from an SBML ASTNode.

Parameters
constASTNode& root node of the tree
Returns
bool success

Definition at line 467 of file CEvaluationTree.cpp.

References fromAST(), and setRoot().

Referenced by SBMLImporter::applyStoichiometricExpressions(), SBMLImporter::createCFunctionFromFunctionTree(), SBMLImporter::importEvent(), SBMLImporter::importInitialAssignments(), and SBMLImporter::importRuleForModelEntity().

468 {
469  return this->setRoot(CEvaluationTree::fromAST(&pRootNode));
470 }
virtual bool setRoot(CEvaluationNode *pRootNode)
static CEvaluationNode * fromAST(const ASTNode *pASTNode)
void CEvaluationTree::setType ( const CEvaluationTree::Type type)
protected

Set the type of the function

Parameters
constCEvaluationTree::Type & type

Definition at line 170 of file CEvaluationTree.cpp.

References mType.

Referenced by create(), and CFunction::load().

171 {
172  mType = type;
173 }
CEvaluationTree::Type mType
ASTNode * CEvaluationTree::toAST ( const CCopasiDataModel pDataModel) const
virtual

Converts a CEvaluationTree to an ASTNode based tree.

Returns
ASTNode* root node of the tree.

Definition at line 636 of file CEvaluationTree.cpp.

References mpRoot, and CEvaluationNode::toAST().

637 {
638  return this->mpRoot->toAST(pDataModel);
639 }
virtual ASTNode * toAST(const CCopasiDataModel *pDataModel) const
CEvaluationNode * mpRoot
bool CEvaluationTree::updateTree ( )

Updates the infix and the nodeList

Definition at line 438 of file CEvaluationTree.cpp.

References CEvaluationNode::buildInfix(), CEvaluationParserBase::freeNodeList(), mInfix, mpNodeList, and mpRoot.

Referenced by CMathExpression::compile(), CModelAdd::copyDelayExpression(), CModelAdd::copyEventAssignmentExpression(), CModelAdd::copyExpression(), CModelAdd::copyInitialExpression(), CModelAdd::copyTriggerExpression(), SBMLImporter::createCFunctionFromFunctionTree(), CExpression::createInitialExpression(), CModelMerging::mergeInExpression(), and setRoot().

439 {
440  if (mpRoot == NULL)
441  {
443  mpNodeList = NULL;
444 
445  return false;
446  }
447 
448  if (mpNodeList == NULL)
449  {
450  mpNodeList = new std::vector< CEvaluationNode * >;
451  }
452 
453  // Clear the list but preserve the tree
454  mpNodeList->clear();
455 
458 
459  for (; it != end; ++it)
460  mpNodeList->push_back(&*it);
461 
462  mInfix = mpRoot->buildInfix();
463 
464  return true;
465 }
std::vector< CEvaluationNode * > * mpNodeList
std::string buildInfix() const
std::string mInfix
static void freeNodeList(std::vector< CEvaluationNode * > *pNodeList)
CEvaluationNode * mpRoot

Member Data Documentation

std::vector< CEvaluationNode * > CEvaluationTree::mCalculationSequence
protected

A vector of nodes which need to be calculated in sequence

Definition at line 332 of file CEvaluationTree.h.

Referenced by buildCalculationSequence(), calculate(), CMathExpression::compile(), and compileNodes().

std::string::size_type CEvaluationTree::mErrorPosition
private

The error position in case the compilation fails. std::string::npos indicates no error.

Definition at line 311 of file CEvaluationTree.h.

Referenced by compileNodes(), getErrorPosition(), and parse().

std::string CEvaluationTree::mInfix
protected
std::vector< CEvaluationNode * >* CEvaluationTree::mpNodeList
protected
CEvaluationNode* CEvaluationTree::mpRoot
protected
CEvaluationTree::Type CEvaluationTree::mType
protected

The type of the function

Definition at line 287 of file CEvaluationTree.h.

Referenced by compileNodes(), getType(), operator==(), parse(), and setType().

bool CEvaluationTree::mUsable
protected

Value indicating whether this functions might be used in a model

Definition at line 304 of file CEvaluationTree.h.

Referenced by CMassAction::compile(), CMathExpression::compile(), compileNodes(), isUsable(), and setInfix().

C_FLOAT64 CEvaluationTree::mValue
protected

The last computed value of the tree;

Definition at line 327 of file CEvaluationTree.h.

Referenced by calculate(), CMassAction::calcValue(), CExpression::calcValue(), CFunction::calcValue(), initObjects(), and CMathExpression::value().

const std::string CEvaluationTree::TypeName
static
Initial value:
=
{
"userdefined",
"predefined",
"predefined",
"userdefined",
"userdefined",
"userdefined",
"internal",
""
}

The string representation of valid types of a function

Definition at line 48 of file CEvaluationTree.h.

Referenced by CQFunctionDM::data().

const char * CEvaluationTree::XMLType
static
Initial value:
=
{
"Function",
"MassAction",
"PreDefined",
"UserDefined",
"Expression",
"Boolean",
"MathExpression",
NULL
}

The string representation of valid types of a function

Definition at line 53 of file CEvaluationTree.h.

Referenced by CCopasiXML::saveFunctionList(), and CCopasiXMLParser::FunctionElement::start().


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