MAK RTIspy API Documentation for HLA 1516
assistantMsg.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1998 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: assistantMsg.h,v $ $Revision: 1.41 $ $State: Exp $
7 *********************************************************************/
8 
11 
12 #ifndef DtAssistantMsg_H_
13 #define DtAssistantMsg_H_
14 
15 #include <memory>
16 
17 #include <vlutil/vlBaseMsg.h>
18 #include <vlutil/vlString.h>
19 #include <vlutil/vlInetAddr.h>
20 
21 #include <internalTypes.h>
22 
23 #include "netAssistantMsgHdr.h"
24 
26 
27 // Default port for all assistant communication
28 // When this is changed you must also update DtRIDParameters::verifyPortsAreUnique
29 #define DtASSISTANT_DEFAULT_PORT 6003
30 
31 // Default destination id (everyone)
32 #define DtASSISTANT_DEFAULT_DEST_ID 0
33 
34 // Default multicast address for communication between assistants
35 #define DtASSISTANT_DEFAULT_IPV4_ADDR "229.7.7.10"
36 #define DtASSISTANT_DEFAULT_IPV6_ADDR "ff12::7:10"
37 
38 // Default TTL for all assistant communication
39 #define DtASSISTANT_DEFAULT_TTL 1
40 
41 // RTI 4.1.1 DtAssistantMessageVersion = 14
42 // RTI 4.2pr DtAssistantMessageVersion = 15 (pre-release)
43 // RTI 4.2 DtAssistantMessageVersion = 16
44 // RTI 4.3 DtAssistantMessageVersion = 17
45 #define DtAssistantMessageVersion 17
46 
48 {
99 
100  // Assistant to Assistant messages
110 
116 };
117 
119 {
130 };
131 
132 // These status are sent by the Forwarder to Assistants.
133 // When a forwarder sends its state msg, it has a vector of clientStatus.
135 {
140 };
141 
143 class DT_DLL_ASSISTANT DtAssistantMsg : public MAKRti::DtBaseMsg
144 {
145 public:
146 
148  virtual ~DtAssistantMsg();
149 
153  virtual DtAssistantMsg* clone(bool copy = true) const=0;
154 
156  virtual DtNetAssistantMsgHeader* netHeader() const;
157 
159  virtual int version() const;
160 
162  virtual bool isValidVersion() const;
163 
165  virtual DtAssistantMsgKind msgKind() const;
166 
168  virtual void print() const;
169  virtual void printHeader() const;
170  virtual void printData() const;
171 
173  virtual bool isOk() const;
174 
177  bool isAssistantToAssistantMessage() const;
178 
181  virtual MAKRti::DtInetAddr sourceAddr() const;
182  virtual void setSourceAddr(const MAKRti::DtInetAddr& addr);
183 
186  virtual int sourceId() const;
187  virtual void setSourceId(int id);
188 
191  virtual MAKRti::DtString sourceHost() const;
192  virtual void setSourceHost(const MAKRti::DtString& addr);
193 
196  virtual MAKRti::DtInetAddr destAddr() const;
197  virtual void setDestAddr(const MAKRti::DtInetAddr& addr);
198 
201  virtual int destId() const;
202  virtual void setDestId(int id);
203 
206  virtual int compId() const;
207  virtual void setCompId( int compId );
208 
209 public:
210 
212  static const char* kindToString(DtAssistantMsgKind kind);
213 
214 protected:
215 
217  DtAssistantMsg();
218 
219  virtual DtAssistantMsgKind internalMsgKind() = 0;
220 
223  virtual void sizeChanged(int size);
224 
226  void initAssistantMsg(int size, DtAssistantMsgKind msgKindVal, DtBufferPtr buffer);
227  void initAssistantMsg(const void *initial, int size, DtBufferPtr buffer);
228  void initAssistantMsg(const DtNetAssistantMsgHeader *header, DtBufferPtr buffer);
229 
232  virtual void adjustBytes(int offset, int numBytes);
233 
237  virtual void adjustBytes(void *address, int numBytes);
238 
241  virtual void resizeForSrcDestInfo();
242 
245  virtual const DtNetAssistantSrcDestInfo* srcDestInfoPtr() const;
246  virtual DtNetAssistantSrcDestInfo* srcDestInfoPtr();
247 
249  virtual void setSourceHostSize( unsigned long size );
250  virtual unsigned long sourceHostSize() const;
251 
253  virtual const char* sourceHostPtr() const;
254  virtual char* sourceHostPtr();
255 
256 };
257 
259 {
260  return (DtNetAssistantMsgHeader*) netRep();
261 }
262 
264 {
265  return DtAssistantMsgKind((DtU32) (DtU8) netHeader()->msgKind);
266 }
267 
268 inline bool DtAssistantMsg::isOk() const
269 {
270  return true;
271 }
272 
273 inline void DtAssistantMsg::adjustBytes(int offset, int numBytes)
274 {
275  if (numBytes > 0)
276  {
277  insertBytes(offset, numBytes);
278  }
279  else if (numBytes < 0)
280  {
281  deleteBytes(offset, -numBytes);
282  }
283 }
284 
285 inline void DtAssistantMsg::adjustBytes(void *address, int numBytes)
286 {
287  if (numBytes > 0)
288  {
289  insertBytes(address, numBytes);
290  }
291  else if (numBytes < 0)
292  {
293  deleteBytes(address, -numBytes);
294  }
295 }
296 
297 #endif
298 

Document ID: Generated on Fri Mar 14 19:08:55 EDT 2014 from SVN revision 137085
Copyright © 2005-2014 VT MÄK Inc. All Rights Reserved (www.mak.com)