COPASI API  4.16.103
CMoiety.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 /**
16  * CMoiety
17  *
18  * New class created for Copasi by Stefan Hoops
19  * (C) Stefan Hoops 2001
20  */
21 
22 #ifndef COPASI_CMoiety
23 #define COPASI_CMoiety
24 
25 #include <string>
26 #include <vector>
27 
31 class CMetab;
32 
33 class CTotalNumberReference : public CCopasiObjectReference< C_FLOAT64 >
34 {
35  /**
36  * Hidden default constructor
37  */
39 
40 public:
41  /**
42  * Specific constructor
43  * @param const std::string & name
44  * @param const CCopasiContainer * pParent,
45  * @param C_FLOAT64 & reference,
46  */
47  CTotalNumberReference(const std::string & name,
48  const CCopasiContainer * pParent,
49  C_FLOAT64 & reference);
50 
51  /**
52  * Copy constructor
53  * @param const CTotalNumberReference & src
54  * @param const CCopasiContainer * pParent,
55  */
57  const CCopasiContainer * pParent);
58 
59  /**
60  * Destructor
61  */
63 
64  /**
65  * Check whether a given object is a prerequisite for a context.
66  * @param const CObjectInterface * pObject
67  * @param const CMath::SimulationContextFlag & context
68  * @param const CObjectInterface::ObjectSet & changedObjects
69  * @return bool isPrerequisiteForContext
70  */
71  virtual bool isPrerequisiteForContext(const CObjectInterface * pObject,
72  const CMath::SimulationContextFlag & context,
73  const CObjectInterface::ObjectSet & changedObjects) const;
74 };
75 
77 {
78  /**
79  * Hidden default constructor
80  */
82 
83 public:
84  /**
85  * Specific constructor
86  * @param const std::string & name
87  * @param const CCopasiContainer * pParent,
88  * @param C_FLOAT64 & reference,
89  */
90  CDependentNumberReference(const std::string & name,
91  const CCopasiContainer * pParent,
92  C_FLOAT64 & reference);
93 
94  /**
95  * Copy constructor
96  * @param const CDependentNumberReference & src
97  * @param const CCopasiContainer * pParent,
98  */
100  const CCopasiContainer * pParent);
101 
102  /**
103  * Destructor
104  */
106 
107  /**
108  * Check whether a given object is a prerequisite for a context.
109  * @param const CObjectInterface * pObject
110  * @param const CMath::SimulationContextFlag & context
111  * @param const CObjectInterface::ObjectSet & changedObjects
112  * @return bool isPrerequisiteForContext
113  */
114  virtual bool isPrerequisiteForContext(const CObjectInterface * pObject,
115  const CMath::SimulationContextFlag & context,
116  const CObjectInterface::ObjectSet & changedObjects) const;
117 };
118 
119 class CMoiety : public CCopasiContainer
120 {
121  // Attributes
122 private:
123  /**
124  * The default conversion factor used if the moiety is not part of a model
125  */
126  static const C_FLOAT64 DefaultFactor;
127 
128  /**
129  * The key of the moiety
130  */
131  std::string mKey; //By G
132 
133  /**
134  * Number of Particles of Moiety.
135  */
137 
138  /**
139  * Initial Number of Particles of Moiety.
140  */
142 
143  /**
144  * The total Amount of the Moiety.
145  */
147 
148  /**
149  * Vector of linear dependent CChemEqElement
150  * @supplierCardinality 0..*
151  */
152  /** @dia:route 7,3; h,41.0337,110.831,46.5202,117.862,52.0066 */
153  // CCopasiVector < CChemEqElement > mEquation;
154  std::vector<std::pair< C_FLOAT64, CMetab * > > mEquation;
155 
156  /**
157  * A pointer to the object for the initial total particle number
158  */
160 
161  /**
162  * A pointer to the object for the total particle number
163  * This is used during events
164  */
166 
167  /**
168  * A pointer to the object for the dependent particle number
169  */
171 
172  /**
173  * A pointer to the conversion factor between the particle number and the amount.
174  */
176 
177  // Operations
178 public:
179  /**
180  * Default constructor
181  * @param const std::string & name (default: "NoName")
182  * @param const CCopasiContainer * pParent (default: NULL)
183  */
184  CMoiety(const std::string & name = "NoName",
185  const CCopasiContainer * pParent = NULL);
186 
187  /**
188  * Copy constructor
189  * @param "const CMoiety &" src
190  * @param const CCopasiContainer * pParent (default: NULL)
191  */
192  CMoiety(const CMoiety & src,
193  const CCopasiContainer * pParent = NULL);
194 
195  /**
196  * Destructor
197  */
198  ~CMoiety();
199 
200  /**
201  * Add a metabolite to a moiety
202  * @param C_FLOAT64 value
203  * @param CMetab * metabolite
204  */
205  void add(C_FLOAT64 value, CMetab * metabolite);
206 
207  /**
208  *
209  */
210  void cleanup();
211 
212  /**
213  * Refresh the initial total particle number
214  */
215  void refreshInitialValue();
216 
217  /**
218  * Retrieve the object for the total particle number
219  * @return CCopasiObject * initialValueReference
220  */
222 
223  /**
224  * Refresh the total particle number
225  */
226  void refreshValue();
227 
228  /**
229  * Retrieve the object for the total particle number
230  * @return CCopasiObject * valueReference
231  */
233 
234  /**
235  * get the string representation of the moiety using the CMetabNameInterface
236  */
237  std::string getDescription(const CModel* model) const;
238 
239  /**
240  * Retrieve and refresh the dependent number;
241  * @return const C_FLOAT64 & dependentNumber
242  */
243  const C_FLOAT64 & dependentNumber();
244 
245  /**
246  * Retrieve the dependent number;
247  * @return const C_FLOAT64 & dependentNumber
248  */
249  const C_FLOAT64 & getDependentNumber() const;
250 
251  /**
252  * Retrieve the object for the dependent particle number
253  * @return CCopasiObject * totalNumberReference
254  */
256 
257  /**
258  * Retrieve the object for the dependent particle number
259  * @return CCopasiObject * dependentNumberReference
260  */
262 
263  /**
264  *
265  */
266  C_FLOAT64 getNumber() const;
267 
268  /**
269  * Returns a string with the name of this compartment.
270  * @return std::string key
271  */
272  virtual const std::string & getKey() const; //By G
273 
274  /**
275  * Sets the parent of the moiety;
276  * @param const CCopasiContainer * pParent
277  * @return bool success
278  */
279  virtual bool setObjectParent(const CCopasiContainer * pParent);
280 
281  /**
282  * Refreshes the value of the dependent number
283  */
284  void refreshDependentNumber();
285 
286  /**
287  * Retrieve the infix expression, which can be used to calculate the
288  * total amount.
289  * @return std::string expression
290  */
291  std::string getExpression() const;
292 
293  /**
294  * Retrieve the total amount
295  * @return const C_FLOAT64 & amount
296  */
297  const C_FLOAT64 & getAmount() const;
298 
299  /**
300  * Refresh the total amount
301  */
302  void refreshAmount();
303 
304  /**
305  * Retrieve the components of the total mass equation
306  * @return const std::vector<std::pair< C_FLOAT64, CMetab * > > & equation
307  */
308  const std::vector<std::pair< C_FLOAT64, CMetab * > > & getEquation() const;
309 
310 private:
311  /**
312  * Initialize the contained CCopasiObjects
313  */
314  void initObjects();
315 
316  /**
317  * Initialize the number to amount conversion factor
318  */
319  void initConversionFactor();
320 };
321 
322 #endif // COPASI_CMoiety
const C_FLOAT64 & dependentNumber()
Definition: CMoiety.cpp:139
C_FLOAT64 mIAmount
Definition: CMoiety.h:146
virtual bool setObjectParent(const CCopasiContainer *pParent)
Definition: CMoiety.cpp:156
CCopasiObject * getValueReference() const
Definition: CMoiety.cpp:223
CCopasiObject * getTotalNumberReference() const
Definition: CMoiety.cpp:148
~CMoiety()
Definition: CMoiety.cpp:70
void initObjects()
Definition: CMoiety.cpp:76
static const C_FLOAT64 DefaultFactor
Definition: CMoiety.h:126
void cleanup()
Definition: CMoiety.cpp:114
const std::vector< std::pair< C_FLOAT64, CMetab * > > & getEquation() const
Definition: CMoiety.cpp:267
std::vector< std::pair< C_FLOAT64, CMetab * > > mEquation
Definition: CMoiety.h:153
std::string getDescription(const CModel *model) const
Definition: CMoiety.cpp:164
Definition: CMetab.h:178
CTotalNumberReference * mpNumberReference
Definition: CMoiety.h:164
void initConversionFactor()
Definition: CMoiety.cpp:272
CDependentNumberReference * mpDNumberReference
Definition: CMoiety.h:169
C_FLOAT64 mNumber
Definition: CMoiety.h:136
void refreshValue()
Definition: CMoiety.cpp:214
std::string getExpression() const
Definition: CMoiety.cpp:228
const C_FLOAT64 & getDependentNumber() const
Definition: CMoiety.cpp:145
C_FLOAT64 getNumber() const
Definition: CMoiety.cpp:209
std::set< const CObjectInterface * > ObjectSet
const C_FLOAT64 * mpConversionFactor
Definition: CMoiety.h:174
void add(C_FLOAT64 value, CMetab *metabolite)
Definition: CMoiety.cpp:96
#define C_FLOAT64
Definition: copasi.h:92
void refreshDependentNumber()
Definition: CMoiety.cpp:122
virtual bool isPrerequisiteForContext(const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
Definition: CMoiety.cpp:301
void refreshAmount()
Definition: CMoiety.cpp:262
C_FLOAT64 mINumber
Definition: CMoiety.h:141
Definition: CModel.h:50
std::string mKey
Definition: CMoiety.h:131
virtual const std::string & getKey() const
Definition: CMoiety.cpp:154
CTotalNumberReference * mpINumberReference
Definition: CMoiety.h:158
CCopasiObject * getInitialValueReference() const
Definition: CMoiety.cpp:206
const C_FLOAT64 & getAmount() const
Definition: CMoiety.cpp:257
CMoiety(const std::string &name="NoName", const CCopasiContainer *pParent=NULL)
Definition: CMoiety.cpp:36
CCopasiObject * getDependentNumberReference() const
Definition: CMoiety.cpp:151
virtual bool isPrerequisiteForContext(const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
Definition: CMoiety.cpp:323
void refreshInitialValue()
Definition: CMoiety.cpp:193