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