Collage  0.6.1
Public Member Functions | Protected Member Functions
co::DataIStream Class Reference

A std::istream-like input data stream for binary data. More...

#include <dataIStream.h>

+ Inheritance diagram for co::DataIStream:

List of all members.

Public Member Functions

virtual CO_API NodePtr getMaster ()=0
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 >
DataIStreamoperator>> (T &value)
 Read a plain data item.
template<typename T >
DataIStreamoperator>> (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<>
DataIStreamoperator>> (std::string &str)
 Read a std::string.
template<>
DataIStreamoperator>> (Object *&object)
 Deserialize an object (id+version).
template<>
DataIStreamoperator>> (std::vector< uint8_t > &value)
 Optimized specialization to read a std::vector of uint8_t.
template<>
DataIStreamoperator>> (std::vector< uint16_t > &value)
 Optimized specialization to read a std::vector of uint16_t.
template<>
DataIStreamoperator>> (std::vector< int16_t > &value)
 Optimized specialization to read a std::vector of int16_t.
template<>
DataIStreamoperator>> (std::vector< uint32_t > &value)
 Optimized specialization to read a std::vector of uint32_t.
template<>
DataIStreamoperator>> (std::vector< int32_t > &value)
 Optimized specialization to read a std::vector of int32_t.
template<>
DataIStreamoperator>> (std::vector< uint64_t > &value)
 Optimized specialization to read a std::vector of uint64_t.
template<>
DataIStreamoperator>> (std::vector< int64_t > &value)
 Optimized specialization to read a std::vector of int64_t.
template<>
DataIStreamoperator>> (std::vector< float > &value)
 Optimized specialization to read a std::vector of float.
template<>
DataIStreamoperator>> (std::vector< double > &value)
 Optimized specialization to read a std::vector of double.
template<>
DataIStreamoperator>> (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

Detailed Description

A std::istream-like input data stream for binary data.

Definition at line 34 of file dataIStream.h.


Member Function Documentation

CO_API void co::DataIStream::advanceBuffer ( const uint64_t  offset)

Advance the current buffer by a number of bytes.

Referenced by operator>>().

+ Here is the caller graph for this function:

template<typename O , typename C >
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.

virtual CO_API NodePtr co::DataIStream::getMaster ( ) [pure virtual]
Returns:
the provider of the istream.
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>>().

+ Here is the caller graph for this function:

Get the size of the remaining data in the current buffer.

Referenced by operator>>().

+ Here is the caller graph for this function:

bool co::DataIStream::hasData ( ) [inline]
Returns:
true if not all data has been read.

Definition at line 108 of file dataIStream.h.

virtual size_t co::DataIStream::nRemainingBuffers ( ) const [pure virtual]

Get the number of remaining buffers.

template<typename T >
DataIStream& co::DataIStream::operator>> ( T &  value) [inline]

Read a plain data item.

Definition at line 54 of file dataIStream.h.

References read().

+ Here is the call graph for this function:

template<typename T >
DataIStream& co::DataIStream::operator>> ( std::vector< T > &  value) [inline]

Read a std::vector of serializable items.

Definition at line 59 of file dataIStream.h.

References read().

+ Here is the call graph for this function:

DataIStream & co::DataIStream::operator>> ( std::string &  str) [inline]

Read a std::string.

Definition at line 164 of file dataIStream.h.

References advanceBuffer(), getRemainingBuffer(), getRemainingBufferSize(), and read().

+ Here is the call graph for this function:

DataIStream & co::DataIStream::operator>> ( Object *&  object) [inline]

Deserialize an object (id+version).

Definition at line 182 of file dataIStream.h.

References co::Object::getID().

+ Here is the call graph for this function:

DataIStream & co::DataIStream::operator>> ( std::vector< uint8_t > &  value) [inline]

Optimized specialization to read a std::vector of uint8_t.

Definition at line 273 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 278 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 283 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 288 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 293 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 298 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 303 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 308 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 313 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 318 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 operator>>().

+ Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Mon Nov 26 2012 14:41:44 for Collage 0.6.1 by  doxygen 1.7.6.1