BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
timeStamp.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_CONCEPT_TIMESTAMP_H
6 #define BALL_CONCEPT_TIMESTAMP_H
7 
8 #ifndef BALL_CONFIG_CONFIG_H
9 # include <BALL/CONFIG/config.h>
10 #endif
11 
12 #ifndef BALL_COMMON_CREATE_H
13 # include <BALL/COMMON/create.h>
14 #endif
15 
16 #ifndef BALL_COMMON_DEBUG_H
17 # include <BALL/COMMON/debug.h>
18 #endif
19 
20 #ifndef BALL_CONCEPT_PERSISTENCEMANAGER_H
22 #endif
23 
24 #include <iostream>
25 
26 namespace BALL
27 {
28 
38  {
39 
40  public:
41 
43 
44 
47 
51  PreciseTime();
52 
55  PreciseTime(const PreciseTime& time);
56 
59  PreciseTime(long secs, long usecs);
60 
63  virtual ~PreciseTime();
64 
66 
69 
72  static const PreciseTime ZERO;
73 
75 
78 
81  void set(long secs, long usecs);
82 
85  void set(const PreciseTime& time);
86 
89  const PreciseTime& operator = (const PreciseTime& time);
90 
93  virtual void clear()
94  ;
95 
97 
100 
103  bool operator < (const PreciseTime& time) const;
104 
107  bool operator > (const PreciseTime& time) const;
108 
111  bool operator == (const PreciseTime& time) const;
112 
114 
117 
120  long getSeconds() const;
121 
124  long getMicroSeconds() const;
125 
129  static PreciseTime now();
130 
132 
136 
143  void write(PersistenceManager& pm) const;
144 
151  bool read(PersistenceManager& pm);
152 
154 
155  protected:
156 
157  long secs_;
158  long usecs_;
159 
160  #ifdef BALL_HAS_WINDOWS_PERFORMANCE_COUNTER
161  static long ticks_;
162  #endif
163  };
164 
172  {
173  public:
174 
176 
177 
180 
183  TimeStamp();
184 
187  virtual ~TimeStamp();
188 
190 
193 
196  bool isNewerThan(const PreciseTime& time) const;
197 
200  bool isOlderThan(const PreciseTime& time) const;
201 
204  bool isNewerThan(const TimeStamp& stamp) const;
205 
208  bool isOlderThan(const TimeStamp& stamp) const;
209 
212  bool operator == (const TimeStamp& stamp) const;
213 
215 
218 
225  virtual void stamp(const PreciseTime& time = PreciseTime::ZERO);
226 
230  const PreciseTime& getTime() const;
231 
233 
236 
239  const PreciseTime& operator = (const PreciseTime& time);
240 
243  virtual void clear();
244 
246 
249 
256  void write(PersistenceManager& pm) const;
257 
264  bool read(PersistenceManager& pm);
265 
267 
268  protected:
269 
273  };
274 
278 
282  std::ostream& operator << (std::ostream& os, const PreciseTime& time);
283 
287  std::ostream& operator << (std::ostream& os, const TimeStamp& stamp);
288 
290 
291 
292 # ifndef BALL_NO_INLINE_FUNCTIONS
293 # include <BALL/CONCEPT/timeStamp.iC>
294 # endif
295 
296 } // namespace BALL
297 
298 #endif // BALL_CONCEPT_TIMESTAMP_H
#define BALL_CREATE(name)
Definition: create.h:62
BALL_EXPORT std::ostream & operator<<(std::ostream &os, const Exception::GeneralException &e)
BALL_EXPORT bool operator>(const String &s1, const String &s2)
BALL_EXPORT bool operator==(const String &s1, const String &s2)
PreciseTime time_
Definition: timeStamp.h:272
static const PreciseTime ZERO
Definition: timeStamp.h:72
#define BALL_EXPORT
Definition: COMMON/global.h:50
BALL_EXPORT bool operator<(const String &s1, const String &s2)