HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_Time.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  */
7 
8 #ifndef __SIM_Time_h__
9 #define __SIM_Time_h__
10 
11 #include "SIM_API.h"
12 #include <SYS/SYS_Math.h>
13 #include <UT/UT_Array.h>
14 
15 #define SIM_TIME_TOL (0.00001)
16 
17 /// This class is used to represent simulation times. Time is stored with
18 /// fpreal64 precision, and all comparisons are performed with a tolerance.
20 {
21 public:
23  : myTime(0.0) { }
25  : myTime(t) { }
27  : myTime(t.myTime) { }
29  { }
30 
31  operator fpreal64 () const
32  { return myTime; }
33  const SIM_Time &operator=(const fpreal64 &t)
34  { myTime = t; return *this; }
35  const SIM_Time &operator=(const SIM_Time &t)
36  { return (*this = t.myTime); }
37  bool operator==(const fpreal64 &t) const
38  { return SYSisEqual(myTime, t, SIM_TIME_TOL); }
39  bool operator==(const SIM_Time &t) const
40  { return (*this == t.myTime); }
41  bool operator!=(const fpreal64 &t) const
42  { return !SYSisEqual(myTime, t, SIM_TIME_TOL); }
43  bool operator!=(const SIM_Time &t) const
44  { return (*this != t.myTime); }
45  bool operator>(const fpreal64 &t) const
46  { return SYSisGreater(myTime, t, SIM_TIME_TOL); }
47  bool operator>(const SIM_Time &t) const
48  { return (*this > t.myTime); }
49  bool operator<(const fpreal64 &t) const
50  { return SYSisLess(myTime, t, SIM_TIME_TOL); }
51  bool operator<(const SIM_Time &t) const
52  { return (*this < t.myTime); }
53  bool operator>=(const fpreal64 &t) const
54  { return SYSisGreaterOrEqual(myTime, t, SIM_TIME_TOL); }
55  bool operator>=(const SIM_Time &t) const
56  { return (*this >= t.myTime); }
57  bool operator<=(const fpreal64 &t) const
58  { return SYSisLessOrEqual(myTime, t, SIM_TIME_TOL); }
59  bool operator<=(const SIM_Time &t) const
60  { return (*this <= t.myTime); }
61 
62 private:
63  fpreal64 myTime;
64 };
65 
66 SIM_API size_t format(char *buffer, size_t buffer_Size, const SIM_Time &v);
67 
68 #endif
69 
~SIM_Time()
Definition: SIM_Time.h:28
bool operator<(const fpreal64 &t) const
Definition: SIM_Time.h:49
const GLdouble * v
Definition: glcorearb.h:837
SIM_API size_t format(char *buffer, size_t buffer_Size, const SIM_Time &v)
double fpreal64
Definition: SYS_Types.h:201
bool operator==(const SIM_Time &t) const
Definition: SIM_Time.h:39
bool operator>=(const fpreal64 &t) const
Definition: SIM_Time.h:53
Definition: core.h:760
bool operator<(const SIM_Time &t) const
Definition: SIM_Time.h:51
const SIM_Time & operator=(const fpreal64 &t)
Definition: SIM_Time.h:33
SIM_Time(const SIM_Time &t)
Definition: SIM_Time.h:26
bool operator>(const fpreal64 &t) const
Definition: SIM_Time.h:45
bool operator<=(const SIM_Time &t) const
Definition: SIM_Time.h:59
bool operator!=(const fpreal64 &t) const
Definition: SIM_Time.h:41
bool operator<=(const fpreal64 &t) const
Definition: SIM_Time.h:57
GLdouble t
Definition: glad.h:2397
SIM_Time(const fpreal64 &t)
Definition: SIM_Time.h:24
bool operator>(const SIM_Time &t) const
Definition: SIM_Time.h:47
bool operator==(const fpreal64 &t) const
Definition: SIM_Time.h:37
#define SIM_API
Definition: SIM_API.h:12
#define SIM_TIME_TOL
Definition: SIM_Time.h:15
bool operator>=(const SIM_Time &t) const
Definition: SIM_Time.h:55
const SIM_Time & operator=(const SIM_Time &t)
Definition: SIM_Time.h:35
SIM_Time()
Definition: SIM_Time.h:22
bool SYSisEqual(const UT_Vector2T< T > &a, const UT_Vector2T< T > &b, S tol=SYS_FTOLERANCE)
Componentwise equality.
Definition: UT_Vector2.h:674
bool operator!=(const SIM_Time &t) const
Definition: SIM_Time.h:43