COPASI API  4.16.103
CEvaluationNodeVector.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/function/CEvaluationNodeVector.cpp,v $
3 // $Revision: 1.14 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2012/05/16 17:00:57 $
7 // End CVS Header
8 
9 // Copyright (C) 2012 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
20 // Properties, Inc. and EML Research, gGmbH.
21 // All rights reserved.
22 
23 #include "copasi.h"
24 
25 #include "CEvaluationNode.h"
26 #include "CEvaluationTree.h"
27 
28 #include "sbml/math/ASTNode.h"
29 
31  CEvaluationNode((Type)(CEvaluationNode::VECTOR), ""),
32  mVector()
34 
36  const Data & data):
37  CEvaluationNode((Type)(CEvaluationNode::VECTOR | subType), data),
38  mVector()
39 {
40  switch (subType)
41  {
42  case VECTOR:
43  break;
44 
45  default:
46  fatalError();
47  break;
48  }
49 
51 }
52 
54  CEvaluationNode(src),
55  mVector(src.mVector)
56 {}
57 
59 
60 // virtual
61 std::string CEvaluationNodeVector::getInfix(const std::vector< std::string > & children) const
62 {
63  std::string Infix = "{";
64 
65  std::vector< std::string >::const_iterator it = children.begin();
66  std::vector< std::string >::const_iterator end = children.end();
67 
68  if (it != end) Infix += *it++;
69 
70  for (; it != end; ++it)
71  Infix += "," + *it;
72 
73  return Infix + "}";
74 }
75 
76 // virtual
77 std::string CEvaluationNodeVector::getDisplayString(const std::vector< std::string > & children) const
78 {
79  std::string DisplayString = "{";
80 
81  std::vector< std::string >::const_iterator it = children.begin();
82  std::vector< std::string >::const_iterator end = children.end();
83 
84  if (it != end) DisplayString += *it++;
85 
86  for (; it != end; ++it)
87  DisplayString += "," + *it;
88 
89  return DisplayString + "}";
90 }
91 
92 // virtual
93 std::string CEvaluationNodeVector::getCCodeString(const std::vector< std::string > & /* children */) const
94 {
95  return "@";
96 }
97 
98 // virtual
99 std::string CEvaluationNodeVector::getBerkeleyMadonnaString(const std::vector< std::string > & /* children */) const
100 {
101  return "@";
102 }
103 
104 // virtual
105 std::string CEvaluationNodeVector::getXPPString(const std::vector< std::string > & /* children */) const
106 {
107  return "@";
108 }
109 
110 // static
111 CEvaluationNode * CEvaluationNodeVector::fromAST(const ASTNode * /* pASTNode */, const std::vector< CEvaluationNode * > & /* children */)
112 {
113  return NULL;
114 }
115 
116 ASTNode* CEvaluationNodeVector::toAST(const CCopasiDataModel* /*pDataModel*/) const
117 {
118  // :TODO:
119  ASTNode* node = new ASTNode(AST_FUNCTION_PIECEWISE);
120  return node;
121 }
122 
124  CCopasiNode< Data > * pAfter)
125 {
126  CCopasiNode< Data >::addChild(pChild, pAfter);
127  mVector.push_back(static_cast<CEvaluationNode *>(pChild));
128 
129  return true;
130 }
131 
132 const std::vector< CEvaluationNode * > & CEvaluationNodeVector::getVector() const
133 {return mVector;}
virtual std::string getBerkeleyMadonnaString(const std::vector< std::string > &children) const
virtual std::string getXPPString(const std::vector< std::string > &children) const
#define fatalError()
const std::vector< CEvaluationNode * > & getVector() const
virtual std::string getInfix(const std::vector< std::string > &children) const
bool addChild(CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
#define PRECEDENCE_FUNCTION
virtual ASTNode * toAST(const CCopasiDataModel *pDataModel) const
virtual bool addChild(CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
Definition: CCopasiNode.h:156
static CEvaluationNode * fromAST(const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
class CEvaluationNode::CPrecedence mPrecedence
std::vector< CEvaluationNode * > mVector
virtual std::string getDisplayString(const std::vector< std::string > &children) const
virtual std::string getCCodeString(const std::vector< std::string > &children) const