VR-Link API Documentation for HLA Evolved
diGuyCustomPdu.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992-2013 VT MAK
3 ** All rights reserved.
4 *********************************************************************/
5 
6 #pragma once
7 
8 #if DtDIS
9 
10 #include <vl/stateMsgDIS.h>
11 #include <vl/exerciseConnDIS.h>
12 #include <vlpi/entityIdentifier.h>
13 
14 
16 typedef struct DtNetDIGuyCustomPdu
17 {
18  DtNetPduHeader DtHeader;
19  DtNetU16 DtDIGuyMessageVersion;
20  DtNetU16 DtDIGuyMessageId;
21  DtNetEntityIdentifier DtEntityId;
22  DtNetU8 DtDataSize;
23  DtNetU8 DtData[1];
24 } DtNetDIGuyCustomPdu;
25 
27 enum DtDIGuyCustomPduMsgId
28 {
29  DtDIGuyMsgIdEscapeReserved = 0,
30  DtDIGuyMsgIdSetCharType = 1,
31  DtDIGuyMsgIdSetCharAppearance = 2,
32  DtDIGuyMsgIdSetCharAction = 3,
33  DtDIGuyMsgIdSetCharVisible = 4
34 };
35 
36 class DtDIGuyCustomPdu;
37 
40 typedef void (*DtDIGuyCustomPduCb)(DtDIGuyCustomPdu* pdu, void* usr);
41 
45 class DT_DLL_VL DtDIGuyCustomPdu : public DtStateMsg
46 {
47 public:
49  enum { PduStaticSize = 23 };
50 
51 public:
54  DtDIGuyCustomPdu(DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER);
55 
57  DtDIGuyCustomPdu(const DtNetDIGuyCustomPdu* initial,
58  DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER, DtPduFactory* pduFactory = 0);
59 
61  virtual ~DtDIGuyCustomPdu();
62 
64  DtDIGuyCustomPdu(const DtDIGuyCustomPdu& other);
65 
67  DtDIGuyCustomPdu& operator=(const DtDIGuyCustomPdu& other);
68 
69  //{@
71  virtual DtNetDIGuyCustomPdu* netDIGuyCustomPdu();
72  virtual const DtNetDIGuyCustomPdu* netDIGuyCustomPdu() const;
74 
75  // MJI - I think this should always be 7, according to the SDK
76  // User's Guide. Going to set it to 7 by default for now, and
77  // this probably shouldn't be changed.
78  //{@
81  virtual void setMessageVersion(int version);
82  virtual int messageVersion() const;
84 
85  //{@
87  virtual void setMessageId(DtDIGuyCustomPduMsgId msgId);
88  virtual DtDIGuyCustomPduMsgId messageId() const;
90 
91  //{@
93  virtual void setEntityId(const DtEntityIdentifier& entId);
94  virtual DtEntityIdentifier entityId() const;
96 
97  //{@
99  virtual void setDataSize(unsigned int size);
100  virtual unsigned int dataSize() const;
102 
106  virtual void addShort(short value);
107 
111  virtual void addLong(long value);
112 
116  virtual void addFloat(float value);
117 
122  virtual void addString(const DtString& str);
123 
124  //{@
137  virtual bool pullShort(short& value, unsigned int& byteoffset) const;
138  virtual bool pullLong(long& value, unsigned int& byteoffset) const;
139  virtual bool pullFloat(float& value, unsigned int& byteoffset) const;
140  virtual bool pullString(DtString& value, unsigned int& byteoffset) const;
142 
143  //{@
145  virtual void getData(unsigned char* buff) const;
146  virtual void* data();
147  void setData(unsigned char* data, int numBytes);
149 
151  virtual void printData() const;
152 
154  virtual void printDataToStream(std::ostream& stream) const;
155 
156 
157 public:
159  static DtPdu* create(const DtNetPacket* initial,
160  DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER, DtPduFactory* pduFactory = 0);
161 
163  static void addCallback(DtExerciseConn* conn, DtDIGuyCustomPduCb cb,
164  void* usr);
165 
167  static void removeCallback(DtExerciseConn* conn, DtDIGuyCustomPduCb cb,
168  void* usr);
169 
174  static void setCustomPduKind(DtPduKind pduKind);
175  static DtPduKind customPduKind();
176 
177 protected:
178  virtual DtPduKind internalGetPduKind() const;
179 
180 protected:
181  static DtPduKind theCustomPduKind;
182 };
183 
184 
185 #endif

Document ID: Generated on Wed Oct 23 22:25:48 EDT 2013 from SVN revision 132765
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)