![]() |
MAK RTIspy API Documentation for HLA 1516
|
00001 /*********************************************************************** 00002 IEEE 1516.1 High Level Architecture Interface Specification C++ API 00003 File: RTI/LogicalTime.h 00004 ***********************************************************************/ 00005 00006 #ifndef RTI_LogicalTime_h 00007 #define RTI_LogicalTime_h 00008 00009 // The classes associated with logical time allow a federation to provide their 00010 // own representation for logical time and logical time interval. The federation 00011 // is responsible to inherit from the abstract classes declared below. The 00012 // encoded time classes are used to hold the arbitrary bit representation of the 00013 // logical time and logical time intervals. 00014 00015 namespace rti1516 00016 { 00017 class LogicalTimeInterval; 00018 } 00019 00020 #include <RTI/SpecificConfig.h> 00021 #include <RTI/Exception.h> 00022 #include <string> 00023 #include <RTI/VariableLengthData.h> 00024 00025 namespace rti1516 00026 { 00027 class RTI_EXPORT LogicalTime 00028 { 00029 public: 00030 virtual 00031 ~LogicalTime() 00032 throw () = 0; 00033 00034 virtual 00035 void 00036 setInitial() = 0; 00037 00038 virtual 00039 bool 00040 isInitial() const = 0; 00041 00042 virtual 00043 void 00044 setFinal() = 0; 00045 00046 virtual 00047 bool 00048 isFinal() const = 0; 00049 00050 virtual 00051 LogicalTime & 00052 operator=(LogicalTime const & value) 00053 throw (InvalidLogicalTime) = 0; 00054 00055 virtual 00056 LogicalTime & 00057 operator+=(LogicalTimeInterval const & addend) 00058 throw (IllegalTimeArithmetic, InvalidLogicalTimeInterval) = 0; 00059 00060 virtual 00061 LogicalTime & 00062 operator-=(LogicalTimeInterval const & subtrahend) 00063 throw (IllegalTimeArithmetic, InvalidLogicalTimeInterval) = 0; 00064 00065 virtual 00066 bool 00067 operator>(LogicalTime const & value) const 00068 throw (InvalidLogicalTime) = 0; 00069 00070 virtual 00071 bool 00072 operator<(LogicalTime const & value) const 00073 throw (InvalidLogicalTime) = 0; 00074 00075 virtual 00076 bool 00077 operator==(LogicalTime const & value) const 00078 throw (InvalidLogicalTime) = 0; 00079 00080 virtual 00081 bool 00082 operator>=(LogicalTime const & value) const 00083 throw (InvalidLogicalTime) = 0; 00084 00085 virtual 00086 bool 00087 operator<=(LogicalTime const & value) const 00088 throw (InvalidLogicalTime) = 0; 00089 00090 // Generates an encoded value that can be used to send 00091 // LogicalTimes to other federates in updates or interactions 00092 virtual VariableLengthData encode() const = 0; 00093 00094 // Alternate encode for directly filling a buffer 00095 virtual unsigned long encodedLength() const = 0; 00096 virtual unsigned long encode(void* buffer, unsigned long bufferSize) const 00097 throw (CouldNotEncode) = 0; 00098 00099 // Decode encodedLogicalTime into self 00100 virtual void decode(VariableLengthData const & encodedLogicalTime) 00101 throw (InternalError, 00102 CouldNotDecode) = 0; 00103 00104 // Alternate decode that reads directly from a buffer 00105 virtual void decode(void* buffer, unsigned long bufferSize) 00106 throw (InternalError, 00107 CouldNotDecode) = 0; 00108 00109 virtual std::wstring toString() const = 0; 00110 00111 // Returns the name of the implementation, as needed by 00112 // createFederationExecution. 00113 virtual std::wstring implementationName() const = 0; 00114 }; 00115 00116 // Output operator for LogicalTime 00117 std::wostream RTI_EXPORT & 00118 operator << (std::wostream &, LogicalTime const &); 00119 } 00120 00121 #endif // RTI_LogicalTime_h