COPASI API  4.16.103
CProcessReport.h
Go to the documentation of this file.
1 /* Begin CVS Header
2  $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/utilities/CProcessReport.h,v $
3  $Revision: 1.14 $
4  $Name: $
5  $Author: shoops $
6  $Date: 2012/06/01 17:25:40 $
7  End CVS Header */
8 
9 // Copyright (C) 2012 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // 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 #ifndef COPASI_CProcessReport
19 #define COPASI_CProcessReport
20 
21 #include <string>
22 #include <map>
23 
25 
26 #include "utilities/CVector.h"
27 
29 
31 {
32  // Operations
33 private:
35 
36 public:
37  /**
38  * Specific constructor
39  * @param const string & name
40  * @param const CCopasiParameter::Type & type
41  * @param const void * pValue
42  * @param const void * pEndValue (default: NULL)
43  */
44  CProcessReportItem(const std::string & name,
45  const Type & type,
46  const void * pValue,
47  const void * pEndValue = NULL);
48 
49  /**
50  * Copy Constructor
51  * @param const CProcessReportItem & src
52  */
54 
55  /**
56  * Destructor
57  */
59 
60  /**
61  * Retrieve the private end value of the parameter. This method
62  * returns NULL if no end value has been set.
63  * @return const CCopasiParameter::Value & endValue
64  */
65  const CCopasiParameter::Value & getEndValue() const;
66 
67  /**
68  * Retrieve whether the item has an end value.
69  * @return const bool & hasEndValue
70  */
71  const bool & hasEndValue() const;
72 
73  /**
74  * Retrieve the private end value of the parameter.
75  * @return CCopasiParameter::Value & endValue
76  */
78 
79  // Attributes
80 private:
81  /**
82  * A pointer to the value of the parameter.
83  */
85 
86  /**
87  * Indicator whether an endvalue has been provided
88  */
90 };
91 
93 {
94  // Operations
95 public:
96  /**
97  * Default Constructor
98  * @param const unsigned int & maxTime (Default: 0)
99  */
100  CProcessReport(const unsigned int & maxTime = 0);
101 
102  /**
103  * Destructor
104  */
105  virtual ~CProcessReport();
106 
107  /**
108  * Report process on all items. If the return value is false the calling
109  * process must halt execution and return.
110  * @param bool continue
111  */
112  virtual bool progress();
113 
114  /**
115  * Report process on item handle. If the return value is false the calling
116  * process must halt execution and return.
117  * @param const size_t & handle
118  * @param bool continue
119  */
120  virtual bool progressItem(const size_t & handle);
121 
122  /**
123  * Check whether processing shall proceed. If the return value is false
124  * the calling process must halt execution and return. This method is
125  * provided so that lengthy processing without advances in any of the
126  * reporting items can check whether continuation is requested.
127  * @param bool continue
128  */
129  virtual bool proceed();
130 
131  /**
132  * Reset all item handle. This means that the values of the items have changed
133  * but not as part of a continuous process. If you run multiple processes
134  * call reset between them. If the return value is false the calling
135  * process must halt execution and return.
136  * @param bool continue
137  */
138  virtual bool reset();
139 
140  /**
141  * Reset item handle. This means that the value of the item has changed
142  * but not as part of a continuous process. If you run multiple processes
143  * call reset between them. If the return value is false the calling
144  * process must halt execution and return.
145  * @param const size_t & handle
146  * @param bool continue
147  */
148  virtual bool resetItem(const size_t & handle);
149 
150  /**
151  * Indicate that all items are finished reporting. All item handles loose
152  * their validity. If the return value is false the calling
153  * process must halt execution and return.
154  * @param bool continue
155  */
156  virtual bool finish();
157 
158  /**
159  * Add a process report item to to the list of reporting items.
160  * The return value is the handle of the item and can be used to
161  * indicate process, finish, or reset the item. If the method fails
162  * C_INVALID_INDEX is returned.
163  * @param const std::string & name
164  * @param const std::string & value
165  * @param const std::string * pEndValue = NULL
166  * @return size_t handle
167  */
168  size_t addItem(const std::string & name,
169  const std::string & value,
170  const std::string * pEndValue = NULL);
171 
172  /**
173  * Add a process report item to to the list of reporting items.
174  * The return value is the handle of the item and can be used to
175  * indicate process, finish, or reset the item. If the method fails
176  * C_INVALID_INDEX is returned.
177  * @param const std::string & name
178  * @param const C_INT32 & value
179  * @param const C_INT32 * pEndValue = NULL
180  * @return size_t handle
181  */
182  size_t addItem(const std::string & name,
183  const C_INT32 & value,
184  const C_INT32 * pEndValue = NULL);
185 
186  /**
187  * Add a process report item to to the list of reporting items.
188  * The return value is the handle of the item and can be used to
189  * indicate process, finish, or reset the item. If the method fails
190  * C_INVALID_INDEX is returned.
191  * @param const std::string & name
192  * @param const unsigned C_INT32 & value
193  * @param const unsigned C_INT32 * pEndValue = NULL
194  * @return size_t handle
195  */
196  size_t addItem(const std::string & name,
197  const unsigned C_INT32 & value,
198  const unsigned C_INT32 * pEndValue = NULL);
199 
200  /**
201  * Add a process report item to to the list of reporting items.
202  * The return value is the handle of the item and can be used to
203  * indicate process, finish, or reset the item. If the method fails
204  * C_INVALID_INDEX is returned.
205  * @param const std::string & name
206  * @param const C_FLOAT64 & value
207  * @param const C_FLOAT64 * pEndValue = NULL
208  * @return size_t handle
209  */
210  size_t addItem(const std::string & name,
211  const C_FLOAT64 & value,
212  const C_FLOAT64 * pEndValue = NULL);
213 
214 protected:
215  /**
216  * Add a process report item to to the list of reporting items.
217  * The return value is the handle of the item and can be used to
218  * indicate process, finish, or reset the item. If the method fails
219  * C_INVALID_INDEX is returned.
220  * @param const std::string & name
221  * @param const CCopasiParameter::Type & type
222  * @param const void * pValue
223  * @param const void * pEndValue = NULL
224  * @return size_t handle
225  */
226  virtual size_t addItem(const std::string & name,
227  const CCopasiParameter::Type & type,
228  const void * pValue,
229  const void * pEndValue = NULL);
230 
231 public:
232  /**
233  * Indicate that item handle is finished reporting. The handle of that
234  * item is no longer valid after the call. If the return value is false
235  * the calling process must halt execution and return.
236  * @param const size_t & handle
237  * @param bool continue
238  */
239  virtual bool finishItem(const size_t & handle);
240 
241  /**
242  * Check whether the handle is valid, i.e., usable in progress, reset and finish.
243  */
244  virtual bool isValidHandle(const size_t handle) const;
245 
246  /**
247  * Set the name of the process.
248  * @param const std::string & name
249  * @return success
250  */
251  virtual bool setName(const std::string & name);
252 
253  // Attributes
254 protected:
255  /**
256  * The list process report items.
257  */
259 
260  /**
261  * The name of the process.
262  */
263  std::string mName;
264 
265  /**
266  * The time the process should stop.
267  */
269 };
270 
271 #endif // COPASI_CProcessReport
CProcessReport(const unsigned int &maxTime=0)
virtual bool finish()
std::string mName
virtual bool isValidHandle(const size_t handle) const
virtual bool setName(const std::string &name)
virtual bool resetItem(const size_t &handle)
#define C_INT32
Definition: copasi.h:90
CVector< CProcessReportItem * > mProcessReportItemList
virtual bool progressItem(const size_t &handle)
virtual bool proceed()
virtual bool reset()
virtual bool progress()
size_t addItem(const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
virtual ~CProcessReport()
const CCopasiParameter::Value & getEndValue() const
virtual bool finishItem(const size_t &handle)
#define C_FLOAT64
Definition: copasi.h:92
const bool & hasEndValue() const
CCopasiTimeVariable * mpEndTime
CCopasiParameter::Value mEndValue