MAK RTIspy API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
msgQueue.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2001 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: msgQueue.h,v $ $Revision: 1.20 $ $State: Exp $
7 *********************************************************************/
8 
11 
12 #ifndef DtRtiMsgQueue_H_
13 #define DtRtiMsgQueue_H_
14 
15 #include "rtiMsConfig.h"
16 #include "internalTypes.h"
17 #include <vlutil/vlHashlist.h>
18 #include "sortedList.h"
19 #include <memory>
20 
21 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
22 #include <RTI/LogicalTime.h>
24 #else
25 #ifdef DtIFSPEC13DLC
26 #include "RTI13.h"
27 #define RTI rti13
28 #else
29 #include "RTI.hh"
30 #endif
31 #endif
32 
33 class DtRtiMsg;
35 class DtInteractionMgr;
36 class DtObjectMgr;
37 
41 {
42 public:
43 
44  friend class DtRtiMsgQueue;
45 
46 public:
47 
49  virtual ~DtMessageItem();
50 
52  virtual bool operator<= (const DtSortedListItem& item) const;
53  virtual bool operator< (const DtSortedListItem& item) const;
54  virtual bool operator>= (const DtSortedListItem& item) const;
55  virtual bool operator> (const DtSortedListItem& item) const;
56  virtual bool operator== (const DtSortedListItem& item) const;
57 
59  virtual void printData(DtLogicalTimeFactory* logicalTimeFactory);
60 
62  virtual DtRtiMsg* msg();
63 
64 protected:
65 
67  DtMessageItem(void* data, DtLogicalTimeFactory* fedTimeFactory);
68 
69 protected:
72 };
73 
75 {
76  return myMsg;
77 }
78 
80 
82 {
83 
84 public:
85  DtRtiMsgQueue(DtLogicalTimeFactory* fedTimeFactory, DtObjectMgr* objMgr=0, DtInteractionMgr* intMgr=0);
86 
87  virtual ~DtRtiMsgQueue();
88 
90  virtual bool timeRegulating();
91  virtual void setTimeRegulating(bool isTimeRegulating);
92  virtual bool timeConstrained();
93  virtual void setTimeConstrained(bool isTimeConstrained);
94  virtual bool asynchronous();
95  virtual void setAsynchronous(bool isAsynchronous);
96  virtual bool timeAvailable();
97  virtual void setTimeAvailable(bool isTimeAvailable);
98  virtual bool timeAdvancing();
99  virtual void setTimeAdvancing(bool isTimeAdvancing);
100 
101 #ifdef DtIFSPEC1516
102  virtual const rti1516::LogicalTime& timestamp();
104  virtual void setTimestamp(const rti1516::LogicalTime& federateTime);
105 
107  virtual const rti1516::LogicalTimeInterval& lookahead();
108  virtual void setLookahead(const rti1516::LogicalTimeInterval& lookaheadValue);
109 
114  virtual const rti1516::LogicalTime& galt();
115  virtual void setGalt(const rti1516::LogicalTime& federateTime);
116 
117 #elif defined(DtIFSPEC1516E)
118  virtual const rti1516e::LogicalTime& timestamp();
120  virtual void setTimestamp(const rti1516e::LogicalTime& federateTime);
121 
123  virtual const rti1516e::LogicalTimeInterval& lookahead();
124  virtual void setLookahead(const rti1516e::LogicalTimeInterval& lookaheadValue);
125 
130  virtual const rti1516e::LogicalTime& galt();
131  virtual void setGalt(const rti1516e::LogicalTime& federateTime);
132 #else
133  virtual const RTI::FedTime& timestamp();
135  virtual void setTimestamp(const RTI::FedTime& federateTime);
136 
138  virtual const RTI::FedTime& lookahead();
139  virtual void setLookahead(const RTI::FedTime& lookaheadValue);
140 
145  virtual const RTI::FedTime& galt();
146  virtual void setGalt(const RTI::FedTime& federateTime);
147 #endif
148 
149 
154  virtual bool queueMsg(DtRtiMsg const& msg);
155 
157  virtual void restoreMsg(DtRtiMsg const& msg);
158 
160  virtual DtRtiMsg* removeMsg(const DtMessageRetractionHandle& retractHandle);
161 
164  virtual bool deleteMsg(const DtMessageRetractionHandle& retractHandle);
165 
167  virtual void deleteMsgs(DtFederateHandle federateHandle);
168 
170  virtual void deleteAll();
171 
172 #ifdef DtIFSPEC1516
173  virtual DtRtiMsg* nextMsg(const rti1516::LogicalTime& timestamp);
175 
177  virtual DtRtiMsg* nextTsoMsg(const rti1516::LogicalTime& timestamp);
178 #elif defined(DtIFSPEC1516E)
179  virtual DtRtiMsg* nextMsg(const rti1516e::LogicalTime& timestamp);
181 
183  virtual DtRtiMsg* nextTsoMsg(const rti1516e::LogicalTime& timestamp);
184 #else
185  virtual DtRtiMsg* nextMsg(const RTI::FedTime& timestamp);
187 
189  virtual DtRtiMsg* nextTsoMsg(const RTI::FedTime& timestamp);
190 #endif
191 
193  virtual DtRtiMsg* removeNextTsoMsg();
194 
196  virtual DtRtiMsg* peekNextTsoMsg();
197 
199  inline unsigned int roQueueLength() const;
200 
202  virtual void clean();
203 
205  virtual bool isDirty() const;
206 
207 protected:
208 
211  virtual DtSortedListItem* newItem(void* data);
212 
213  DtRtiMsgQueue(const DtRtiMsgQueue& orig);
214  DtRtiMsgQueue& operator=(DtRtiMsgQueue const& orig);
215 
217  virtual DtSortedListItem* add(void* data);
218 
221  virtual int evaluateSubscription(DtRtiMsg const& msg);
222 
223 protected:
224 
225  MAKRti::DtList myRoList;
231  bool myIsDirty;
235 #ifdef DtIFSPEC1516
236  std::auto_ptr <rti1516::LogicalTime> myTime;
237  std::auto_ptr <rti1516::LogicalTimeInterval> myLookahead;
238  std::auto_ptr <rti1516::LogicalTime> myGalt;
239 #elif defined(DtIFSPEC1516E)
240  std::auto_ptr <rti1516e::LogicalTime> myTime;
241  std::auto_ptr <rti1516e::LogicalTimeInterval> myLookahead;
242  std::auto_ptr <rti1516e::LogicalTime> myGalt;
243 #else
244  std::auto_ptr <RTI::FedTime> myTime;
245  std::auto_ptr <RTI::FedTime> myLookahead;
246  std::auto_ptr <RTI::FedTime> myGalt;
247 #endif
248 };
249 
251 {
253 }
254 
255 inline void DtRtiMsgQueue::setTimeRegulating(bool isTimeRegulating)
256 {
257  myTimeRegulatingEnabled = isTimeRegulating;
258 }
259 
261 {
263 }
264 
265 inline void DtRtiMsgQueue::setTimeConstrained(bool isTimeConstrained)
266 {
267  myTimeConstrainedEnabled = isTimeConstrained;
268 }
269 
271 {
272  return myAsynchronous;
273 }
274 
275 inline void DtRtiMsgQueue::setAsynchronous(bool isAsynchronous)
276 {
277  myAsynchronous = isAsynchronous;
278 }
279 
281 {
282  return myTimeAvailable;
283 }
284 
285 inline void DtRtiMsgQueue::setTimeAvailable(bool isTimeAvailable)
286 {
287  myTimeAvailable = isTimeAvailable;
288 }
289 
291 {
292  return myTimeAdvancing;
293 }
294 
295 inline void DtRtiMsgQueue::setTimeAdvancing(bool isTimeAdvancing)
296 {
297  myTimeAdvancing = isTimeAdvancing;
298 }
299 
300 #ifdef DtIFSPEC1516
301 inline const rti1516::LogicalTime& DtRtiMsgQueue::timestamp()
302 #elif defined(DtIFSPEC1516E)
304 #else
305 inline const RTI::FedTime& DtRtiMsgQueue::timestamp()
306 #endif
307 {
308  return *myTime;
309 }
310 
311 #ifdef DtIFSPEC1516
312 inline void DtRtiMsgQueue::setTimestamp(
313  const rti1516::LogicalTime& federateTime)
314 #elif defined(DtIFSPEC1516E)
315 inline void DtRtiMsgQueue::setTimestamp(
316  const rti1516e::LogicalTime& federateTime)
317 #else
318 inline void DtRtiMsgQueue::setTimestamp(const RTI::FedTime& federateTime)
319 #endif
320 {
321  *myTime = federateTime;
322 }
323 
324 #ifdef DtIFSPEC1516
325 inline const rti1516::LogicalTimeInterval& DtRtiMsgQueue::lookahead()
326 #elif defined(DtIFSPEC1516E)
328 #else
329 inline const RTI::FedTime& DtRtiMsgQueue::lookahead()
330 #endif
331 {
332  return *myLookahead;
333 }
334 
335 #ifdef DtIFSPEC1516
336 inline void DtRtiMsgQueue::setLookahead(
337  const rti1516::LogicalTimeInterval& lookaheadValue)
338 #elif defined(DtIFSPEC1516E)
339 inline void DtRtiMsgQueue::setLookahead(
340  const rti1516e::LogicalTimeInterval& lookaheadValue)
341 #else
342 inline void DtRtiMsgQueue::setLookahead(const RTI::FedTime& lookaheadValue)
343 #endif
344 {
345  *myLookahead = lookaheadValue;
346 }
347 
348 #ifdef DtIFSPEC1516
349 inline const rti1516::LogicalTime& DtRtiMsgQueue::galt()
350 #elif defined(DtIFSPEC1516E)
352 #else
353 inline const RTI::FedTime& DtRtiMsgQueue::galt()
354 #endif
355 {
356  return *myGalt;
357 }
358 
359 #ifdef DtIFSPEC1516
360 inline void DtRtiMsgQueue::setGalt(const rti1516::LogicalTime& federateTime)
361 #elif defined(DtIFSPEC1516E)
362 inline void DtRtiMsgQueue::setGalt(const rti1516e::LogicalTime& federateTime)
363 #else
364 inline void DtRtiMsgQueue::setGalt(const RTI::FedTime& federateTime)
365 #endif
366 {
367  *myGalt = federateTime;
368 }
369 
370 inline unsigned int DtRtiMsgQueue::roQueueLength() const
371 {
372  return myRoList.count();
373 }
374 
375 #endif
Definition: LogicalTimeInterval.h:35
bool myTimeAvailable
Definition: msgQueue.h:229
bool myIsDirty
Definition: msgQueue.h:231
virtual void setTimeConstrained(bool isTimeConstrained)
Definition: msgQueue.h:265
virtual bool timeRegulating()
Set/Get status of time regulation/constraint.
Definition: msgQueue.h:250
virtual bool operator<(const DtSortedListItem &) const
Sorted list for queueing messages in time stamped order.
Definition: msgQueue.h:81
DtInteractionMgr * myIntMgr
Definition: msgQueue.h:234
std::auto_ptr< RTI::FedTime > myGalt
Definition: msgQueue.h:246
bool myTimeRegulatingEnabled
Definition: msgQueue.h:227
unsigned int roQueueLength() const
Return the RO queue length.
Definition: msgQueue.h:370
!DtIFSPEC1516
Definition: fedTimeFactory.h:190
Definition: LogicalTime.h:35
virtual bool timeAdvancing()
Definition: msgQueue.h:290
std::auto_ptr< RTI::FedTime > myLookahead
Definition: msgQueue.h:245
virtual void setTimeAdvancing(bool isTimeAdvancing)
Definition: msgQueue.h:295
virtual void printData()
Print data contents.
virtual DtSortedListItem * newItem(void *data)
Create a new sorted list item envelope for the data to be inserted into the list. ...
virtual bool timeAvailable()
Definition: msgQueue.h:280
DtObjectMgr * myObjMgr
Definition: msgQueue.h:233
virtual bool asynchronous()
Definition: msgQueue.h:270
virtual void setTimeRegulating(bool isTimeRegulating)
Definition: msgQueue.h:255
DtSortedListItem is an envelope class used by DtSortedList.
Definition: sortedList.h:24
virtual void setTimestamp(const RTI::FedTime &federateTime)
Definition: msgQueue.h:318
virtual bool operator==(const DtSortedListItem &) const
virtual void setGalt(const RTI::FedTime &federateTime)
Definition: msgQueue.h:364
MAKRti::DtList myRoList
Definition: msgQueue.h:225
Envelope used by DtMsgQueue to contain the messsage inserted into it.
Definition: msgQueue.h:40
Instances of DtInteractionMgr manage the sending and receiving of interactions.
Definition: interMgr.h:45
DtRtiMsg is the base class for messages between RTI components.
Definition: rtiMsg.h:45
DtHandle DtFederateHandle
Definition: internalTypes.h:29
virtual DtSortedListItem * add(void *data)
Add element to the list in sorted order.
virtual bool timeConstrained()
Definition: msgQueue.h:260
bool myAsynchronous
Definition: msgQueue.h:228
virtual const RTI::FedTime & timestamp()
Set/Get current federate time.
Definition: msgQueue.h:305
virtual const RTI::FedTime & lookahead()
Set/Get current federate lookahead.
Definition: msgQueue.h:329
DtSortedList & operator=(const DtSortedList &orig)
Assignment operator.
virtual const RTI::FedTime & galt()
Set/Get greatest allowed logical time When in the time advancing state messages with timestamps less ...
Definition: msgQueue.h:353
The object manager class processes the object management services.
Definition: objMgr.h:90
virtual void setTimeAvailable(bool isTimeAvailable)
Definition: msgQueue.h:285
bool myTimeConstrainedEnabled
Definition: msgQueue.h:226
Definition: internalTypes.h:63
virtual bool operator>(const DtSortedListItem &) const
virtual DtRtiMsg * msg()
Return pointer to data as a message.
Definition: msgQueue.h:74
DtLogicalTimeFactory * myLogicalTimeFactory
Definition: msgQueue.h:232
virtual bool operator<=(const DtSortedListItem &) const
Comparison operators for sorting.
#define DT_DLL_LRC
Definition: rtiMsConfig.h:126
std::auto_ptr< RTI::FedTime > myTime
Definition: msgQueue.h:244
DtRtiMsg * myMsg
Definition: msgQueue.h:70
The declaration of internal types.
bool myTimeAdvancing
Definition: msgQueue.h:230
DtLogicalTimeFactory * myLogicalTimeFactory
Definition: msgQueue.h:71
A DtSortedList is a list of elements of arbitrary type.
Definition: sortedList.h:98
virtual bool operator>=(const DtSortedListItem &) const
virtual void setLookahead(const RTI::FedTime &lookaheadValue)
Definition: msgQueue.h:342
virtual void setAsynchronous(bool isAsynchronous)
Definition: msgQueue.h:275

Document ID: Generated on Mon Sep 7 15:40:32 EDT 2020 from SVN revision 217499
Copyright © 2005-2020 MAK Technologies Inc. All Rights Reserved (www.mak.com)