MAK RTIspy API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
logicalTimeIntervalImplInteger.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2005 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: logicalTimeIntervalImplInteger.h,v $ $Revision: 1.3 $ $State: Exp $
7 *******************************************************************************/
8 
9 #ifndef RTI_LogicalTimeIntervalImplInteger_H_
10 #define RTI_LogicalTimeIntervalImplInteger_H_
11 
12 #include <RTI/LogicalTimeInterval.h>
13 
14 #if VMS
15 #include <limits>
16 #define MAXINT64 numeric_limits<long long>::max()
17 #else
18 #define MAXINT64 9223372036854775807LL
19 #endif
20 
21 #define POSITIVE_INFINITY (MAXINT64)
22 #define EPSILON (1)
23 
25 #if DT_HAVE_64BIT_LONGS
26 
28 typedef long DtLtInt64;
29 
30 #else
31 #ifdef _WIN32
32 
34 typedef _int64 DtLtInt64;
35 
36 #else
37 
39 typedef long long DtLtInt64;
40 
41 #endif
42 #endif
43 
46 {
47 public:
48  static std::wstring theImplementationName;
49 
50 public:
51 
52  // Constructors
57 
58  // Destructor
60  throw ();
61 
62  // Basic accessors/mutators
63  virtual void setZero();
64  virtual bool isZero() const;
65 
66  virtual void setEpsilon();
67  virtual bool isEpsilon() const;
68 
69  // Assignment
70  virtual
71  rti1516::LogicalTimeInterval&
72  operator= (rti1516::LogicalTimeInterval const & value)
73  throw (
74  rti1516::InvalidLogicalTimeInterval);
75 
76  // Set self to the difference between two LogicalTimes
77  virtual
78  void
79  setToDifference(rti1516::LogicalTime const & minuend,
80  rti1516::LogicalTime const& subtrahend)
81  throw (rti1516::InvalidLogicalTime);
82 
83  virtual
84  rti1516::LogicalTimeInterval&
85  operator+= (rti1516::LogicalTimeInterval const & addend)
86  throw (
87  rti1516::InvalidLogicalTimeInterval);
88 
89  virtual
90  rti1516::LogicalTimeInterval&
91  operator-= (rti1516::LogicalTimeInterval const & subtrahend)
92  throw (
93  rti1516::InvalidLogicalTimeInterval);
94 
95  virtual
96  bool
97  operator> (rti1516::LogicalTimeInterval const & value) const
98  throw (
99  rti1516::InvalidLogicalTimeInterval);
100 
101  virtual
102  bool
103  operator< (rti1516::LogicalTimeInterval const & value) const
104  throw (
105  rti1516::InvalidLogicalTimeInterval);
106 
107  virtual
108  bool
109  operator== (rti1516::LogicalTimeInterval const & value) const
110  throw (
111  rti1516::InvalidLogicalTimeInterval);
112 
113  virtual
114  bool
115  operator>= (rti1516::LogicalTimeInterval const & value) const
116  throw (
117  rti1516::InvalidLogicalTimeInterval);
118 
119  virtual
120  bool
121  operator<= (rti1516::LogicalTimeInterval const & value) const
122  throw (
123  rti1516::InvalidLogicalTimeInterval);
124 
125  // Generates an encoded value that can be used to send
126  // LogicalTimeIntervals to other federates in updates or interactions
127  virtual rti1516::VariableLengthData encode() const;
128 
129  // Alternate encode for directly filling a buffer
130  virtual unsigned long encodedLength() const;
131  virtual unsigned long encode(void* buffer, unsigned long bufferSize) const
132  throw (rti1516::CouldNotEncode);
133 
134  // Decode encodedValue into self
135  virtual void decode(rti1516::VariableLengthData const & encodedValue)
136  throw (
137  rti1516::InternalError,
138  rti1516::CouldNotDecode);
139 
140  // Alternate decode that reads directly from a buffer
141  virtual void decode(void* buffer, unsigned long bufferSize)
142  throw (
143  rti1516::InternalError,
144  rti1516::CouldNotDecode);
145 
146  virtual std::wstring toString() const;
147 
148  // Returns the name of the implementation, as needed by
149  // createFederationExecution.
150  virtual std::wstring implementationName() const;
151 
152 public:
153  //-----------------------------------------------------------------
154  // Implementation functions
155  //-----------------------------------------------------------------
156  virtual DtLtInt64 getInterval() const;
157 
158  //-----------------------------------------------------------------
159  // Implementation operators
160  //-----------------------------------------------------------------
161  virtual bool operator== (const DtLtInt64&) const
162  throw (rti1516::InvalidLogicalTimeInterval);
163 
164  virtual bool operator!= (rti1516::LogicalTimeInterval const & value) const
165  throw (
166  rti1516::InvalidLogicalTimeInterval);
167 
168  virtual bool operator!= (LogicalTimeIntervalImplInteger const & value) const
169  throw (
170  rti1516::InvalidLogicalTimeInterval);
171 
172  virtual bool operator!= (const DtLtInt64&) const
173  throw (rti1516::InvalidLogicalTimeInterval);
174 
175  virtual LogicalTimeIntervalImplInteger& operator= (
176  const LogicalTimeIntervalImplInteger& value)
177  throw (rti1516::InvalidLogicalTimeInterval);
178 
179  virtual rti1516::LogicalTimeInterval& operator= (const DtLtInt64&)
180  throw (rti1516::InvalidLogicalTimeInterval);
181 
182  virtual rti1516::LogicalTimeInterval& operator+= (const DtLtInt64&)
183  throw (rti1516::InvalidLogicalTimeInterval);
184 
185  virtual rti1516::LogicalTimeInterval& operator-= (const DtLtInt64&)
186  throw (rti1516::InvalidLogicalTimeInterval);
187 
188 private:
189  //-----------------------------------------------------------------
190  // Implementation member variables
191  //-----------------------------------------------------------------
192  DtLtInt64 myInterval;
193  DtLtInt64 myZero;
194  DtLtInt64 myEpsilon;
195  DtLtInt64 myPositiveInfinity;
196 };
197 
198 #endif // RTI_LogicalTimeIntervalImplInteger_H_
199 

Document ID: Generated on Wed Mar 11 20:26:49 EDT 2015 from SVN revision 150939
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (www.mak.com)