Collage
1.7.0
High-performance C++ library for developing object-oriented distributed applications.
|
A std::istream-like input data stream for binary data. More...
#include <dataIStream.h>
Public Member Functions | |
Data input | |
template<typename T > | |
T | read () |
template<class T > | |
DataIStream & | operator>> (T &value) |
Read a plain data item. More... | |
template<class T > | |
DataIStream & | operator>> (Array< T > array) |
Read a C array. More... | |
template<class T > | |
DataIStream & | operator>> (lunchbox::RefPtr< T > &) |
Read a lunchbox::RefPtr. More... | |
template<class T > | |
DataIStream & | operator>> (lunchbox::Buffer< T > &) |
Read a lunchbox::Buffer. More... | |
template<class T > | |
DataIStream & | operator>> (std::vector< T > &) |
Read a std::vector of serializable items. More... | |
template<class K , class V > | |
DataIStream & | operator>> (std::map< K, V > &) |
Read a std::map of serializable items. More... | |
template<class T > | |
DataIStream & | operator>> (std::set< T > &) |
Read a std::set of serializable items. More... | |
template<class K , class V > | |
DataIStream & | operator>> (std::unordered_map< K, V > &) |
Read an unordered_map of serializable items. More... | |
template<class T > | |
DataIStream & | operator>> (std::unordered_set< T > &) |
Read an unordered_set of serializable items. More... | |
template<typename O , typename C > | |
void | deserializeChildren (O *object, const std::vector< C * > &old, std::vector< C * > &result) |
CO_API const void * | getRemainingBuffer (const uint64_t size) |
CO_API uint64_t | getRemainingBufferSize () |
bool | wasUsed () const |
bool | hasData () |
virtual CO_API NodePtr | getRemoteNode () const =0 |
virtual CO_API LocalNodePtr | getLocalNode () const =0 |
Specialized input operators | |
template<> | |
DataIStream & | operator>> (std::string &str) |
Read a std::string. More... | |
template<> | |
DataIStream & | operator>> (Object *&object) |
Deserialize an object (id+version). More... | |
template<> | |
DataIStream & | operator>> (std::vector< uint8_t > &value) |
Optimized specialization to read a std::vector of uint8_t. More... | |
template<> | |
DataIStream & | operator>> (std::vector< uint16_t > &value) |
Optimized specialization to read a std::vector of uint16_t. More... | |
template<> | |
DataIStream & | operator>> (std::vector< int16_t > &value) |
Optimized specialization to read a std::vector of int16_t. More... | |
template<> | |
DataIStream & | operator>> (std::vector< uint32_t > &value) |
Optimized specialization to read a std::vector of uint32_t. More... | |
template<> | |
DataIStream & | operator>> (std::vector< int32_t > &value) |
Optimized specialization to read a std::vector of int32_t. More... | |
template<> | |
DataIStream & | operator>> (std::vector< uint64_t > &value) |
Optimized specialization to read a std::vector of uint64_t. More... | |
template<> | |
DataIStream & | operator>> (std::vector< int64_t > &value) |
Optimized specialization to read a std::vector of int64_t. More... | |
template<> | |
DataIStream & | operator>> (std::vector< float > &value) |
Optimized specialization to read a std::vector of float. More... | |
template<> | |
DataIStream & | operator>> (std::vector< double > &value) |
Optimized specialization to read a std::vector of double. More... | |
template<> | |
DataIStream & | operator>> (std::vector< ObjectVersion > &value) |
Optimized specialization to read a std::vector of ObjectVersion. More... | |
A std::istream-like input data stream for binary data.
Definition at line 45 of file dataIStream.h.
|
pure virtual |
Implemented in co::ICommand.
CO_API const void* co::DataIStream::getRemainingBuffer | ( | const uint64_t | size | ) |
The usage of this method is discouraged, no endian conversion or bounds checking is performed by the DataIStream on the returned raw pointer.
The buffer is advanced by the given size. If not enough data is present, 0 is returned and the buffer is unchanged.
The data written to the DataOStream by the sender is bucketized, it is sent in multiple blocks. The remaining buffer and its size points into one of the buffers, i.e., 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.
size | the number of bytes to advance the buffer |
Referenced by co::Distributable< T, S, Args >::notifyChanged(), and operator>>().
CO_API uint64_t co::DataIStream::getRemainingBufferSize | ( | ) |
Referenced by operator>>().
|
pure virtual |
Implemented in co::ICommand.
|
inline |
|
inline |
Read a std::string.
Definition at line 30 of file dataIStream.ipp.
References getRemainingBuffer(), and getRemainingBufferSize().
|
inline |
Deserialize an object (id+version).
Definition at line 49 of file dataIStream.ipp.
References co::Object::getID(), getRemainingBuffer(), co::ObjectVersion::identifier, operator>>(), and co::ObjectVersion::version.
|
inline |
Read a plain data item.
Definition at line 70 of file dataIStream.h.
Referenced by operator>>().
|
inline |
DataIStream& co::DataIStream::operator>> | ( | lunchbox::RefPtr< T > & | ) |
Read a lunchbox::RefPtr.
Refcount has to managed by caller.
DataIStream& co::DataIStream::operator>> | ( | lunchbox::Buffer< T > & | ) |
Read a lunchbox::Buffer.
DataIStream& co::DataIStream::operator>> | ( | std::vector< T > & | ) |
Read a std::vector of serializable items.
DataIStream& co::DataIStream::operator>> | ( | std::map< K, V > & | ) |
Read a std::map of serializable items.
DataIStream& co::DataIStream::operator>> | ( | std::set< T > & | ) |
Read a std::set of serializable items.
DataIStream& co::DataIStream::operator>> | ( | std::unordered_map< K, V > & | ) |
Read an unordered_map of serializable items.
DataIStream& co::DataIStream::operator>> | ( | std::unordered_set< T > & | ) |
Read an unordered_set of serializable items.
|
inline |
Optimized specialization to read a std::vector of uint8_t.
Definition at line 254 of file dataIStream.ipp.
|
inline |
Optimized specialization to read a std::vector of uint16_t.
Definition at line 261 of file dataIStream.ipp.
|
inline |
Optimized specialization to read a std::vector of int16_t.
Definition at line 268 of file dataIStream.ipp.
|
inline |
Optimized specialization to read a std::vector of uint32_t.
Definition at line 275 of file dataIStream.ipp.
|
inline |
Optimized specialization to read a std::vector of int32_t.
Definition at line 282 of file dataIStream.ipp.
|
inline |
Optimized specialization to read a std::vector of uint64_t.
Definition at line 289 of file dataIStream.ipp.
|
inline |
Optimized specialization to read a std::vector of int64_t.
Definition at line 296 of file dataIStream.ipp.
|
inline |
Optimized specialization to read a std::vector of float.
Definition at line 303 of file dataIStream.ipp.
|
inline |
Optimized specialization to read a std::vector of double.
Definition at line 310 of file dataIStream.ipp.
|
inline |
Optimized specialization to read a std::vector of ObjectVersion.
Definition at line 317 of file dataIStream.ipp.
|
inline |
Definition at line 61 of file dataIStream.h.
Referenced by co::Distributable< T, S, Args >::notifyChanged().