COPASI API  4.16.103
CModelParameterGroup.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_CModelParameterGroup
7 #define COPASI_CModelParameterGroup
8 
9 #include <vector>
10 
11 #include "copasi.h"
12 
14 
15 class CModel;
16 
18 {
19 public:
20  typedef std::vector< CModelParameter * >::iterator iterator;
21  typedef std::vector< CModelParameter * >::const_iterator const_iterator;
22 
23 public:
24  /**
25  * Constructor
26  * @param CModelParameterGroup * pParent
27  * @param const CModelParameter::Type & type (default: CModelParameter::Group)
28  */
30 
31  /**
32  * Copy constructor
33  * @param const CModelParameterGroup & src
34  * @param CModelParameterGroup * pParent
35  * @param const bool & createMissing
36  */
38  CModelParameterGroup * pParent,
39  const bool & createMissing);
40 
41  /**
42  * Destructor
43  */
44  virtual ~CModelParameterGroup();
45 
46  /**
47  * Add parameter of the given type to the group and return a pointer to it
48  * @param const CModelParameter::Type & type
49  * @return CModelParameter * pParameter
50  */
52 
53  /**
54  * Add the given parameter to the group.
55  * Note, the parent of the parameter is not updated
56  * @param CModelParameter * pModelParameter
57  */
58  void add(CModelParameter * pModelParameter);
59 
60  /**
61  * Remove the given parameter from the group.
62  * Note, the parameter is not deleted.
63  * @param CModelParameter * pModelParameter
64  */
65  void remove(CModelParameter * pModelParameter);
66 
67  /**
68  * Remove the indexed parameter from the group and delete it
69  * @param const size_t & index
70  */
71  void remove(const size_t & index);
72 
73  /**
74  * Retrieve the size of the group
75  * @return size_t size
76  */
77  size_t size() const;
78 
79  /**
80  * Retrieve the iterator pointing to the first contained parameter.
81  * @return iterator begin
82  */
83  iterator begin();
84 
85  /**
86  * Retrieve the iterator pointing past the last contained parameter.
87  * @return iterator end
88  */
89  iterator end();
90 
91  /**
92  * Retrieve the const_iterator pointing to the first contained parameter.
93  * @return const_iterator begin
94  */
95  const_iterator begin() const;
96 
97  /**
98  * Retrieve the const_iterator pointing past the last contained parameter.
99  * @return const_iterator end
100  */
101  const_iterator end() const;
102 
103  /**
104  * Compile the parameter
105  */
106  virtual void compile();
107 
108  /**
109  * Clear the contained parameters and delete them.
110  */
111  void clear();
112 
113 #ifndef SWIG
114  /**
115  * Compare the parameter to an other
116  * @param const CModelParameter & other
117  * @param const CModelParameter::Framework & framework
118  * @param const bool & createMissing = false
119  */
120  const virtual CompareResult & diff(const CModelParameter& other,
121  const CModelParameter::Framework & framework,
122  const bool & createMissing = false);
123 #endif //SWIG
124 
125  /**
126  * Update the corresponding model object with the current parameter settings
127  */
128  virtual bool updateModel();
129 
130  /**
131  * Refresh the parameter from the corresponding model object
132  * @param const bool & modifyExistence
133  */
134  virtual bool refreshFromModel(const bool & modifyExistence);
135 
136  /**
137  * Retrieve a pointer to the parameter with the given CN
138  * @param const std::string & cn
139  * @return CModelParameter * pModelParameter
140  */
141  CModelParameter * getModelParameter(const std::string & cn) const;
142 
143  /**
144  * Retrieve a pointer to the parameter with the given name and type
145  * @param const std::string & name
146  * @param const CModelParameter::Type & type
147  * @return CModelParameter * pModelParameter
148  */
149  CModelParameter * getModelParameter(const std::string & name,
150  const CModelParameter::Type & type) const;
151 
152  // These methods are only here so that we can use CNodeIterator to traverse the tree.
153  virtual size_t getNumChildren() const;
154  virtual const CModelParameter * getChild(const size_t & index) const;
155 
156 protected:
157  /**
158  * Assign the content of the source group to this, i.e., copy all
159  * contained parameters.
160  * @param const CModelParameterGroup & src
161  * @param const bool & createMissing
162  */
163  void assignGroupContent(const CModelParameterGroup & src,
164  const bool & createMissing);
165 
166  /**
167  * Copy the existing parameter and add it to the group
168  * @param const CModelParameter & src
169  * @param const bool & createMissing
170  * @return CModelParameter * pCopy
171  */
172  CModelParameter * copy(const CModelParameter & src,
173  const bool & createMissing);
174 
175 private:
176  /**
177  * A vector of pointer to the contained parameters.
178  */
179  std::vector< CModelParameter * > mModelParameters;
180 };
181 
182 #endif // COPASI_CModelParameterGroup
CModelParameterGroup(CModelParameterGroup *pParent, const CModelParameter::Type &type=CModelParameter::Group)
virtual const CModelParameter * getChild(const size_t &index) const
std::vector< CModelParameter * >::iterator iterator
CModelParameter * getModelParameter(const std::string &cn) const
std::vector< CModelParameter * > mModelParameters
virtual size_t getNumChildren() const
void assignGroupContent(const CModelParameterGroup &src, const bool &createMissing)
CModelParameter * copy(const CModelParameter &src, const bool &createMissing)
std::vector< CModelParameter * >::const_iterator const_iterator
virtual const CompareResult & diff(const CModelParameter &other, const CModelParameter::Framework &framework, const bool &createMissing=false)
virtual bool refreshFromModel(const bool &modifyExistence)
Definition: CModel.h:50
CModelParameter * add(const CModelParameter::Type &type)