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 #define DtAssistantMessageVersion 16
45 
47 {
98 
99  // Assistant to Assistant messages
109 
115 };
116 
118 {
129 };
130 
131 // These status are sent by the Forwarder to Assistants.
132 // When a forwarder sends its state msg, it has a vector of clientStatus.
134 {
139 };
140 
142 class DT_DLL_ASSISTANT DtAssistantMsg : public MAKRti::DtBaseMsg
143 {
144 public:
145 
147  virtual ~DtAssistantMsg();
148 
152  virtual DtAssistantMsg* clone(bool copy = true) const=0;
153 
155  virtual DtNetAssistantMsgHeader* netHeader() const;
156 
158  virtual int version() const;
159 
161  virtual bool isValidVersion() const;
162 
164  virtual DtAssistantMsgKind msgKind() const;
165 
167  virtual void print() const;
168  virtual void printHeader() const;
169  virtual void printData() const;
170 
172  virtual bool isOk() const;
173 
176  bool isAssistantToAssistantMessage() const;
177 
180  virtual MAKRti::DtInetAddr sourceAddr() const;
181  virtual void setSourceAddr(const MAKRti::DtInetAddr& addr);
182 
185  virtual int sourceId() const;
186  virtual void setSourceId(int id);
187 
190  virtual MAKRti::DtString sourceHost() const;
191  virtual void setSourceHost(const MAKRti::DtString& addr);
192 
195  virtual MAKRti::DtInetAddr destAddr() const;
196  virtual void setDestAddr(const MAKRti::DtInetAddr& addr);
197 
200  virtual int destId() const;
201  virtual void setDestId(int id);
202 
205  virtual int compId() const;
206  virtual void setCompId( int compId );
207 
208 public:
209 
211  static const char* kindToString(DtAssistantMsgKind kind);
212 
213 protected:
214 
216  DtAssistantMsg();
217 
218  virtual DtAssistantMsgKind internalMsgKind() = 0;
219 
222  virtual void sizeChanged(int size);
223 
225  void initAssistantMsg(int size, DtAssistantMsgKind msgKindVal, DtBufferPtr buffer);
226  void initAssistantMsg(const void *initial, int size, DtBufferPtr buffer);
227  void initAssistantMsg(const DtNetAssistantMsgHeader *header, DtBufferPtr buffer);
228 
231  virtual void adjustBytes(int offset, int numBytes);
232 
236  virtual void adjustBytes(void *address, int numBytes);
237 
240  virtual void resizeForSrcDestInfo();
241 
244  virtual const DtNetAssistantSrcDestInfo* srcDestInfoPtr() const;
245  virtual DtNetAssistantSrcDestInfo* srcDestInfoPtr();
246 
248  virtual void setSourceHostSize( unsigned long size );
249  virtual unsigned long sourceHostSize() const;
250 
252  virtual const char* sourceHostPtr() const;
253  virtual char* sourceHostPtr();
254 
255 };
256 
258 {
259  return (DtNetAssistantMsgHeader*) netRep();
260 }
261 
263 {
264  return DtAssistantMsgKind((DtU32) (DtU8) netHeader()->msgKind);
265 }
266 
267 inline bool DtAssistantMsg::isOk() const
268 {
269  return true;
270 }
271 
272 inline void DtAssistantMsg::adjustBytes(int offset, int numBytes)
273 {
274  if (numBytes > 0)
275  {
276  insertBytes(offset, numBytes);
277  }
278  else if (numBytes < 0)
279  {
280  deleteBytes(offset, -numBytes);
281  }
282 }
283 
284 inline void DtAssistantMsg::adjustBytes(void *address, int numBytes)
285 {
286  if (numBytes > 0)
287  {
288  insertBytes(address, numBytes);
289  }
290  else if (numBytes < 0)
291  {
292  deleteBytes(address, -numBytes);
293  }
294 }
295 
296 #endif
297 

Document ID: Generated on Tue May 7 16:26:47 EDT 2013 from SVN revision 126903
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)