![]() |
MAK RTIspy API Documentation for HLA 1.3
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2005 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: logicalTimeIntervalImplInteger.h,v $ $Revision: 1.3 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00009 #ifndef RTI_LogicalTimeIntervalImplInteger_H_ 00010 #define RTI_LogicalTimeIntervalImplInteger_H_ 00011 00012 #include <RTI/LogicalTimeInterval.h> 00013 00014 #if VMS 00015 #include <limits> 00016 #define MAXINT64 numeric_limits<long long>::max() 00017 #else 00018 #define MAXINT64 9223372036854775807LL 00019 #endif 00020 00021 #define POSITIVE_INFINITY (MAXINT64) 00022 #define EPSILON (1) 00023 00025 #if DT_HAVE_64BIT_LONGS 00026 00028 typedef long DtLtInt64; 00029 00030 #else 00031 #ifdef _WIN32 00032 00034 typedef _int64 DtLtInt64; 00035 00036 #else 00037 00039 typedef long long DtLtInt64; 00040 00041 #endif 00042 #endif 00043 00044 class RTI_EXPORT_FEDTIME LogicalTimeIntervalImplInteger 00045 : public rti1516::LogicalTimeInterval 00046 { 00047 public: 00048 static std::wstring theImplementationName; 00049 00050 public: 00051 00052 // Constructors 00053 LogicalTimeIntervalImplInteger(); 00054 LogicalTimeIntervalImplInteger(const DtLtInt64&); 00055 LogicalTimeIntervalImplInteger(rti1516::LogicalTimeInterval const &); 00056 LogicalTimeIntervalImplInteger(const LogicalTimeIntervalImplInteger&); 00057 00058 // Destructor 00059 virtual ~LogicalTimeIntervalImplInteger() 00060 throw (); 00061 00062 // Basic accessors/mutators 00063 virtual void setZero(); 00064 virtual bool isZero() const; 00065 00066 virtual void setEpsilon(); 00067 virtual bool isEpsilon() const; 00068 00069 // Assignment 00070 virtual 00071 rti1516::LogicalTimeInterval& 00072 operator= (rti1516::LogicalTimeInterval const & value) 00073 throw ( 00074 rti1516::InvalidLogicalTimeInterval); 00075 00076 // Set self to the difference between two LogicalTimes 00077 virtual 00078 void 00079 setToDifference(rti1516::LogicalTime const & minuend, 00080 rti1516::LogicalTime const& subtrahend) 00081 throw (rti1516::InvalidLogicalTime); 00082 00083 virtual 00084 rti1516::LogicalTimeInterval& 00085 operator+= (rti1516::LogicalTimeInterval const & addend) 00086 throw ( 00087 rti1516::InvalidLogicalTimeInterval); 00088 00089 virtual 00090 rti1516::LogicalTimeInterval& 00091 operator-= (rti1516::LogicalTimeInterval const & subtrahend) 00092 throw ( 00093 rti1516::InvalidLogicalTimeInterval); 00094 00095 virtual 00096 bool 00097 operator> (rti1516::LogicalTimeInterval const & value) const 00098 throw ( 00099 rti1516::InvalidLogicalTimeInterval); 00100 00101 virtual 00102 bool 00103 operator< (rti1516::LogicalTimeInterval const & value) const 00104 throw ( 00105 rti1516::InvalidLogicalTimeInterval); 00106 00107 virtual 00108 bool 00109 operator== (rti1516::LogicalTimeInterval const & value) const 00110 throw ( 00111 rti1516::InvalidLogicalTimeInterval); 00112 00113 virtual 00114 bool 00115 operator>= (rti1516::LogicalTimeInterval const & value) const 00116 throw ( 00117 rti1516::InvalidLogicalTimeInterval); 00118 00119 virtual 00120 bool 00121 operator<= (rti1516::LogicalTimeInterval const & value) const 00122 throw ( 00123 rti1516::InvalidLogicalTimeInterval); 00124 00125 // Generates an encoded value that can be used to send 00126 // LogicalTimeIntervals to other federates in updates or interactions 00127 virtual rti1516::VariableLengthData encode() const; 00128 00129 // Alternate encode for directly filling a buffer 00130 virtual unsigned long encodedLength() const; 00131 virtual unsigned long encode(void* buffer, unsigned long bufferSize) const 00132 throw (rti1516::CouldNotEncode); 00133 00134 // Decode encodedValue into self 00135 virtual void decode(rti1516::VariableLengthData const & encodedValue) 00136 throw ( 00137 rti1516::InternalError, 00138 rti1516::CouldNotDecode); 00139 00140 // Alternate decode that reads directly from a buffer 00141 virtual void decode(void* buffer, unsigned long bufferSize) 00142 throw ( 00143 rti1516::InternalError, 00144 rti1516::CouldNotDecode); 00145 00146 virtual std::wstring toString() const; 00147 00148 // Returns the name of the implementation, as needed by 00149 // createFederationExecution. 00150 virtual std::wstring implementationName() const; 00151 00152 public: 00153 //----------------------------------------------------------------- 00154 // Implementation functions 00155 //----------------------------------------------------------------- 00156 virtual DtLtInt64 getInterval() const; 00157 00158 //----------------------------------------------------------------- 00159 // Implementation operators 00160 //----------------------------------------------------------------- 00161 virtual bool operator== (const DtLtInt64&) const 00162 throw (rti1516::InvalidLogicalTimeInterval); 00163 00164 virtual bool operator!= (rti1516::LogicalTimeInterval const & value) const 00165 throw ( 00166 rti1516::InvalidLogicalTimeInterval); 00167 00168 virtual bool operator!= (LogicalTimeIntervalImplInteger const & value) const 00169 throw ( 00170 rti1516::InvalidLogicalTimeInterval); 00171 00172 virtual bool operator!= (const DtLtInt64&) const 00173 throw (rti1516::InvalidLogicalTimeInterval); 00174 00175 virtual LogicalTimeIntervalImplInteger& operator= ( 00176 const LogicalTimeIntervalImplInteger& value) 00177 throw (rti1516::InvalidLogicalTimeInterval); 00178 00179 virtual rti1516::LogicalTimeInterval& operator= (const DtLtInt64&) 00180 throw (rti1516::InvalidLogicalTimeInterval); 00181 00182 virtual rti1516::LogicalTimeInterval& operator+= (const DtLtInt64&) 00183 throw (rti1516::InvalidLogicalTimeInterval); 00184 00185 virtual rti1516::LogicalTimeInterval& operator-= (const DtLtInt64&) 00186 throw (rti1516::InvalidLogicalTimeInterval); 00187 00188 private: 00189 //----------------------------------------------------------------- 00190 // Implementation member variables 00191 //----------------------------------------------------------------- 00192 DtLtInt64 myInterval; 00193 DtLtInt64 myZero; 00194 DtLtInt64 myEpsilon; 00195 DtLtInt64 myPositiveInfinity; 00196 }; 00197 00198 #endif // RTI_LogicalTimeIntervalImplInteger_H_ 00199