Unigine::Stream Class
Interface for data serialization.
To use this class, include the UnigineStream.h file.
Unigine::Stream Class
Members
virtual ~Stream ()
Virtual destructor.virtual void grab () =0
Grab stream. The stream should not be handled by the engine after this function is called.virtual void release () =0
Release stream. The stream should be handled by the engine after this function is called.virtual int isOwner () const =0
Return the "owner" flag.Return value
Returns the "owner" flag.virtual Ptr< Stream > getStream () const =0
Return a stream pointer.Return value
The stream pointer.virtual int isOpened () const =0
Return the status of the stream.Return value
Returns 1 if stream is opened; otherwise, 0 is returned.virtual int isAvailable () const =0
Return the status of the stream.Return value
Returns 1 if stream data is available; otherwise, 0 is returned.virtual int read (void * ptr, int size) const =0
Read the number of bytes from the stream.Arguments
- void * ptr - Destination buffer pointer.
- int size - Size of the buffer in bytes.
Return value
Returns the number of read bytes.virtual int write (const void * ptr, int size) const =0
Write the number of bytes to the stream.Arguments
- const void * ptr - Source buffer pointer.
- int size - Size of the buffer in bytes.
Return value
Returns the number of written bytes.virtual int readStream (const Ptr< Stream > & dest, int size) const =0
Read the number of bytes directly from the stream.Arguments
- const Ptr< Stream > & dest - Destination stream pointer.
- int size - Size of the data in bytes.
Return value
Returns the number of read bytes.virtual int writeStream (const Ptr< Stream > & src, int size) const =0
Write the number of bytes directly to the stream.Arguments
- const Ptr< Stream > & src - Source stream pointer.
- int size - Size of the data in bytes.
Return value
Returns the number of written bytes.virtual char readChar () const =0
Read a signed character from the stream.Return value
Data value.virtual int writeChar (char value) const =0
Write a signed character to the stream.Arguments
- char value - Data value.
virtual unsigned char readUChar () const =0
Read an unsigned character from the stream.Return value
Data value.virtual int writeUChar (unsigned char value) const =0
Write an unsigned character to the stream.Arguments
- unsigned char value - Data value.
virtual int readInt2 () const =0
Read a compact signed integer from the stream.Return value
Data value.virtual int writeInt2 (int value) const =0
Write a compact signed integer to the stream.Arguments
- int value - Data value.
virtual unsigned int readUInt2 () const =0
Read a compact unsigned integer from the stream.Return value
Data value.virtual int writeUInt2 (unsigned int value) const =0
Write a compact unsigned integer to the stream.Arguments
- unsigned int value - Data value.
virtual short readShortBig () const =0
Read a signed short integer from the stream.Return value
Data value.virtual short readShortLittle () const =0
UNIGINE_INLINE short readShort () const
virtual int writeShortBig (short value) const =0
Write a signed short integer to the stream.Arguments
- short value - Data value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeShortLittle () const =0
UNIGINE_INLINE int writeShort () const
virtual int readShortArrayBig (short * dest, int size) const =0
Read an array of signed short integers from the stream.Arguments
- short * dest - Destination buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int readShortArrayLittle () const =0
UNIGINE_INLINE int readShortArray () const
virtual int writeShortArrayBig (const short * src, int size) const =0
Write an array of signed short integers to the stream.Arguments
- const short * src - Source buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeShortArrayLittle () const =0
UNIGINE_INLINE int writeShortArray () const
virtual unsigned short readUShortBig () const =0
Read a unsigned short integer from the stream.Return value
Data value.virtual unsigned short readUShortLittle () const =0
UNIGINE_INLINE unsigned short readUShort () const
virtual int writeUShortBig (unsigned short value) const =0
Write a unsigned short integer to the stream.Arguments
- unsigned short value - Data value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeUShortLittle () const =0
UNIGINE_INLINE int writeUShort () const
virtual int readUShortArrayBig (unsigned short * dest, int size) const =0
Read an array of unsigned short integers from the stream.Arguments
- unsigned short * dest - Destination buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int readUShortArrayLittle () const =0
UNIGINE_INLINE int readUShortArray () const
virtual int writeUShortArrayBig (const unsigned short * src, int size) const =0
Write an array of unsigned short integers to the stream.Arguments
- const unsigned short * src - Source buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeUShortArrayLittle () const =0
UNIGINE_INLINE int writeUShortArray () const
virtual int readIntBig () const =0
Read a signed integer from the stream.Return value
Data value.virtual int readIntLittle () const =0
UNIGINE_INLINE int readInt () const
virtual int writeIntBig (int value) const =0
Write a signed integer to the stream.Arguments
- int value - Data value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeIntLittle () const =0
UNIGINE_INLINE int writeInt () const
virtual int readIntArrayBig (int * dest, int size) const =0
Read an array of signed integers from the stream.Arguments
- int * dest - Destination buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int readIntArrayLittle () const =0
UNIGINE_INLINE int readIntArray () const
virtual int writeIntArrayBig (const int * src, int size) const =0
Write an array of signed integers to the stream.Arguments
- const int * src - Source buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeIntArrayLittle () const =0
UNIGINE_INLINE int writeIntArray () const
virtual unsigned int readUIntBig () const =0
Read a unsigned integer from the stream.Return value
Data value.virtual unsigned int readUIntLittle () const =0
UNIGINE_INLINE unsigned int readUInt () const
virtual int writeUIntBig (unsigned int value) const =0
Write a unsigned integer to the stream.Arguments
- unsigned int value - Data value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeUIntLittle () const =0
UNIGINE_INLINE int writeUInt () const
virtual int readUIntArrayBig (unsigned int * dest, int size) const =0
Read an array of unsigned integers from the stream.Arguments
- unsigned int * dest - Destination buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int readUIntArrayLittle () const =0
UNIGINE_INLINE int readUIntArray () const
virtual int writeUIntArrayBig (const unsigned int * src, int size) const =0
Write an array of unsigned integers to the stream.Arguments
- const unsigned int * src - Source buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeUIntArrayLittle () const =0
UNIGINE_INLINE int writeUIntArray () const
virtual long long readLongBig () const =0
Read a signed long from the stream.Return value
Data value.virtual long long readLongLittle () const =0
UNIGINE_INLINE long long readLong () const
virtual int writeLongBig (long long value) const =0
Write a signed long to the stream.Arguments
- long long value - Data value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeLongLittle () const =0
UNIGINE_INLINE int writeLong () const
virtual int readLongArrayBig (long long * dest, int size) const =0
Read an array of signed longs from the stream.Arguments
- long long * dest - Destination buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int readLongArrayLittle () const =0
UNIGINE_INLINE int readLongArray () const
virtual int writeLongArrayBig (const long long * src, int size) const =0
Write an array of signed longs to the stream.Arguments
- const long long * src - Source buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeLongArrayLittle () const =0
UNIGINE_INLINE int writeLongArray () const
virtual float readFloatBig () const =0
Read a floating-point number from the stream.Return value
Data value.virtual float readFloatLittle () const =0
UNIGINE_INLINE float readFloat () const
virtual int writeFloatBig (float value) const =0
Write a floating-point number to the stream.Arguments
- float value - Data value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeFloatLittle () const =0
UNIGINE_INLINE int writeFloat () const
virtual int readFloatArrayBig (float * dest, int size) const =0
Read an array of floating-point numbers from the stream.Arguments
- float * dest - Destination buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int readFloatArrayLittle () const =0
UNIGINE_INLINE int readFloatArray () const
virtual int writeFloatArrayBig (const float * src, int size) const =0
Write an array of floating-point numbers to the stream.Arguments
- const float * src - Source buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeFloatArrayLittle () const =0
UNIGINE_INLINE int writeFloatArray () const
virtual double readDoubleBig () const =0
Read a double floating-point number from the stream.Return value
Data value.virtual double readDoubleLittle () const =0
UNIGINE_INLINE double readDouble () const
virtual int writeDoubleBig (double value) const =0
Write a double floating-point number to the stream.Arguments
- double value - Data value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeDoubleLittle () const =0
UNIGINE_INLINE int writeDouble () const
virtual int readDoubleArrayBig (double * dest, int size) const =0
Read an array of double floating-point numbers from the stream.Arguments
- double * dest - Destination buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int readDoubleArrayLittle () const =0
UNIGINE_INLINE int readDoubleArray () const
virtual int writeDoubleArrayBig (const double * src, int size) const =0
Write an array of double floating-point numbers to the stream.Arguments
- const double * src - Source buffer pointer.
- int size - The number of elements.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeDoubleArrayLittle () const =0
UNIGINE_INLINE int writeDoubleArray () const
virtual vec2 readVec2Big () const =0
Read a 2 component vector from the stream.Return value
Vector value.virtual vec2 readVec2Little () const =0
UNIGINE_INLINE vec2 readVec2 () const
virtual int writeVec2Big (const vec2 & value) const =0
Write a 2 component vector to the stream.Arguments
- const vec2 & value - Vector value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeVec2Little () const =0
UNIGINE_INLINE int writeVec2 () const
virtual vec3 readVec3Big () const =0
Read a 3 component vector from the stream.Return value
Vector value.virtual vec3 readVec3Little () const =0
UNIGINE_INLINE vec3 readVec3 () const
virtual int writeVec3Big (const vec3 & value) const =0
Write a 3 component vector to the stream.Arguments
- const vec3 & value - Vector value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeVec3Little () const =0
UNIGINE_INLINE int writeVec3 () const
virtual vec4 readVec4Big () const =0
Read a 4 component vector from the stream.Return value
Vector value.virtual vec4 readVec4Little () const =0
UNIGINE_INLINE vec4 readVec4 () const
virtual int writeVec4Big (const vec4 & value) const =0
Write a 4 component vector to the stream.Arguments
- const vec4 & value - Vector value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeVec4Little () const =0
UNIGINE_INLINE int writeVec4 () const
virtual dvec2 readDVec2Big () const =0
Read a 2 component double vector from the stream.Return value
Vector value.virtual dvec2 readDVec2Little () const =0
UNIGINE_INLINE dvec2 readDVec2 () const
virtual int writeDVec2Big (const dvec2 & value) const =0
Write a 2 component double vector to the stream.Arguments
- const dvec2 & value - Vector value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeDVec2Little () const =0
UNIGINE_INLINE int writeDVec2 () const
virtual dvec3 readDVec3Big () const =0
Read a 3 component double vector from the stream.Return value
Vector value.virtual dvec3 readDVec3Little () const =0
UNIGINE_INLINE dvec3 readDVec3 () const
virtual int writeDVec3Big (const dvec3 & value) const =0
Write a 3 component double vector to the stream.Arguments
- const dvec3 & value - Vector value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeDVec3Little () const =0
UNIGINE_INLINE int writeDVec3 () const
virtual dvec4 readDVec4Big () const =0
Read a 4 component double vector from the stream.Return value
Vector value.virtual dvec4 readDVec4Little () const =0
UNIGINE_INLINE dvec4 readDVec4 () const
virtual int writeDVec4Big (const dvec4 & value) const =0
Write a 4 component double vector to the stream.Arguments
- const dvec4 & value - Vector value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeDVec4Little () const =0
UNIGINE_INLINE int writeDVec4 () const
virtual ivec2 readIVec2Big () const =0
Read a 2 component integer vector from the stream.Return value
Vector value.virtual ivec2 readIVec2Little () const =0
UNIGINE_INLINE ivec2 readIVec2 () const
virtual int writeIVec2Big (const ivec2 & value) const =0
Write a 2 component integer vector to the stream.Arguments
- const ivec2 & value - Vector value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeIVec2Little () const =0
UNIGINE_INLINE int writeIVec2 () const
virtual ivec3 readIVec3Big () const =0
Read a 3 component integer vector from the stream.Return value
Vector value.virtual ivec3 readIVec3Little () const =0
UNIGINE_INLINE ivec3 readIVec3 () const
virtual int writeIVec3Big (const ivec3 & value) const =0
Write a 3 component integer vector to the stream.Arguments
- const ivec3 & value - Vector value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeIVec3Little () const =0
UNIGINE_INLINE int writeIVec3 () const
virtual ivec4 readIVec4Big () const =0
Read a 4 component integer vector from the stream.Return value
Vector value.virtual ivec4 readIVec4Little () const =0
UNIGINE_INLINE ivec4 readIVec4 () const
virtual int writeIVec4Big (const ivec4 & value) const =0
Write a 4 component integer vector to the stream.Arguments
- const ivec4 & value - Vector value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeIVec4Little () const =0
UNIGINE_INLINE int writeIVec4 () const
virtual mat4 readMat4Big () const =0
Read a matrix from the stream.Return value
Vector value.virtual mat4 readMat4Little () const =0
UNIGINE_INLINE mat4 readMat4 () const
virtual int writeMat4Big (const mat4 & value) const =0
Write a matrix to the stream.Arguments
- const mat4 & value - Vector value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeMat4Little () const =0
UNIGINE_INLINE int writeMat4 () const
virtual dmat4 readDMat4Big () const =0
Read a double matrix from the stream.Return value
Vector value.virtual dmat4 readDMat4Little () const =0
UNIGINE_INLINE dmat4 readDMat4 () const
virtual int writeDMat4Big (const dmat4 & value) const =0
Write a double matrix to the stream.Arguments
- const dmat4 & value - Vector value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeDMat4Little () const =0
UNIGINE_INLINE int writeDMat4 () const
virtual quat readQuatBig () const =0
Read a quaternion from the stream.Return value
Vector value.virtual quat readQuatLittle () const =0
UNIGINE_INLINE quat readQuat () const
virtual int writeQuatBig (const quat & value) const =0
Write a quaternion to the stream.Arguments
- const quat & value - Vector value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeQuatLittle () const =0
UNIGINE_INLINE int writeQuat () const
virtual String readString () const =0
Read a string from the stream.Return value
Returns string.virtual int readString (char * str, int size) const =0
Read a string from the stream.Arguments
- char * str - String pointer.
- int size - Size of the buffer in bytes.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeString (const char * str) const =0
Write a string to the stream.Arguments
- const char * str - String pointer.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual String readString2 () const =0
Read a string from the stream.Return value
Returns string.virtual int readString2 (char * str, int size) const =0
Read a string from the stream.Arguments
- char * str - String pointer.
- int size - Size of the buffer in bytes.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int writeString2 (const char * str) const =0
Write a string to the stream.Arguments
- const char * str - String pointer.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.Last update: 03.07.2017
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter