COPASI API  4.16.103
CMathDependencyNode.h
Go to the documentation of this file.
1 // Copyright (C) 2011 - 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 #ifndef COPASI_CObjectDependencyNode
7 #define COPASI_CObjectDependencyNode
8 
9 #include <set>
10 #include <vector>
11 
13 #include "copasi/math/CMathEnum.h"
14 
16 {
17  // Operations
18 private:
19  CMathDependencyNode(void);
20 
21 public:
22  /**
23  * Specific constructor
24  * @param const CObjectInterface * pObject
25  */
26  CMathDependencyNode(const CObjectInterface * pObject);
27 
28  /**
29  * Destructor
30  */
32 
33  /**
34  * Retrieve a pointer to the object the node is representing
35  * @return const CObjectInterface * pObject
36  */
37  const CObjectInterface * getObject() const;
38 
39  /**
40  * Add a prerequisite
41  * @param CMathDependencyNode * pNode
42  */
44 
45  /**
46  * Retrieve the prerequisites
47  * @return std::vector< CMathDependencyNode * > prerequisites
48  */
49  std::vector< CMathDependencyNode * > & getPrerequisites();
50 
51  /**
52  * Add a dependent
53  * @param CMathDependencyNode * pNode
54  */
55  void addDependent(CMathDependencyNode * pNode);
56 
57  /**
58  * Retrieve the dependents
59  * @return std::vector< CMathDependencyNode * > dependents
60  */
61  std::vector< CMathDependencyNode * > & getDependents();
62 
63  /**
64  * Update the state of all dependents (and dependents thereof) to changed,
65  * @param const CMath::SimulationContextFlag & context
66  * @param const CObjectInterface::ObjectSet & changedObjects
67  * @return bool success
68  */
70  const CObjectInterface::ObjectSet & changedObjects);
71 
72  /**
73  * Update the state of all prerequisites (and prerequisites thereof) to requested.
74  * @param const CMath::SimulationContextFlag & context
75  * @param const CObjectInterface::ObjectSet & changedObjects
76  * @return bool success
77  */
79  const CObjectInterface::ObjectSet & changedObjects);
80 
81  /**
82  * Build the sequence of objects which need to be updated to calculate the object value.
83  * @param const CMath::SimulationContextFlag & context
84  * @param CObjectInterface::UpdateSequence & updateSequence
85  * @return bool success
86  */
88  CObjectInterface::UpdateSequence & updateSequence);
89 
90  /**
91  * Set whether the current node has changed its value
92  * @param const bool & changed
93  */
94  void setChanged(const bool & changed);
95 
96  /**
97  * Check whether the current nodes value is changed
98  * @return const bool & isChanged
99  */
100  const bool & isChanged() const;
101 
102  /**
103  * Set whether the current node's value is requested
104  * @param const bool & requested
105  */
106  void setRequested(const bool & requested);
107 
108  /**
109  * Check whether the current node's value is requested
110  * @param const bool & isRequested
111  */
112  const bool & isRequested() const;
113 
114  // Attributes
115 private:
117  std::vector< CMathDependencyNode * > mPrerequisites;
118  std::vector< CMathDependencyNode * > mDependents;
119  bool mChanged;
121 };
122 
123 #endif // COPASI_CObjectDependencyNode
std::vector< CMathDependencyNode * > & getPrerequisites()
void addPrerequisite(CMathDependencyNode *pNode)
const bool & isChanged() const
const CObjectInterface * mpObject
const CObjectInterface * getObject() const
void addDependent(CMathDependencyNode *pNode)
void setRequested(const bool &requested)
void setChanged(const bool &changed)
std::vector< CMathDependencyNode * > mDependents
std::set< const CObjectInterface * > ObjectSet
bool updatePrerequisiteState(const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects)
bool updateDependentState(const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects)
std::vector< CMathDependencyNode * > & getDependents()
std::vector< CMathDependencyNode * > mPrerequisites
const bool & isRequested() const
bool buildUpdateSequence(const CMath::SimulationContextFlag &context, CObjectInterface::UpdateSequence &updateSequence)
std::vector< CObjectInterface * > UpdateSequence