VR-Link API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
byteStream.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
8 #pragma once
9 
11 
12 #include <vlpi/entityIdentifier.h>
13 #include <vlpi/entityType.h>
14 #include <matrix/vlVector.h>
15 #include <matrix/vlTaitBryan.h>
16 #include <matrix/vlQuaternion.h>
17 
18 #include <vector>
19 #include <string>
20 
21 #ifdef DtUSE_UTILITIES_NAMESPACE
22 namespace DtUSE_UTILITIES_NAMESPACE
23 {
24 #endif
25 
26 
27 int DT_DLL_VLPROTIND DtEncodedStringSize(const std::string& str);
28 
32 {
33 public:
35  DtStreamReader(unsigned char* buffer, int length, bool copyInternally=true);
36 
38  virtual ~DtStreamReader();
39 
42 
43  bool readBool();
44  char readInt8();
45  unsigned char readUInt8();
46  short readInt16();
47  unsigned short readUInt16();
48  int readInt32();
49  unsigned int readUInt32();
50  long long readInt64();
51  unsigned long long readUInt64();
52  float readSingle();
53  double readDouble();
54  std::string readString();
55  DtVector readVector();
56  DtTaitBryan readTaitBryan();
57  DtQuaternion readQuaternion();
58  DtEntityIdentifier readEntityId();
59  DtEntityType readEntityType();
60  unsigned char* readBytes(int length);
62 
63 protected:
65  int decodeStringSize();
66  unsigned char* myBuffer;
67  unsigned char* myReadHead;
68  int myLength;
70 };
71 
75 {
76 public:
78  DtStreamWriter(int length=0);
79 
82  DtStreamWriter(unsigned char* buffer, int length);
83 
85  virtual ~DtStreamWriter();
86 
88  //{@
89  unsigned char* buffer();
90  int length();
92 
95 
96  void writeBool(bool b);
97  void writeInt8(char num);
98  void writeUInt8(unsigned char num);
99  void writeInt16(short num);
100  void writeUInt16(unsigned short num);
101  void writeInt32(int num);
102  void writeUInt32(unsigned int num);
103  void writeInt64(long long num);
104  void writeUInt64(unsigned long long num);
105  void writeSingle(float num);
106  void writeDouble(double num);
107  void writeString(const std::string& str);
108  void writeVector(const DtVector& vec);
109  void writeTaitBryan(const DtTaitBryan& tb);
110  void writeQuaternion(const DtQuaternion& q);
111  void writeEntityId(const DtEntityIdentifier& id);
112  void writeEntityType(const DtEntityType& type);
113  void writeBytes(unsigned char* bytes, int length);
115 
116 protected:
118  void encodeStringSize(int size);
119  unsigned char* myBuffer;
120  unsigned char* myWriteHead;
121  int myLength;
123 };
124 
125 
126 #ifdef DtUSE_UTILITIES_NAMESPACE
127 }
128 #endif

Document ID: Generated on Mon Jun 22 21:18:40 EDT 2020 from SVN revision 213785
Copyright © 2005-2018 MAK Technologies. All Rights Reserved (www.mak.com)