COPASI API  4.16.103
CopasiTime.h
Go to the documentation of this file.
1 /* Begin CVS Header
2  $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/utilities/CopasiTime.h,v $
3  $Revision: 1.10 $
4  $Name: $
5  $Author: shoops $
6  $Date: 2012/04/04 16:00:06 $
7  End CVS Header */
8 
9 // Copyright (C) 2012 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_time
19 #define COPASI_time
20 
21 #include "copasi.h"
22 
23 /**
24  * This class is for handling execution time related values.
25  * static methods for retreiving wall clock and CPU time are
26  * provided.
27  */
29 {
30 public:
31  /**
32  * Default constructor.
33  */
35 
36  /**
37  * Copy constructor.
38  * @param const CCopasiTimeVariable & src
39  */
41 
42  /**
43  * Specific constructor from a C_INT64 value.
44  * @param const C_INT64 & value
45  */
46  CCopasiTimeVariable(const C_INT64 & value);
47 
48  /**
49  * Destructor.
50  */
52 
53  /**
54  * Operator + for adding CCopasiTimeVariables
55  * @param const CCopasiTimeVariable & value
56  * @return CCopasiTimeVariable sum
57  */
59 
60  /**
61  * Operator - for subtracting CCopasiTimeVariables
62  * @param const CCopasiTimeVariable & value
63  * @return CCopasiTimeVariable difference
64  */
66 
67  /**
68  * Assignement operator
69  * @param const CCopasiTimeVariable & rhs
70  * @return CCopasiTimeVariable & this
71  */
73 
74  /**
75  * Assignement operator assigning a C_INT64 value to a CCopasiTimeVariable
76  * @param const CCopasiTimeVariable & rhs
77  * @return CCopasiTimeVariable & this
78  */
79  CCopasiTimeVariable & operator = (const C_INT64 & value);
80 
81  /**
82  * Coparison operator <
83  * @param const CCopasiTimeVariable & value
84  * @return bool isLess
85  */
86  bool operator < (const CCopasiTimeVariable & value);
87 
88  /**
89  * Create a iso formated string (D:HH:MM:SS.ssssss)
90  * @return std::string
91  */
92  std::string isoFormat() const;
93 
94  /**
95  * Retrieve the time in micro seconds. If bounded is true
96  * 0 <= microSeconds < 1000
97  * @param const bool & bounded (default: false)
98  * @return C_INT64 microSeconds
99  */
100  C_INT64 getMicroSeconds(const bool & bounded = false) const;
101 
102  /**
103  * Retrieve the time in milli seconds. If bounded is true
104  * 0 <= milliSeconds < 1000
105  * @param const bool & bounded (default: false)
106  * @return C_INT64 milliSeconds
107  */
108  C_INT64 getMilliSeconds(const bool & bounded = false) const;
109 
110  /**
111  * Retrieve the time in seconds. If bounded is true
112  * 0 <= seconds < 60
113  * @param const bool & bounded (default: false)
114  * @return C_INT64 seconds
115  */
116  C_INT64 getSeconds(const bool & bounded = false) const;
117 
118  /**
119  * Retrieve the time in minutes. If bounded is true
120  * 0 <= minutes < 60
121  * @param const bool & bounded (default: false)
122  * @return C_INT64 minutes
123  */
124  C_INT64 getMinutes(const bool & bounded = false) const;
125 
126  /**
127  * Retrieve the time in hours. If bounded is true
128  * 0 <= hours < 24
129  * @param const bool & bounded (default: false)
130  * @return C_INT64 hours
131  */
132  C_INT64 getHours(const bool & bounded = false) const;
133 
134  /**
135  * Retrieve the time in days.
136  * @param const bool & bounded (default: false)
137  * @return C_INT64 days
138  */
139  C_INT64 getDays() const;
140 
141  /**
142  * Retrieve the current wall clock time in micro seconds
143  * since 1970-01-01:00:00:00.0
144  * @return CCopasiTimeVariable time
145  */
147 
148  /**
149  * Retrieve the current process CPU time used since the start of the process.
150  * @return CCopasiTimeVariable time
151  */
153 
154  /**
155  * Retrieve the current process thread time used since the start of the process.
156  * @return CCopasiTimeVariable time
157  */
159 
160  /**
161  * Helper function to convert a C_INT32 to a std::string.
162  * If the number of digits is non zero the value is padded with
163  * zeros.
164  * @param const C_INT64 & value
165  * @param const C_INT32 & digits (default: 0)
166  * @return std::string
167  */
168  static std::string LL2String(const C_INT64 & value,
169  const C_INT32 & digits = 0);
170 
171 private:
172  /**
173  * Value containing the time in micro seconds.
174  */
176 };
177 
178 #endif
std::string isoFormat() const
Definition: CopasiTime.cpp:76
static CCopasiTimeVariable getThreadTime()
Definition: CopasiTime.cpp:206
static CCopasiTimeVariable getProcessTime()
Definition: CopasiTime.cpp:180
C_INT64 getHours(const bool &bounded=false) const
Definition: CopasiTime.cpp:142
#define C_INT64
Definition: copasi.h:88
#define C_INT32
Definition: copasi.h:90
bool operator<(const CCopasiTimeVariable &value)
Definition: CopasiTime.cpp:73
static std::string LL2String(const C_INT64 &value, const C_INT32 &digits=0)
Definition: CopasiTime.cpp:246
C_INT64 getMinutes(const bool &bounded=false) const
Definition: CopasiTime.cpp:134
C_INT64 getDays() const
Definition: CopasiTime.cpp:150
static CCopasiTimeVariable getCurrentWallTime()
Definition: CopasiTime.cpp:160
CCopasiTimeVariable operator+(const CCopasiTimeVariable &value)
Definition: CopasiTime.cpp:55
C_INT64 getSeconds(const bool &bounded=false) const
Definition: CopasiTime.cpp:126
C_INT64 getMicroSeconds(const bool &bounded=false) const
Definition: CopasiTime.cpp:112
CCopasiTimeVariable & operator=(const CCopasiTimeVariable &rhs)
Definition: CopasiTime.cpp:61
CCopasiTimeVariable operator-(const CCopasiTimeVariable &value)
Definition: CopasiTime.cpp:58
C_INT64 getMilliSeconds(const bool &bounded=false) const
Definition: CopasiTime.cpp:118