MAK RTIspy API Documentation for HLA 4
 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 <rtiMsgKind.h>
16 #include <netRtiMsgHdr.h>
17 #include <internalTypes.h>
18 #include <rtiApiTypes.h>
19 #include <bitMask.h>
20 
21 #include <vlutil/vlBaseMsg.h>
22 #include <vlutil/vlString.h>
23 
24 #include <memory>
25 
26 
28 
29 #define MSG_STATUS_OK 0
30 #define MSG_STATUS_NOT_OK 1
31 
32 
34 class DT_DLL_LRC DtRtiMsg : public MAKRti::DtBaseMsg
35 {
36 public:
37 
39  virtual ~DtRtiMsg();
40 
44  virtual DtRtiMsg* clone(bool copy = true) const =0;
45 
48  virtual DtRtiMsg* cloneWithTransport(bool copy = true) const;
49 
51  virtual DtNetMsgHeader* netHeader() const;
52 
54  virtual int version() const;
55 
57  virtual bool isValidVersion() const;
58 
70 
72  virtual void setFedEx(const MAKRti::DtString& name);
73 
75  virtual void setFedEx(int handle);
76 
80  virtual bool isForExec(const MAKRti::DtString& execName, int execHandle) const;
81 
85 
86  virtual const MAKRti::DtString fedExName() const;
91  virtual int fedExHandle() const;
93 
95 
96  virtual void setFederateHandle(DtFederateHandle handle);
97  virtual DtFederateHandle federateHandle() const;
99 
101 
102  virtual void setSequenceNumber(unsigned long value);
103  virtual unsigned long sequenceNumber() const;
105 
107 
108  virtual void setServiceCallNumber(unsigned long value);
109  virtual unsigned long serviceCallNumber() const;
111 
114 
115  virtual void setTriggerMessageNumber(unsigned long value);
116  virtual unsigned long triggerMessageNumber() const;
118 
120  virtual DtRtiMsgKind msgKind() const;
121 
123  virtual const char* kindString() const;
124 
126  virtual bool isConstrained() const;
127 
129  virtual bool isAllowedDuringSave() const;
130 
134  virtual void setTime(const DtRtiApiTime& time);
135  virtual DtRtiApiTime const * time(DtLogicalTimeFactory* fedTimeFactory) const;
136 
138  virtual bool hasTime() const;
139 
143  virtual void setSerialNumber(unsigned long serialNumberValue);
144  virtual unsigned long serialNumber() const;
145 
147  virtual void setTransportType(DtTransportHandle type);
148  virtual DtTransportHandle transportType() const;
149 
151  virtual DtOrderHandle orderType() const;
152 
154  virtual bool isMetadataPresent() const;
155 
162  virtual bool addMetadata( caddr_t* mtdAddr, unsigned int size,
163  unsigned int* alignPad, unsigned int* headerPad = NULL );
164 
167  virtual void removeMetadata( unsigned int size );
168 
171  bool isInteractionMsgType() const;
172  bool isUpdateMsgType() const;
173 
174 
175 
177  virtual void print(DtLogicalTimeFactory* logicalTimeFactory) const;
178  virtual void printHeader(DtLogicalTimeFactory* logicalTimeFactory) const;
179  virtual void printData(DtLogicalTimeFactory* logicalTimeFactory) const;
180 
182  virtual void printTime(const char* label, DtRtiApiTime const * timeValue) const;
183 
185  virtual void printInterval(const char* label, DtRtiApiTimeInterval const* intervalValue) const;
186 
188  virtual int status() const;
189 
190 public:
191 
193  static inline const DtNetMsgHeader* netHeader(const void *buffer);
194 
196  static const char* kindToString(DtRtiMsgKind kind);
197 
199  static const char* kindString(const void *buffer);
200 
202  static unsigned long totalSize(const void* buffer);
203 
205  static const DtRtiMsgKind msgKind(const void *buffer);
206 
208  static unsigned int version(const void* buffer);
209 
211  static unsigned int fedExHandle(const void* buffer);
212 
214  static DtFederateHandle federateHandle(const void* buffer);
215 
217  static unsigned long sequenceNumber(const void* buffer);
218 
220  static unsigned char flags(const void* buffer);
221 
223  static unsigned long metadataSize(const void* buffer);
224 
226  static void setDefaultRegionSet(unsigned long defaultRegionSet);
227 
229  static void setUse32BitsForValueSize(bool use32BitsForValueSizeEnabled);
230  static bool use32BitsForValueSize();
231 
233  static void setSmartForwardingEnabled( bool enabled );
234  static bool smartForwardingEnabled();
235 
237  virtual int timeFieldSize(int encodedLength) const;
238 
240  virtual int tagFieldSize(int encodedLength) const;
241 
242 
243 public:
244  static unsigned long theDefaultRegionSetHandle;
245 #if !defined(DtIFSPEC13)
247 #else
248  static const char* theDefaultTag;
249 #endif
250 
251 protected:
252 
254  DtRtiMsg();
255 
256  virtual DtRtiMsgKind internalDtRtiMsgKind() = 0;
257 
260  virtual void sizeChanged(int size);
261 
263  void initDtRtiMsg(int size, DtRtiMsgKind msgKindVal, DtBufferPtr buffer);
264  void initDtRtiMsg(const void *initial, int size, DtBufferPtr buffer);
265  void initDtRtiMsg(const DtNetMsgHeader *header, DtBufferPtr buffer);
266 
269  virtual void adjustBytes(int offset, int numBytes);
270 
274  virtual void adjustBytes(void *address, int numBytes);
275 
276 protected:
277 
284  unsigned long mySerialNumber;
285  unsigned long myServiceCallNumber;
286  unsigned long myTriggerMessage;
287 
288 protected:
289 
291 
293 };
294 
296 {
297  return (DtNetMsgHeader*) netRep();
298 }
299 
300 inline const DtNetMsgHeader* DtRtiMsg::netHeader(const void *buffer)
301 {
302  return reinterpret_cast<const DtNetMsgHeader*>(buffer);
303 }
304 
306 {
307  return DtRtiMsgKind((DtU32) (DtU8) netHeader()->msgKind);
308 }
309 
310 inline int DtRtiMsg::status() const
311 {
312  return MSG_STATUS_OK;
313 }
314 
316 {
317  return (DtFederateHandle) (DtU16) netHeader()->fedHandle;
318 }
319 
320 
321 inline void DtRtiMsg::adjustBytes(int offset, int numBytes)
322 {
323  if (numBytes > 0)
324  insertBytes(offset, numBytes);
325  else
326  if (numBytes < 0)
327  deleteBytes(offset, -numBytes);
328 }
329 
330 inline void DtRtiMsg::adjustBytes(void *address, int numBytes)
331 {
332  if (numBytes > 0)
333  insertBytes(address, numBytes);
334  else
335  if (numBytes < 0)
336  deleteBytes(address, -numBytes);
337 }
338 
339 #endif
340 
DtRtiMsgKind
Definition: rtiMsgKind.h:9
static const DtRtiApiVariableLengthData theDefaultTag
Definition: rtiMsg.h:246
unsigned long myServiceCallNumber
Definition: rtiMsg.h:285
Definition: netRtiMsgHdr.h:23
bool myConstrained
Definition: rtiMsg.h:282
RTI_API::VariableLengthData DtRtiApiVariableLengthData
Definition: rtiApiTypes.h:95
Definition: fedTimeFactory.h:73
DtNetU16 fedHandle
Definition: netRtiMsgHdr.h:65
virtual void adjustBytes(int offset, int numBytes)
Adjust numBytes bytes at the indicated offset in the net rep.
Definition: rtiMsg.h:321
bool myTimeIsValid
Definition: rtiMsg.h:281
RTI_API::LogicalTime DtRtiApiTime
Typedefs for RTI API types that frequently require conditional precompile directives.
Definition: rtiApiTypes.h:91
static unsigned long theDefaultRegionSetHandle
Definition: rtiMsg.h:244
bool myAllowedDuringSave
Definition: rtiMsg.h:283
unsigned long mySerialNumber
Definition: rtiMsg.h:284
DtRtiMsg is the base class for messages between RTI components.
Definition: rtiMsg.h:34
DtHandle DtFederateHandle
Definition: internalTypes.h:46
DtHandle DtTransportHandle
Definition: internalTypes.h:59
#define MSG_STATUS_OK
Definition: rtiMsg.h:29
virtual DtNetMsgHeader * netHeader() const
Get header of network representation.
Definition: rtiMsg.h:295
static bool theUse32BitsForValueSize
Definition: rtiMsg.h:290
virtual int status() const
Returns MSG_STATUS_OK if OK, a reason enumeration otherwise.
Definition: rtiMsg.h:310
virtual DtRtiMsgKind msgKind() const
Get the message kind.
Definition: rtiMsg.h:305
void insertBytes(std::vector< Octet > &wrapper, size_t length)
Insert bytes into the octet buffer.
Definition: encodingImplHelpers.h:125
unsigned long myTriggerMessage
Definition: rtiMsg.h:286
DtRtiApiTime * myFedTime
Definition: rtiMsg.h:280
#define DT_DLL_LRC
Definition: rtiMsConfig.h:155
RTI_API::LogicalTimeInterval DtRtiApiTimeInterval
Definition: rtiApiTypes.h:92
The declaration of internal types.
static bool theSmartForwardingEnabled
Definition: rtiMsg.h:292
DtOrderHandle myOrderType
Definition: rtiMsg.h:279
DtHandle DtOrderHandle
Definition: internalTypes.h:58
virtual DtFederateHandle federateHandle() const
Set/Get federate handle.
Definition: rtiMsg.h:315
DtTransportHandle myTransportType
Definition: rtiMsg.h:278

Document ID: Generated on Sun Jul 20 16:15:30 EDT 2025 from SVN revision 277985
Copyright © 2005-2025 MAK Technologies Inc. All Rights Reserved (www.mak.com)