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 #define DtAssistantMessageVersion 18
47 
49 {
100 
101  // Assistant to Assistant messages
111 
117 };
118 
120 {
131 };
132 
133 // These status are sent by the Forwarder to Assistants.
134 // When a forwarder sends its state msg, it has a vector of clientStatus.
136 {
141 };
142 
144 class DT_DLL_ASSISTANT DtAssistantMsg : public MAKRti::DtBaseMsg
145 {
146 public:
147 
149  virtual ~DtAssistantMsg();
150 
154  virtual DtAssistantMsg* clone(bool copy = true) const=0;
155 
157  virtual DtNetAssistantMsgHeader* netHeader() const;
158 
160  virtual int version() const;
161 
163  virtual bool isValidVersion() const;
164 
166  virtual DtAssistantMsgKind msgKind() const;
167 
169  virtual void print() const;
170  virtual void printHeader() const;
171  virtual void printData() const;
172 
174  virtual bool isOk() const;
175 
178  bool isAssistantToAssistantMessage() const;
179 
182  virtual MAKRti::DtInetAddr sourceAddr() const;
183  virtual void setSourceAddr(const MAKRti::DtInetAddr& addr);
184 
187  virtual int sourceId() const;
188  virtual void setSourceId(int id);
189 
192  virtual MAKRti::DtString sourceHost() const;
193  virtual void setSourceHost(const MAKRti::DtString& addr);
194 
197  virtual MAKRti::DtInetAddr destAddr() const;
198  virtual void setDestAddr(const MAKRti::DtInetAddr& addr);
199 
202  virtual int destId() const;
203  virtual void setDestId(int id);
204 
207  virtual int compId() const;
208  virtual void setCompId( int compId );
209 
210 public:
211 
213  static const char* kindToString(DtAssistantMsgKind kind);
214 
215 protected:
216 
218  DtAssistantMsg();
219 
220  virtual DtAssistantMsgKind internalMsgKind() = 0;
221 
224  virtual void sizeChanged(int size);
225 
227  void initAssistantMsg(int size, DtAssistantMsgKind msgKindVal, DtBufferPtr buffer);
228  void initAssistantMsg(const void *initial, int size, DtBufferPtr buffer);
229  void initAssistantMsg(const DtNetAssistantMsgHeader *header, DtBufferPtr buffer);
230 
233  virtual void adjustBytes(int offset, int numBytes);
234 
238  virtual void adjustBytes(void *address, int numBytes);
239 
242  virtual void resizeForSrcDestInfo();
243 
246  virtual const DtNetAssistantSrcDestInfo* srcDestInfoPtr() const;
247  virtual DtNetAssistantSrcDestInfo* srcDestInfoPtr();
248 
250  virtual void setSourceHostSize( unsigned long size );
251  virtual unsigned long sourceHostSize() const;
252 
254  virtual const char* sourceHostPtr() const;
255  virtual char* sourceHostPtr();
256 
257 };
258 
260 {
261  return (DtNetAssistantMsgHeader*) netRep();
262 }
263 
265 {
266  return DtAssistantMsgKind((DtU32) (DtU8) netHeader()->msgKind);
267 }
268 
269 inline bool DtAssistantMsg::isOk() const
270 {
271  return true;
272 }
273 
274 inline void DtAssistantMsg::adjustBytes(int offset, int numBytes)
275 {
276  if (numBytes > 0)
277  {
278  insertBytes(offset, numBytes);
279  }
280  else if (numBytes < 0)
281  {
282  deleteBytes(offset, -numBytes);
283  }
284 }
285 
286 inline void DtAssistantMsg::adjustBytes(void *address, int numBytes)
287 {
288  if (numBytes > 0)
289  {
290  insertBytes(address, numBytes);
291  }
292  else if (numBytes < 0)
293  {
294  deleteBytes(address, -numBytes);
295  }
296 }
297 
298 #endif
299 

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)