COPASI API  4.16.103
CFunctionParameters.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) 2002 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 /**
16  * CFunctionParameters
17  *
18  * Created for COPASI by Stefan Hoops
19  * (C) Stefan Hoops 2001
20  */
21 
22 #ifndef COPASI_CFunctionParameters
23 #define COPASI_CFunctionParameters
24 
29 
30 /** @dia:pos 10.7176,6.51973 */
32 {
33  // Attributes
34 
35 private:
36  /**
37  * A vector of parameters
38  * @supplierCardinality 0..*
39  * @associates <{CFunctionParameter}>
40  */
41  /** @dia:route 0,3; h,15.1888,24.6765,8.71728,7.21973,10.7176 */
43 
44 public:
45  /**
46  * Default constructor
47  * @param const std::string & name (default: "NoName")
48  * @param const CCopasiContainer * pParent (default: NULL)
49  */
50  CFunctionParameters(const std::string & name = "NoName",
51  const CCopasiContainer * pParent = NULL);
52 
53  /**
54  * Copy constructor
55  * @param "const CFunctionParameters &" src
56  * @param const CCopasiContainer * pParent (default: NULL)
57  */
59  const CCopasiContainer * pParent = NULL);
60 
61  /**
62  * Destructor
63  */
65 
66  /**
67  * Cleanup
68  */
69  void cleanup();
70 
71  /**
72  * Assignment operator. Performs deep copy.
73  */
75 
76  /**
77  * Add a parameter to the parameter list
78  * @param "const CFunctionParameter &" parameter
79  */
80 
81  void add(const CFunctionParameter & parameter);
82 
83  /**
84  * Add a parameter to the parameter list
85  * @param "CFunctionParameter *" parameter
86  * @param const bool & adopt (Default: false)
87  * @return bool success
88  */
89  bool add(CFunctionParameter * parameter, const bool & adopt = false);
90 
91  /**
92  * Add a parameter to the parameter list
93  * @param "const string & name
94  * @param "const CFunctionParameter::DataType &" type
95  * @param "const string &" usage
96  * @return bool success
97  */
98  bool add(const std::string & name,
99  const CFunctionParameter::DataType & type,
101 
102  /**
103  * Remove a parameter from the parameter list
104  * @param "const CFunctionParameter &" parameter
105  */
106  void remove(const std::string & name);
107 
108  /**
109  *
110  */
111  CFunctionParameter * operator[](size_t index);
112  const CFunctionParameter * operator[](size_t index) const;
113 
114  /**
115  *
116  */
117  CFunctionParameter * operator[](const std::string &name);
118  const CFunctionParameter * operator[](const std::string &name) const;
119 
120  /**
121  * number of parameters
122  */
123  size_t size() const;
124 
125  /**
126  * Swap parameters
127  * @param const size_t & from
128  * @param const size_t & to
129  */
130  void swap(const size_t & from, const size_t & to);
131 
132  /**
133  * tells whether there is a parameter with vector type and the given role
134  * (if there is one it is assumed it is the only one with this role)
135  */
136  bool isVector(CFunctionParameter::Role role) const;
137 
138  /**
139  * Retrieves the first parameter with the specified usage after pos
140  * In a normal situation pos is set to 0 for the first call.
141  * It is increment by the method to allow subsequent searches to start
142  * after the last found item. This is usefull if several parameters
143  * with the same usage exist.
144  * @param "const string &" usage
145  * @param "size_t &" pos (first call should be with 0)
146  * @return "CFunctionParameter &" usageRange
147  */
149  size_t & pos) const;
150 
151  /**
152  * gets the number of Parameters with a specific usage
153  */
155 
156  /**
157  * find a parameter by its name and return its index
158  */
159  size_t findParameterByName(const std::string & name,
160  CFunctionParameter::DataType & dataType) const;
161 
162  bool operator==(const CFunctionParameters & rhs) const;
163 
164  /**
165  * insert operator
166  */
167  friend std::ostream & operator<<(std::ostream &os, const CFunctionParameters & d);
168 };
169 
170 #endif // COPASI_CFunctionParameters
void swap(const size_t &from, const size_t &to)
CFunctionParameter * operator[](size_t index)
CFunctionParameters(const std::string &name="NoName", const CCopasiContainer *pParent=NULL)
bool operator==(const CFunctionParameters &rhs) const
size_t findParameterByName(const std::string &name, CFunctionParameter::DataType &dataType) const
size_t getNumberOfParametersByUsage(CFunctionParameter::Role usage) const
CCopasiVectorNS< CFunctionParameter > mParameters
void add(const CFunctionParameter &parameter)
friend std::ostream & operator<<(std::ostream &os, const CFunctionParameters &d)
const CFunctionParameter * getParameterByUsage(CFunctionParameter::Role usage, size_t &pos) const
Header file of class CCopasiContainer.
CFunctionParameters & operator=(const CFunctionParameters &src)
bool isVector() const