COPASI API  4.16.103
CChemEqElement.cpp
Go to the documentation of this file.
1 /* Begin CVS Header
2  $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/model/CChemEqElement.cpp,v $
3  $Revision: 1.34 $
4  $Name: $
5  $Author: shoops $
6  $Date: 2011/03/21 15:48:15 $
7  End CVS Header */
8 
9 // Copyright (C) 2011 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 // CChemEqElement
24 //
25 // A class describing an element of a chemical equation
26 // (C) Stefan Hoops 2001
27 //
28 
29 #include "copasi.h"
32 #include "utilities/utility.h"
33 #include "CChemEqElement.h"
34 #include "CCompartment.h"
35 #include "report/CKeyFactory.h"
37 #include "CMetabNameInterface.h"
39 
40 CChemEqElement::CChemEqElement(const std::string & name,
41  const CCopasiContainer * pParent):
42  CCopasiContainer(name, pParent, "Chemical Equation Element"),
43  mMetaboliteKey(),
44  mMultiplicity(0)
45  //mpMetabolite(NULL)
46 {
47  initObjects();
49 }
50 
52  const CCopasiContainer * pParent):
53  CCopasiContainer(src, pParent),
54  mMetaboliteKey(src.mMetaboliteKey),
55  mMultiplicity(src.mMultiplicity)
56  //mpMetabolite(src.mpMetabolite)
57 {
58  initObjects();
60 }
61 
63 
65 {
67  addObjectReference("Metab Key", mMetaboliteKey);
68 }
69 
71 
72 void CChemEqElement::setMetabolite(const std::string & key)
73 {
74  mMetaboliteKey = key;
76 
77  if (tmp)
78  this->setObjectName("ChEqEl_" + tmp->getObjectName());
79  else
80  this->setObjectName("ChemEqElement");
81 }
82 
83 const std::string & CChemEqElement::getMetaboliteKey() const
84 {return mMetaboliteKey;}
85 
87 {return dynamic_cast< CMetab * >(CCopasiRootContainer::getKeyFactory()->get(mMetaboliteKey));}
88 
90 {mMultiplicity = multiplicity;}
91 
93 {mMultiplicity += multiplicity;}
94 
96 {
97  return mMultiplicity;
98 }
99 
100 std::ostream & operator<<(std::ostream &os, const CChemEqElement & d)
101 {
102  os << "CChemEqElement: " << d.mMultiplicity
103  << " * " << d.mMetaboliteKey << std::endl;
104 
105  return os;
106 }
void setMultiplicity(const C_FLOAT64 multiplicity)
const std::string & getObjectName() const
CCopasiObject * get(const std::string &key)
const CMetab * getMetabolite() const
Definition: CMetab.h:178
std::string mMetaboliteKey
#define DESTRUCTOR_TRACE
Definition: copasi.h:206
C_FLOAT64 mMultiplicity
void setMetabolite(const std::string &key)
const C_FLOAT64 & getMultiplicity() const
const std::string & getMetaboliteKey() const
static CKeyFactory * getKeyFactory()
#define C_FLOAT64
Definition: copasi.h:92
CChemEqElement(const std::string &name="Chem Eq Element", const CCopasiContainer *pParent=NULL)
std::ostream & operator<<(std::ostream &os, const CChemEqElement &d)
bool setObjectName(const std::string &name)
CCopasiObject * addObjectReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
void addToMultiplicity(const C_FLOAT64 multiplicity=1.0)
#define CONSTRUCTOR_TRACE
Definition: copasi.h:202