VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
managedInterface/messages/attributeChangeRequest.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 <vector>
15 
16 
18 {
19 public:
20 
21 
23  {
24  std::string myName;
25  std::vector<unsigned char> myValue;
26 
27 
28  int size()
29  {
30  int size=0;
31  size+=myName.size() < 128 ? 1 : 2;
32  size+=myName.size();
33 
34  size+=4; //for the count of the items in the list
35  for(unsigned int i=0; i<myValue.size(); i++)
36  {
37  size+=sizeof(unsigned char);
38  }
39 
40 
41  return size;
42  }
43 
44  void serialize(DtStreamWriter& writer)
45  {
46  writer.writeString(myName);
47  writer.writeInt32(myValue.size()); //for the count of the items in the list
48  for(unsigned int i=0; i<myValue.size(); i++)
49  {
50  writer.writeUInt8(myValue[i]);
51  }
52 
53 
54  }
55 
57  {
58  myName=reader.readString();
59  unsigned int myValue_count=reader.readInt32(); //for the count of the items in the list
60  for(unsigned int i=0; i<myValue_count; i++)
61  {
62  unsigned char abyte;
63  abyte=reader.readUInt8();
64  myValue.push_back(abyte);
65  }
66 
67  }
68  };
69 
70 
71 
72 
75 
76  virtual std::vector<std::string> getObjectIdentifiers();
77  virtual void setObjectIdentifiers(std::vector<std::string> val);
78 
79  virtual std::vector<AttributePair> getAttributes();
80  virtual void setAttributes(std::vector<AttributePair> val);
81 
82 
83 
84  virtual int messageSize();
85 
86  static DtMessage* decode(unsigned char* buffer, int length);
87  static std::string theMessageName();
88 
89 protected:
90  static std::string theFullName;
91 
92  std::vector<std::string> myObjectIdentifiers;
93  std::vector<AttributePair> myAttributes;
94 
95  virtual void serialize(DtStreamWriter& writer);
96  virtual void deserialize(DtStreamReader& reader);
97 };
Definition: managedInterface/messages/attributeChangeRequest.h:17
unsigned char readUInt8()
value readers return a value and increment the current position in the byte stream based on the size ...
virtual int messageSize()
this function needs to be in each derived class for decoding
#define MANAGEDINTERFACE_DLL
Definition: plugin.h:15
std::vector< AttributePair > myAttributes
Definition: managedInterface/messages/attributeChangeRequest.h:93
void serialize(DtStreamWriter &writer)
Definition: managedInterface/messages/attributeChangeRequest.h:44
Definition: managedInterface/messages/attributeChangeRequest.h:22
Defines the base class for all messages that are sent to and from C#.
This is the DtMessage class.
Definition: message.h:20
std::string myName
Definition: managedInterface/messages/attributeChangeRequest.h:24
std::vector< unsigned char > myValue
Definition: managedInterface/messages/attributeChangeRequest.h:25
std::string readString()
value readers return a value and increment the current position in the byte stream based on the size ...
void writeString(const std::string &str)
value readers return a value and increment the current position in the byte stream based on the size ...
int readInt32()
value readers return a value and increment the current position in the byte stream based on the size ...
Instances of DtStreamWriter encode values into a byte array.
Definition: byteStream.h:74
void deserialize(DtStreamReader &reader)
Definition: managedInterface/messages/attributeChangeRequest.h:56
Instances of DtStreamReader decode values from a byte array.
Definition: byteStream.h:31
static std::string theFullName
Definition: managedInterface/messages/attributeChangeRequest.h:90
virtual void serialize(DtStreamWriter &writer)
std::vector< std::string > myObjectIdentifiers
Definition: managedInterface/messages/attributeChangeRequest.h:92
int size()
Definition: managedInterface/messages/attributeChangeRequest.h:28
void writeUInt8(unsigned char num)
value readers return a value and increment the current position in the byte stream based on the size ...
virtual void deserialize(DtStreamReader &reader)
void writeInt32(int num)
value readers return a value and increment the current position in the byte stream based on the size ...

Document ID: Generated on Tue Aug 10 00:12:31 EDT 2021 from SVN revision 232765
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)