MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 // RTI 4.4 DtAssistantMessageVersion = 18
46 // RTI 4.4.1 DtAssistantMessageVersion = 19
47 #define DtAssistantMessageVersion 19
48 
50 {
101 
102  // Assistant to Assistant messages
112 
118 };
119 
121 {
132 };
133 
134 // These status are sent by the Forwarder to Assistants.
135 // When a forwarder sends its state msg, it has a vector of clientStatus.
137 {
142 };
143 
145 class DT_DLL_ASSISTANT DtAssistantMsg : public MAKRti::DtBaseMsg
146 {
147 public:
148 
150  virtual ~DtAssistantMsg();
151 
155  virtual DtAssistantMsg* clone(bool copy = true) const=0;
156 
158  virtual DtNetAssistantMsgHeader* netHeader() const;
159 
161  virtual int version() const;
162 
164  virtual bool isValidVersion() const;
165 
167  virtual DtAssistantMsgKind msgKind() const;
168 
170  virtual void print() const;
171  virtual void printHeader() const;
172  virtual void printData() const;
173 
175  virtual bool isOk() const;
176 
179  bool isAssistantToAssistantMessage() const;
180 
183  virtual MAKRti::DtInetAddr sourceAddr() const;
184  virtual void setSourceAddr(const MAKRti::DtInetAddr& addr);
185 
188  virtual int sourceId() const;
189  virtual void setSourceId(int id);
190 
193  virtual MAKRti::DtString sourceHost() const;
194  virtual void setSourceHost(const MAKRti::DtString& addr);
195 
198  virtual MAKRti::DtInetAddr destAddr() const;
199  virtual void setDestAddr(const MAKRti::DtInetAddr& addr);
200 
203  virtual int destId() const;
204  virtual void setDestId(int id);
205 
208  virtual int compId() const;
209  virtual void setCompId( int compId );
210 
211 public:
212 
214  static const char* kindToString(DtAssistantMsgKind kind);
215 
216 protected:
217 
219  DtAssistantMsg();
220 
221  virtual DtAssistantMsgKind internalMsgKind() = 0;
222 
225  virtual void sizeChanged(int size);
226 
228  void initAssistantMsg(int size, DtAssistantMsgKind msgKindVal, DtBufferPtr buffer);
229  void initAssistantMsg(const void *initial, int size, DtBufferPtr buffer);
230  void initAssistantMsg(const DtNetAssistantMsgHeader *header, DtBufferPtr buffer);
231 
234  virtual void adjustBytes(int offset, int numBytes);
235 
239  virtual void adjustBytes(void *address, int numBytes);
240 
243  virtual void resizeForSrcDestInfo();
244 
247  virtual const DtNetAssistantSrcDestInfo* srcDestInfoPtr() const;
248  virtual DtNetAssistantSrcDestInfo* srcDestInfoPtr();
249 
251  virtual void setSourceHostSize( unsigned long size );
252  virtual unsigned long sourceHostSize() const;
253 
255  virtual const char* sourceHostPtr() const;
256  virtual char* sourceHostPtr();
257 
258 };
259 
261 {
262  return (DtNetAssistantMsgHeader*) netRep();
263 }
264 
266 {
267  return DtAssistantMsgKind((DtU32) (DtU8) netHeader()->msgKind);
268 }
269 
270 inline bool DtAssistantMsg::isOk() const
271 {
272  return true;
273 }
274 
275 inline void DtAssistantMsg::adjustBytes(int offset, int numBytes)
276 {
277  if (numBytes > 0)
278  {
279  insertBytes(offset, numBytes);
280  }
281  else if (numBytes < 0)
282  {
283  deleteBytes(offset, -numBytes);
284  }
285 }
286 
287 inline void DtAssistantMsg::adjustBytes(void *address, int numBytes)
288 {
289  if (numBytes > 0)
290  {
291  insertBytes(address, numBytes);
292  }
293  else if (numBytes < 0)
294  {
295  deleteBytes(address, -numBytes);
296  }
297 }
298 
299 #endif
300 

Document ID: Generated on Mon Mar 21 09:41:37 EDT 2016 from SVN revision 163228
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (www.mak.com)