5 #ifndef _dcl_dis_data_stream_h_ 6 #define _dcl_dis_data_stream_h_ 12 #pragma warning( push ) 13 #pragma warning( disable : 4251 ) 18 #include <dis6/utils/Endian.h> 19 #include <dis6/opendis6_export.h> 40 DataStream(
const char* buffer,
size_t length, Endian stream);
45 const char& operator [](
unsigned int offset)
const;
48 void SetStream(
const char* buffer,
size_t length, Endian order);
72 DataStream& operator >>(
unsigned long long& c);
76 Endian GetStreamEndian()
const;
77 Endian GetMachineEndian()
const;
79 size_t GetWritePos()
const;
80 size_t GetReadPos()
const;
89 template<
typename T,
typename IterT>
90 void IncrementPointer(IterT& iter)
95 template<
typename T,
typename IterT>
96 void DecrementPointer(IterT& iter)
104 void WriteAlgorithm(T t)
106 char* ch =
reinterpret_cast<char*
>( &t );
107 DoFlip( ch ,
sizeof(T) );
108 DoWrite( ch ,
sizeof(T) );
109 IncrementPointer<T>( _write_pos );
115 void ReadAlgorithm(T& t)
118 DoRead( ch ,
sizeof(T) );
119 DoFlip( ch ,
sizeof(T) );
120 memcpy(&t, ch,
sizeof(t));
121 IncrementPointer<T>( _read_pos );
125 void DoFlip(
char* buf,
size_t bufsize);
127 void DoWrite(
const char* buf,
size_t bufsize);
129 void DoRead(
char* ch,
size_t bufsize);
132 typedef std::vector<char> BufferType;
142 Endian _stream_endian;
145 Endian _machine_endian;
150 #pragma warning( pop ) 153 #endif // _dcl_dis_data_stream_h_ Symbolic names as defined in 5.1.4.
Definition: AcknowledgePdu.h:8
a class to support managing a network buffer.
Definition: DataStream.h:28