MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rtiMsg.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1998 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: rtiMsg.h,v $ $Revision: 1.109 $ $State: Exp $
7 *********************************************************************/
8 
11 
12 #ifndef DtRtiMsg_H_
13 #define DtRtiMsg_H_
14 
15 #include <memory>
16 #include "netRtiMsgHdr.h"
17 #include <vlutil/vlBaseMsg.h>
18 #include "internalTypes.h"
19 #include <vlutil/vlString.h>
20 #include "rtiMsgKind.h"
21 
22 #if defined(DtIFSPEC1516) || defined(DtIFSPEC1516E)
23 #include <RTI/Handle.h>
24 #include <RTI/Typedefs.h>
25 #include <RTI/LogicalTime.h>
26 #include <RTI/LogicalTimeInterval.h>
27 #else
28 #ifdef DtIFSPEC13DLC
29 #include "RTI13.h"
30 #define RTI rti13
31 #else
32 #include "RTI.hh"
33 #endif
34 #endif
35 
36 #include "bitMask.h"
37 
39 
40 #define MSG_STATUS_OK 0
41 #define MSG_STATUS_NOT_OK 1
42 
43 
45 class DT_DLL_LRC DtRtiMsg : public MAKRti::DtBaseMsg
46 {
47 public:
48 
50  virtual ~DtRtiMsg();
51 
55  virtual DtRtiMsg* clone(bool copy = true) const =0;
56 
59  virtual DtRtiMsg* cloneWithTransport(bool copy = true) const;
60 
62  virtual DtNetMsgHeader* netHeader() const;
63 
65  virtual int version() const;
66 
68  virtual bool isValidVersion() const;
69 
81 
83  virtual void setFedEx(const MAKRti::DtString& name);
84 
86  virtual void setFedEx(int handle);
87 
91  virtual bool isForExec(const MAKRti::DtString& execName, int execHandle) const;
92 
96 
97 
98 
99  virtual const MAKRti::DtString fedExName() const;
102  virtual int fedExHandle() const;
104 
106 
107  virtual void setFederateHandle(DtFederateHandle handle);
108  virtual DtFederateHandle federateHandle() const;
110 
112 
113  virtual void setSequenceNumber(unsigned long value);
114  virtual unsigned long sequenceNumber() const;
116 
118 
119  virtual void setServiceCallNumber(unsigned long value);
120  virtual unsigned long serviceCallNumber() const;
122 
125 
126  virtual void setTriggerMessageNumber(unsigned long value);
127  virtual unsigned long triggerMessageNumber() const;
129 
131  virtual DtRtiMsgKind msgKind() const;
132 
134  virtual const char* kindString() const;
135 
137  virtual bool isConstrained() const;
138 
140  virtual bool isAllowedDuringSave() const;
141 
145 #ifdef DtIFSPEC1516
146  virtual void setTime(const rti1516::LogicalTime& time);
147  virtual rti1516::LogicalTime const * time(
148  DtLogicalTimeFactory* fedTimeFactory) const;
149 #elif defined(DtIFSPEC1516E)
150  virtual void setTime(const rti1516e::LogicalTime& time);
151  virtual rti1516e::LogicalTime const * time(
152  DtLogicalTimeFactory* fedTimeFactory) const;
153 #else
154  virtual void setTime(const RTI::FedTime& time);
155  virtual RTI::FedTime const * time(
156  DtLogicalTimeFactory* fedTimeFactory) const;
157 #endif
158 
160  virtual bool hasTime() const;
161 
165  virtual void setSerialNumber(unsigned long serialNumberValue);
166  virtual unsigned long serialNumber() const;
167 
169  virtual void setTransportType(DtTransportHandle type);
170  virtual DtTransportHandle transportType() const;
171 
173  virtual DtOrderHandle orderType() const;
174 
176  virtual bool isMetadataPresent() const;
177 
184  virtual bool addMetadata( caddr_t* mtdAddr, unsigned int size,
185  unsigned int* alignPad, unsigned int* headerPad = NULL );
186 
189  virtual void removeMetadata( unsigned int size );
190 
193  bool isInteractionMsgType() const;
194  bool isUpdateMsgType() const;
195 
196 
197 
199  virtual void print(DtLogicalTimeFactory* logicalTimeFactory) const;
200  virtual void printHeader(DtLogicalTimeFactory* logicalTimeFactory) const;
201  virtual void printData(DtLogicalTimeFactory* logicalTimeFactory) const;
202 
204 #ifdef DtIFSPEC1516
205  virtual void printTime(const char* label,
206  rti1516::LogicalTime const * timeValue) const;
207 
209  virtual void printInterval(const char* label,
210  rti1516::LogicalTimeInterval const* intervalValue) const;
211 #elif defined(DtIFSPEC1516E)
212  virtual void printTime(const char* label,
213  rti1516e::LogicalTime const * timeValue) const;
214 
216  virtual void printInterval(const char* label,
217  rti1516e::LogicalTimeInterval const* intervalValue) const;
218 #else
219  virtual void printTime(const char* label,
220  RTI::FedTime const * timeValue) const;
221 
223  virtual void printInterval(const char* label,
224  RTI::FedTime const* intervalValue) const;
225 #endif
226 
228  virtual int status() const;
229 
230 public:
231 
233  static inline const DtNetMsgHeader* netHeader(const void *buffer);
234 
236  static const char* kindToString(DtRtiMsgKind kind);
237 
239  static const char* kindString(const void *buffer);
240 
242  static const DtRtiMsgKind msgKind(const void *buffer);
243 
245  static unsigned int version(const void* buffer);
246 
248  static unsigned int fedExHandle(const void* buffer);
249 
251  static DtFederateHandle federateHandle(const void* buffer);
252 
254  static unsigned long sequenceNumber(const void* buffer);
255 
257  static void setDefaultRegionSet(unsigned long defaultRegionSet);
258 
260  static void setUse32BitsForValueSize(bool use32BitsForValueSizeEnabled);
261  static bool use32BitsForValueSize();
262 
264  static void setSmartForwardingEnabled( bool enabled );
265  static bool smartForwardingEnabled();
266 
267 public:
268  static unsigned long theDefaultRegionSetHandle;
269 #ifdef DtIFSPEC1516
270  static const rti1516::VariableLengthData theDefaultTag;
271 #elif defined(DtIFSPEC1516E)
272  static const rti1516e::VariableLengthData theDefaultTag;
273 #else
274  static const char* theDefaultTag;
275 #endif
276 
277 protected:
278 
280  DtRtiMsg();
281 
282  virtual DtRtiMsgKind internalDtRtiMsgKind() = 0;
283 
286  virtual void sizeChanged(int size);
287 
289  void initDtRtiMsg(int size, DtRtiMsgKind msgKindVal, DtBufferPtr buffer);
290  void initDtRtiMsg(const void *initial, int size, DtBufferPtr buffer);
291  void initDtRtiMsg(const DtNetMsgHeader *header, DtBufferPtr buffer);
292 
295  virtual void adjustBytes(int offset, int numBytes);
296 
300  virtual void adjustBytes(void *address, int numBytes);
301 
302 protected:
303 
306 #ifdef DtIFSPEC1516
307  rti1516::LogicalTime* myFedTime;
308 #elif defined(DtIFSPEC1516E)
309  rti1516e::LogicalTime* myFedTime;
310 #else
312 #endif
316  unsigned long mySerialNumber;
317  unsigned long myServiceCallNumber;
318  unsigned long myTriggerMessage;
319 
320 protected:
321 
323 
325 };
326 
328 {
329  return (DtNetMsgHeader*) netRep();
330 }
331 
332 inline const DtNetMsgHeader* DtRtiMsg::netHeader(const void *buffer)
333 {
334  return reinterpret_cast<const DtNetMsgHeader*>(buffer);
335 }
336 
338 {
339  return DtRtiMsgKind((DtU32) (DtU8) netHeader()->msgKind);
340 }
341 
342 inline int DtRtiMsg::status() const
343 {
344  return MSG_STATUS_OK;
345 }
346 
348 {
349  return (DtFederateHandle) (DtU16) netHeader()->fedHandle;
350 }
351 
352 
353 inline void DtRtiMsg::adjustBytes(int offset, int numBytes)
354 {
355  if (numBytes > 0)
356  insertBytes(offset, numBytes);
357  else
358  if (numBytes < 0)
359  deleteBytes(offset, -numBytes);
360 }
361 
362 inline void DtRtiMsg::adjustBytes(void *address, int numBytes)
363 {
364  if (numBytes > 0)
365  insertBytes(address, numBytes);
366  else
367  if (numBytes < 0)
368  deleteBytes(address, -numBytes);
369 }
370 
371 #endif
372 

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)