VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
byteStream.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2019 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
5 
6 #pragma once
7 
11 
13 
14 #include <vlpi/entityIdentifier.h>
15 #include <vlpi/entityType.h>
16 #include <matrix/vlVector.h>
17 #include <matrix/vlTaitBryan.h>
18 #include <matrix/vlQuaternion.h>
19 
20 #include <vector>
21 #include <string>
22 
23 namespace makVrf
24 {
28 {
29  public:
31  DtStreamReader(unsigned char* buffer, int length, bool makeCopy=false);
32 
34  virtual ~DtStreamReader();
35 
38 
39  virtual bool readBool();
40  virtual char readInt8();
41  virtual unsigned char readUInt8();
42  virtual short readInt16();
43  virtual unsigned short readUInt16();
44  virtual int readInt32();
45  virtual unsigned readUInt32();
46  virtual long long readInt64();
47  virtual unsigned long long readUInt64();
48  virtual float readSingle();
49  virtual double readDouble();
50  virtual std::string readString();
51  virtual DtVector readVector();
52  virtual DtTaitBryan readTaitBryan();
53  DtQuaternion readQuaternion();
54  DtEntityIdentifier readEntityId();
55  DtEntityType readEntityType();
56  //this allocates a new byte array and copies data into it
57  unsigned char* readBytes(int length);
58  //this read from the byte stream into a supplied buffer
59  virtual void readBytes(unsigned char* buffer, int length);
60 
62 
63  protected:
65  int decodeStringSize();
66  unsigned char* myBuffer;
67  unsigned char* myReadHead;
68  int myLength;
70 };
71 
75 {
76  public:
79 
81  DtStreamWriter(unsigned char* buffer, int length);
82 
84  virtual ~DtStreamWriter();
85 
87  //{@
88  virtual unsigned char* buffer();
89  virtual int length();
91 
94 
95  virtual void writeBool(bool b);
96  virtual void writeInt8(char num);
97  virtual void writeUInt8(unsigned char num);
98  virtual void writeInt16(short num);
99  virtual void writeUInt16(unsigned short num);
100  virtual void writeInt32(int num);
101  virtual void writeUInt32(unsigned int num);
102  virtual void writeInt64(long long num);
103  virtual void writeUInt64(unsigned long long num);
104  virtual void writeSingle(float num);
105  virtual void writeDouble(double num);
106  virtual void writeString(std::string& str);
107  virtual void writeVector(DtVector& vec);
108  virtual void writeTaitBryan(DtTaitBryan& tb);
109  virtual void writeQuaternion(const DtQuaternion& q);
110  virtual void writeEntityId(const DtEntityIdentifier& id);
111  virtual void writeEntityType(const DtEntityType& type);
112  virtual void writeBytes(unsigned char* buffer, int length);
114 
115  protected:
117  void encodeStringSize(int size);
118  unsigned char* myBuffer;
119  unsigned char* myWriteHead;
120  int myLength;
122 };
123 
128 {
129  public:
131  DtBigEndianStreamReader(unsigned char* buffer, int length, bool makeCopy = false);
132 
134  virtual ~DtBigEndianStreamReader();
135 
138 
139  virtual short readInt16();
140  virtual unsigned short readUInt16();
141  virtual int readInt32();
142  virtual unsigned readUInt32();
143  virtual long long readInt64();
144  virtual unsigned long long readUInt64();
145  virtual float readSingle();
146  virtual double readDouble();
148 
149  protected:
150 };
151 
155 {
156  public:
159 
161  DtBigEndianStreamWriter(unsigned char* buffer, int length);
162 
164  virtual ~DtBigEndianStreamWriter();
165 
168 
169  void writeInt16(short num);
170  void writeUInt16(unsigned short num);
171  void writeInt32(int num);
172  void writeUInt32(unsigned int num);
173  void writeInt64(long long num);
174  void writeUInt64(unsigned long long num);
175  void writeSingle(float num);
176  void writeDouble(double num);
178 
179  protected:
180 };
181 
184 }
Instances of DtStreamWriter encode values into a byte array The data will be written to the stream in...
Definition: byteStream.h:154
bool myShouldDelete
Definition: byteStream.h:121
#define DT_DLL_DEBUGDRAWCONNECTOR
Definition: export.h:15
DT_DLL_DEBUGDRAWCONNECTOR int DtEncodedStringLength(std::string str)
Get the size in bytes of the string when it is encoded.
voidpf void uLong size
Definition: ioapi.h:39
Instances of DtStreamReader decode values from a byte array this assumes the data in the byte stream ...
Definition: byteStream.h:27
int myLength
Definition: byteStream.h:68
unsigned char * myWriteHead
Definition: byteStream.h:119
Instances of DtStreamReader decode values from a byte array The data in the stream is expected to be ...
Definition: byteStream.h:127
Instances of DtStreamWriter encode values into a byte array this writes the data to the stream in lit...
Definition: byteStream.h:74
unsigned char * myReadHead
Definition: byteStream.h:67
int myLength
Definition: byteStream.h:120
unsigned char * myBuffer
Definition: byteStream.h:66
bool myShouldDelete
Definition: byteStream.h:69
DT_DLL_VRVCORE double length(const makVrv::DtCoordinateSystem &, const std::vector< DtVector > &vertices)
Returns the total distance of a segmented line defined by the provided vector of vertices. Coordinates are in local database coordinates. The coordinate system is used to convert between the local database coordinates and geocentric. All distance is in 2D – the Z value is ignored.
unsigned char * myBuffer
Definition: byteStream.h:118

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)