VR-Link API Documentation for HLA 1516
 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
Contains the DtEntityIdentifier class declaration.
unsigned char * myBuffer
Definition: byteStream.h:66
Contains the DtEntityType and DtRadioEntityType class declarations.
This file contains the definition of DtQuaternion as well as many functions which operate on DtQuater...
unsigned char * myBuffer
Definition: byteStream.h:119
DtTaitBryans are used to represent orientation of an object, using a set of three Euler angles...
Definition: vlTaitBryan.h:43
unsigned char * myWriteHead
Definition: byteStream.h:120
This file declares DtVector and DtVector32.
Definition: vlVector.h:224
This file declares DtTaitBryan.
Instances of DtStreamWriter encode values into a byte array.
Definition: byteStream.h:74
bool myBufferAlloced
Definition: byteStream.h:69
Instances of DtEntityIdentifier are used as a unique ID for entities in DIS.
Definition: entityIdentifier.h:31
Quaternions are used to represent orientation of an object.
Definition: vlQuaternion.h:30
unsigned char * myReadHead
Definition: byteStream.h:67
#define DT_DLL_VLPROTIND
Definition: vlMachineTypes.h:110
int myLength
Definition: byteStream.h:68
int DT_DLL_VLPROTIND DtEncodedStringSize(const std::string &str)
Instances of DtStreamReader decode values from a byte array.
Definition: byteStream.h:31
bool myBufferAlloced
Definition: byteStream.h:122
int myLength
Definition: byteStream.h:121
DtEntityType is used to represent the type an entity object.
Definition: entityType.h:26

Document ID: Generated on Mon Apr 25 03:39:01 EDT 2022 from SVN revision 242502
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)