VR-Link API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
managedInterface/messages/data.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
5 
10 #pragma once
11 
13 
14 #include <string>
15 #include <vector>
16 
17 
19 {
20 public:
21 
22 
23  struct VariableData
24  {
25  int myDatumId;
26  std::vector<unsigned char> myData;
27 
28 
29  int size()
30  {
31  int size=0;
32  size+=sizeof(int);
33  size+=4; //for the count of the items in the list
34  for(unsigned int i=0; i<myData.size(); i++)
35  {
36  size+=sizeof(unsigned char);
37  }
38 
39 
40  return size;
41  }
42 
43  void serialize(DtStreamWriter& writer)
44  {
45  writer.writeInt32(myDatumId);
46  writer.writeInt32(myData.size()); //for the count of the items in the list
47  for(unsigned int i=0; i<myData.size(); i++)
48  {
49  writer.writeUInt8(myData[i]);
50  }
51 
52 
53  }
54 
55  void deserialize(DtStreamReader& reader)
56  {
57  myDatumId=reader.readInt32();
58  unsigned int myData_count=reader.readInt32(); //for the count of the items in the list
59  for(unsigned int i=0; i<myData_count; i++)
60  {
61  unsigned char abyte;
62  abyte=reader.readUInt8();
63  myData.push_back(abyte);
64  }
65 
66  }
67  };
68 
69 
70  struct FixedData
71  {
72  int myDatumId;
73  int myData;
74 
75 
76  int size()
77  {
78  int size=0;
79  size+=sizeof(int);
80  size+=sizeof(int);
81 
82  return size;
83  }
84 
85  void serialize(DtStreamWriter& writer)
86  {
87  writer.writeInt32(myDatumId);
88  writer.writeInt32(myData);
89 
90  }
91 
92  void deserialize(DtStreamReader& reader)
93  {
94  myDatumId=reader.readInt32();
95  myData=reader.readInt32();
96 
97  }
98  };
99 
100 
101 
102 
103  DataMessage();
104  virtual ~DataMessage();
105 
106  virtual std::string getSenderId();
107  virtual void setSenderId(std::string val);
108 
109  virtual std::string getReceiverId();
110  virtual void setReceiverId(std::string val);
111 
112  virtual unsigned int getRequestId();
113  virtual void setRequestId(unsigned int val);
114 
115  virtual std::vector<FixedData> getFixedData();
116  virtual void setFixedData(std::vector<FixedData> val);
117 
118  virtual std::vector<VariableData> getVariableData();
119  virtual void setVariableData(std::vector<VariableData> val);
120 
121 
122 
123  virtual int messageSize();
124 
125  static DtMessage* decode(unsigned char* buffer, int length);
126  static std::string theMessageName();
127 
128 protected:
129  static std::string theFullName;
130 
131  std::string mySenderId;
132  std::string myReceiverId;
133  unsigned int myRequestId;
134  std::vector<FixedData> myFixedData;
135  std::vector<VariableData> myVariableData;
136 
137  virtual void serialize(DtStreamWriter& writer);
138  virtual void deserialize(DtStreamReader& reader);
139 };

Document ID: Generated on Thu Feb 22 04:26:36 EST 2018 from SVN revision 186468
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)