VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 {
25 
28 {
34 };
35 
36 class DtDIGuyCustomPdu;
37 
40 typedef void (*DtDIGuyCustomPduCb)(DtDIGuyCustomPdu* pdu, void* usr);
41 
46 {
47 public:
49  enum { PduStaticSize = 23 };
50 
51 public:
55 
58  DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER, DtPduFactory* pduFactory = 0);
59 
61  virtual ~DtDIGuyCustomPdu();
62 
64  DtDIGuyCustomPdu(const DtDIGuyCustomPdu& other);
65 
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:
182 };
183 
184 
185 #endif

Document ID: Generated on Fri May 15 06:36:13 EDT 2015 from SVN revision 153263
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)