COPASI API  4.16.103
CFunctionParameter.h
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/function/CFunctionParameter.h,v $
3 // $Revision: 1.36 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2009/01/07 18:54:35 $
7 // End CVS Header
8 
9 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
11 // and The University of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc. and EML Research, gGmbH.
16 // All rights reserved.
17 
18 /**
19  * CFunctionParameter
20  *
21  * Created for Copasi by Stefan Hoops
22  * (C) Stefan Hoops 2001
23  */
24 
25 #ifndef COPASI_CFunctionParameter
26 #define COPASI_CFunctionParameter
27 
28 #include <string>
29 #include <iostream>
30 
31 #include "utilities/CReadConfig.h"
33 
34 /** @dia:pos 15.1888,24.6765 */
36  {
37  public:
38  /**
39  * A string representation of the data type
40  */
41  static const std::string DataTypeName[];
42 
43  enum Role
44  {
45  SUBSTRATE = 0,
52  TEMPORARY
53  };
54 
55  /**
56  * The string representation of valid roles of a function parameter
57  */
58  static const std::string RoleNameXML[];
59  static const std::string RoleNameDisplay[];
60 
61  public:
62 
63  /*
64  static const std::string & convertDisplayRoleNameToInternal(const std::string & role);
65  */
66  static Role xmlRole2Enum(const std::string & role);
67 
68  /**
69  * Valid data type for a function parameter
70  */
71  enum DataType {INT32 = 0, FLOAT64, VINT32, VFLOAT64};
72 
73  private:
74  /**
75  * The key of the function parameter
76  */
77  std::string mKey;
78 
79  /**
80  * The data type of the parameter this may be one of INT16, INT32,
81  * UINT16, UINT32, FLOAT32, FLOAT64, VINT16, VINT32, VUINT16, VUINT32,
82  * VFLOAT32, VFLOAT64
83  */
85 
86  /**
87  * The usage or meaning of the parameter. This has no functional
88  * implication for CFunction but it might be used in derived classes.
89  * Possible usage is SUBSTRATE, PRODUCT, MODIFIER, or PARAMETER
90  */
91  Role mUsage;
92 
93  /**
94  * Specifies whether the parameter is used in the function
95  */
96  bool mIsUsed;
97 
98  public:
99  /**
100  * Default constructor
101  * @param const std::string & name (default: "NoName")
102  * @param const CCopasiContainer * pParent (default: NULL)
103  */
104  CFunctionParameter(const std::string & name = "NoName",
105  const CCopasiContainer * pParent = NULL);
106 
107  /**
108  * Copy constructor
109  * @param "const CFunctionParameter" & src
110  * @param const CCopasiContainer * pParent (default: NULL)
111  */
113  const CCopasiContainer * pParent = NULL);
114 
115  /**
116  * Specified constuctor, sets all member values at once
117  * @param "const string &" name
118  * @param "const CFunctionParameter::DataType &" type
119  * @param "const string &" usage
120  * @param const CCopasiContainer * pParent (default: NULL)
121  */
122  CFunctionParameter(const std::string & name,
123  const DataType & type,
124  Role usage,
125  const CCopasiContainer * pParent = NULL);
126 
127  /**
128  * Destructor
129  */
130  virtual ~CFunctionParameter();
131 
132  /**
133  * Cleanup
134  */
135  void cleanup();
136 
137  /**
138  * Loads an object with data coming from a CReadConfig object.
139  * (CReadConfig object reads an input stream)
140  * @param pconfigbuffer reference to a CReadConfig object.
141  * @return Fail
142  */
143  virtual void load(CReadConfig & configbuffer,
145 
146  /**
147  * Retrieves the key of the function parameter.
148  * @return std::string name
149  */
150  virtual const std::string & getKey() const;
151 
152  /**
153  * Retrieves the data type of the parameter
154  * @return "const CFunctionParameter::DataType" & type
155  */
156  const CFunctionParameter::DataType & getType() const;
157 
158  /**
159  * Sets the data type of the parameter
160  * @param "const CFunctionParameter::DataType" & type
161  */
162  void setType(const CFunctionParameter::DataType & type);
163 
164  /**
165  * Retrieves the usage of the parameter
166  * @return "const string" & usage
167  */
168  Role getUsage() const;
169 
170  /**
171  * Sets the usage of the parameter
172  * @param "const string" & usage
173  */
174  void setUsage(Role usage);
175 
176  /**
177  * Set whether the parameter is used within a function
178  * @param const bool & isUsed
179  */
180  void setIsUsed(const bool & isUsed);
181 
182  /**
183  * Retrieve whether the parameter is used within a function
184  * @return const bool & isUsed
185  */
186  const bool & isUsed() const;
187 
188  /**
189  * insert operator
190  */
191  friend std::ostream& operator<<(std::ostream &os, const CFunctionParameter & d);
192  };
193 
194 #endif // COPASI_CFunctionParameter
const CFunctionParameter::DataType & getType() const
void setIsUsed(const bool &isUsed)
static const std::string DataTypeName[]
void setUsage(Role usage)
virtual const std::string & getKey() const
void setType(const CFunctionParameter::DataType &type)
CFunctionParameter::DataType mType
CFunctionParameter(const std::string &name="NoName", const CCopasiContainer *pParent=NULL)
static const std::string RoleNameXML[]
Header file of class CCopasiContainer.
static Role xmlRole2Enum(const std::string &role)
static const std::string RoleNameDisplay[]
friend std::ostream & operator<<(std::ostream &os, const CFunctionParameter &d)
const bool & isUsed() const
virtual void load(CReadConfig &configbuffer, CReadConfig::Mode mode=CReadConfig::NEXT)