Equalizer
1.2.1
|
A std::istream-like input data stream for binary data. More...
#include <dataIStream.h>
Public Member Functions | |
Internal | |
CO_API | DataIStream () |
DataIStream (const DataIStream &) | |
virtual CO_API | ~DataIStream () |
virtual size_t | nRemainingBuffers () const =0 |
Get the number of remaining buffers. | |
virtual uint128_t | getVersion () const =0 |
virtual void | reset () |
Data input | |
template<typename T > | |
DataIStream & | operator>> (T &value) |
Read a plain data item. | |
template<typename T > | |
DataIStream & | operator>> (std::vector< T > &value) |
Read a std::vector of serializable items. | |
template<typename O , typename C > | |
void | deserializeChildren (O *object, const std::vector< C * > &old, std::vector< C * > &result) |
Deserialize child objects. | |
CO_API void | read (void *data, uint64_t size) |
Read a number of bytes from the stream into a buffer. | |
CO_API const void * | getRemainingBuffer () |
Get the pointer to the remaining data in the current buffer. | |
CO_API uint64_t | getRemainingBufferSize () |
Get the size of the remaining data in the current buffer. | |
CO_API void | advanceBuffer (const uint64_t offset) |
Advance the current buffer by a number of bytes. | |
bool | hasData () |
Specialized input operators | |
template<> | |
DataIStream & | operator>> (std::string &str) |
Read a std::string. | |
template<> | |
DataIStream & | operator>> (Object *&object) |
Deserialize an object (id+version). | |
template<> | |
DataIStream & | operator>> (std::vector< uint8_t > &value) |
Optimized specialization to read a std::vector of uint8_t. | |
template<> | |
DataIStream & | operator>> (std::vector< uint16_t > &value) |
Optimized specialization to read a std::vector of uint16_t. | |
template<> | |
DataIStream & | operator>> (std::vector< int16_t > &value) |
Optimized specialization to read a std::vector of int16_t. | |
template<> | |
DataIStream & | operator>> (std::vector< uint32_t > &value) |
Optimized specialization to read a std::vector of uint32_t. | |
template<> | |
DataIStream & | operator>> (std::vector< int32_t > &value) |
Optimized specialization to read a std::vector of int32_t. | |
template<> | |
DataIStream & | operator>> (std::vector< uint64_t > &value) |
Optimized specialization to read a std::vector of uint64_t. | |
template<> | |
DataIStream & | operator>> (std::vector< int64_t > &value) |
Optimized specialization to read a std::vector of int64_t. | |
template<> | |
DataIStream & | operator>> (std::vector< float > &value) |
Optimized specialization to read a std::vector of float. | |
template<> | |
DataIStream & | operator>> (std::vector< double > &value) |
Optimized specialization to read a std::vector of double. | |
template<> | |
DataIStream & | operator>> (std::vector< ObjectVersion > &value) |
Optimized specialization to read a std::vector of ObjectVersion. | |
Protected Member Functions | |
virtual bool | getNextBuffer (uint32_t *compressor, uint32_t *nChunks, const void **chunkData, uint64_t *size)=0 |
A std::istream-like input data stream for binary data.
Definition at line 35 of file dataIStream.h.
CO_API void co::DataIStream::advanceBuffer | ( | const uint64_t | offset | ) |
Advance the current buffer by a number of bytes.
Referenced by operator>>().
void co::DataIStream::deserializeChildren | ( | O * | object, |
const std::vector< C * > & | old, | ||
std::vector< C * > & | result | ||
) |
Deserialize child objects.
Existing children are synced to the new version. New children are created by calling the void create( C** child )
method on the object, and registered or mapped to the object's session. Removed children are released by calling the void release( C* )
method on the object. The resulting child vector is created in result. The old and result vector can be the same object, the result vector is cleared and rebuild completely.
CO_API const void* co::DataIStream::getRemainingBuffer | ( | ) |
Get the pointer to the remaining data in the current buffer.
The data written by the DataOStream on the other end is bucketized, that is, it is sent in multiple blocks. The remaining buffer and its size points into one of the buffers, that is, not all the data sent is returned by this function. However, a write operation on the other end is never segmented, that is, if the application writes n bytes to the DataOStream, a symmetric read from the DataIStream has at least n bytes available.
Referenced by operator>>().
CO_API uint64_t co::DataIStream::getRemainingBufferSize | ( | ) |
Get the size of the remaining data in the current buffer.
Referenced by operator>>().
bool co::DataIStream::hasData | ( | ) | [inline] |
Definition at line 109 of file dataIStream.h.
virtual size_t co::DataIStream::nRemainingBuffers | ( | ) | const [pure virtual] |
Get the number of remaining buffers.
DataIStream& co::DataIStream::operator>> | ( | T & | value | ) | [inline] |
Read a plain data item.
Definition at line 55 of file dataIStream.h.
References read().
DataIStream& co::DataIStream::operator>> | ( | std::vector< T > & | value | ) | [inline] |
Read a std::vector of serializable items.
Definition at line 60 of file dataIStream.h.
References read().
DataIStream& co::DataIStream::operator>> | ( | std::string & | str | ) | [inline] |
Read a std::string.
Definition at line 162 of file dataIStream.h.
References advanceBuffer(), getRemainingBuffer(), getRemainingBufferSize(), and read().
DataIStream& co::DataIStream::operator>> | ( | Object *& | object | ) | [inline] |
Deserialize an object (id+version).
Definition at line 180 of file dataIStream.h.
References co::Object::getID().
DataIStream& co::DataIStream::operator>> | ( | std::vector< uint8_t > & | value | ) | [inline] |
Optimized specialization to read a std::vector of uint8_t.
Definition at line 271 of file dataIStream.h.
DataIStream& co::DataIStream::operator>> | ( | std::vector< uint16_t > & | value | ) | [inline] |
Optimized specialization to read a std::vector of uint16_t.
Definition at line 276 of file dataIStream.h.
DataIStream& co::DataIStream::operator>> | ( | std::vector< int16_t > & | value | ) | [inline] |
Optimized specialization to read a std::vector of int16_t.
Definition at line 281 of file dataIStream.h.
DataIStream& co::DataIStream::operator>> | ( | std::vector< uint32_t > & | value | ) | [inline] |
Optimized specialization to read a std::vector of uint32_t.
Definition at line 286 of file dataIStream.h.
DataIStream& co::DataIStream::operator>> | ( | std::vector< int32_t > & | value | ) | [inline] |
Optimized specialization to read a std::vector of int32_t.
Definition at line 291 of file dataIStream.h.
DataIStream& co::DataIStream::operator>> | ( | std::vector< uint64_t > & | value | ) | [inline] |
Optimized specialization to read a std::vector of uint64_t.
Definition at line 296 of file dataIStream.h.
DataIStream& co::DataIStream::operator>> | ( | std::vector< int64_t > & | value | ) | [inline] |
Optimized specialization to read a std::vector of int64_t.
Definition at line 301 of file dataIStream.h.
DataIStream& co::DataIStream::operator>> | ( | std::vector< float > & | value | ) | [inline] |
Optimized specialization to read a std::vector of float.
Definition at line 306 of file dataIStream.h.
DataIStream& co::DataIStream::operator>> | ( | std::vector< double > & | value | ) | [inline] |
Optimized specialization to read a std::vector of double.
Definition at line 311 of file dataIStream.h.
DataIStream& co::DataIStream::operator>> | ( | std::vector< ObjectVersion > & | value | ) | [inline] |
Optimized specialization to read a std::vector of ObjectVersion.
Definition at line 316 of file dataIStream.h.
CO_API void co::DataIStream::read | ( | void * | data, |
uint64_t | size | ||
) |
Read a number of bytes from the stream into a buffer.
Referenced by eqNbody::SharedDataProxy::deserialize(), eqNbody::FrameData::deserialize(), and operator>>().