00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __SIM_Time_h__
00015 #define __SIM_Time_h__
00016
00017 #include "SIM_API.h"
00018 #include <UT/UT_Math.h>
00019 #include <UT/UT_RefArray.h>
00020
00021 #define SIM_TIME_TOL (0.00001)
00022
00023
00024
00025 class SIM_API SIM_Time
00026 {
00027 public:
00028 SIM_Time()
00029 : myTime(0.0) { }
00030 SIM_Time(const fpreal64 &t)
00031 : myTime(t) { }
00032 SIM_Time(const SIM_Time &t)
00033 : myTime(t.myTime) { }
00034 ~SIM_Time()
00035 { }
00036
00037 operator fpreal64 () const
00038 { return myTime; }
00039 const SIM_Time &operator=(const fpreal64 &t)
00040 { myTime = t; return *this; }
00041 const SIM_Time &operator=(const SIM_Time &t)
00042 { return (*this = t.myTime); }
00043 bool operator==(const fpreal64 &t) const
00044 { return UTisEqual(myTime, t, SIM_TIME_TOL); }
00045 bool operator==(const SIM_Time &t) const
00046 { return (*this == t.myTime); }
00047 bool operator!=(const fpreal64 &t) const
00048 { return !UTisEqual(myTime, t, SIM_TIME_TOL); }
00049 bool operator!=(const SIM_Time &t) const
00050 { return (*this != t.myTime); }
00051 bool operator>(const fpreal64 &t) const
00052 { return UTisGreater(myTime, t, SIM_TIME_TOL); }
00053 bool operator>(const SIM_Time &t) const
00054 { return (*this > t.myTime); }
00055 bool operator<(const fpreal64 &t) const
00056 { return UTisLess(myTime, t, SIM_TIME_TOL); }
00057 bool operator<(const SIM_Time &t) const
00058 { return (*this < t.myTime); }
00059 bool operator>=(const fpreal64 &t) const
00060 { return UTisGreaterOrEqual(myTime, t, SIM_TIME_TOL); }
00061 bool operator>=(const SIM_Time &t) const
00062 { return (*this >= t.myTime); }
00063 bool operator<=(const fpreal64 &t) const
00064 { return UTisLessOrEqual(myTime, t, SIM_TIME_TOL); }
00065 bool operator<=(const SIM_Time &t) const
00066 { return (*this <= t.myTime); }
00067
00068 private:
00069 fpreal64 myTime;
00070 };
00071
00072 #endif
00073