00001 #ifndef __INSTANTIO_TIME_H
00002 #define __INSTANTIO_TIME_H
00003
00004 #ifdef _MSC_VER
00005 # pragma once
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "InstantIODef.h"
00027 #include "TypeName.h"
00028
00029
00030 namespace InstantIO
00031 {
00032
00033
00051 class INSTANTIO_DLLMAPPING Time
00052 {
00053 public:
00054
00059 inline Time(): time_(getCurrentTime()) {}
00060
00067 inline Time(double time): time_(time) {}
00068
00074 inline Time(const Time &time): time_(time.time_) {}
00075
00081 inline const Time &operator=(const Time &time)
00082 {
00083 time_ = time.time_;
00084 return time;
00085 }
00086
00091 inline void set(double time)
00092 {
00093 time_ = time;
00094 }
00095
00101 inline void set(Time time)
00102 {
00103 time_ = time.time_;
00104 }
00105
00110 inline double get() const
00111 {
00112 return time_;
00113 }
00114
00121 friend bool operator==(const Time &t1, const Time &t2);
00122
00129 friend inline bool operator!=(const Time &t1, const Time &t2)
00130 {
00131 return !(t1 == t2);
00132 }
00133
00138 static double getCurrentTime();
00139
00146 friend INSTANTIO_DLLMAPPING std::ostream &operator<<(std::ostream &os, const Time &t);
00147
00148 private:
00149
00153 double time_;
00154 };
00155
00156
00163 template <>
00164 class INSTANTIO_DLLMAPPING TypeName<Time>
00165 {
00166 public:
00167
00172 static const char *getName();
00173
00174 private:
00175
00177 TypeName();
00178
00180 TypeName(const TypeName &);
00181
00183 const TypeName &operator=(const TypeName &);
00184 };
00185
00186
00187 }
00188
00189
00190 #endif // __INSTANTIO_TIME_H