Collage
1.7.0
High-performance C++ library for developing object-oriented distributed applications.
|
A std::ostream-like interface for object serialization. More...
#include <dataOStream.h>
Public Member Functions | |
Internal | |
CO_API void | disable () |
void | enableSave () |
void | disableSave () |
CO_API bool | hasSentData () const |
CO_API const Connections & | getConnections () const |
DataOStream & | streamDataHeader (DataOStream &os) |
void | sendBody (ConnectionPtr connection, const void *data, const uint64_t dataSize) |
uint64_t | getCompressedDataSize () const |
Data output | |
template<class T > | |
DataOStream & | operator<< (const T &value) |
Write a plain data item by copying it to the stream. More... | |
template<class T > | |
DataOStream & | operator<< (const Array< T > array) |
Write a C array. More... | |
template<class T > | |
DataOStream & | operator<< (const lunchbox::RefPtr< T > &ptr) |
Write a lunchbox::RefPtr. More... | |
template<class T > | |
DataOStream & | operator<< (const lunchbox::Buffer< T > &buffer) |
Write a lunchbox::Buffer. More... | |
template<class T > | |
DataOStream & | operator<< (const lunchbox::Request< T > &request) |
Transmit a request identifier. More... | |
template<class T > | |
DataOStream & | operator<< (const std::vector< T > &value) |
Write a std::vector of serializable items. More... | |
template<class K , class V > | |
DataOStream & | operator<< (const std::map< K, V > &value) |
Write a std::map of serializable items. More... | |
template<class T > | |
DataOStream & | operator<< (const std::set< T > &value) |
Write a std::set of serializable items. More... | |
template<class K , class V > | |
DataOStream & | operator<< (const std::unordered_map< K, V > &value) |
Write an unordered_map of serializable items. More... | |
template<class T > | |
DataOStream & | operator<< (const std::unordered_set< T > &value) |
Write an unordered_set of serializable items. More... | |
template<typename C > | |
void | serializeChildren (const std::vector< C * > &children) |
Static Public Member Functions | |
static CO_API std::ostream & | printStatistics (std::ostream &) |
static CO_API void | clearStatistics () |
Protected Member Functions | |
CO_API | DataOStream (size_t chunkSize=Global::getObjectBufferSize()) |
DataOStream (DataOStream &rhs) | |
CO_API lunchbox::Bufferb & | getBuffer () |
void | _setCompressor (const pression::data::CompressorInfo &info) |
CO_API void | _enable () |
void | flush (const bool last) |
void | _setupConnections (const Nodes &receivers) |
void | _setupConnections (const Connections &connections) |
void | _setupConnection (NodePtr node, const bool useMulticast) |
CO_API void | _setupConnection (ConnectionPtr connection) |
void | _resend () |
void | _clearConnections () |
virtual CO_API void | reset () |
virtual void | sendData (const void *buffer, const uint64_t size, const bool last)=0 |
Friends | |
class | DataStreamTest::Sender |
Specialized output operators | |
template<> | |
DataOStream & | operator<< (const std::string &str) |
Write a std::string. More... | |
template<> | |
DataOStream & | operator<< (const Object *const &object) |
Write an object identifier and version. More... | |
template<> | |
void | _writeArray (const Array< void > array, const boost::false_type &) |
template<> | |
DataOStream & | operator<< (const std::vector< uint8_t > &value) |
Optimized specialization to write a std::vector of uint8_t. More... | |
template<> | |
DataOStream & | operator<< (const std::vector< uint16_t > &value) |
Optimized specialization to write a std::vector of uint16_t. More... | |
template<> | |
DataOStream & | operator<< (const std::vector< int16_t > &value) |
Optimized specialization to write a std::vector of int16_t. More... | |
template<> | |
DataOStream & | operator<< (const std::vector< uint32_t > &value) |
Optimized specialization to write a std::vector of uint32_t. More... | |
template<> | |
DataOStream & | operator<< (const std::vector< int32_t > &value) |
Optimized specialization to write a std::vector of int32_t. More... | |
template<> | |
DataOStream & | operator<< (const std::vector< uint64_t > &value) |
Optimized specialization to write a std::vector of uint64_t. More... | |
template<> | |
DataOStream & | operator<< (const std::vector< int64_t > &value) |
Optimized specialization to write a std::vector of int64_t. More... | |
template<> | |
DataOStream & | operator<< (const std::vector< float > &value) |
Optimized specialization to write a std::vector of float. More... | |
template<> | |
DataOStream & | operator<< (const std::vector< double > &value) |
Optimized specialization to write a std::vector of double. More... | |
template<> | |
DataOStream & | operator<< (const std::vector< ObjectVersion > &value) |
Optimized specialization to write a std::vector of ObjectVersion. More... | |
A std::ostream-like interface for object serialization.
Implements buffering, retaining and compressing data in a binary format. Derived classes send the data using the appropriate commands.
Definition at line 56 of file dataOStream.h.
|
inline |
Write a std::string.
Definition at line 29 of file dataOStream.ipp.
|
inline |
Write an object identifier and version.
Definition at line 41 of file dataOStream.ipp.
References co::Object::isAttached(), and operator<<().
|
inline |
Write a plain data item by copying it to the stream.
Definition at line 91 of file dataOStream.h.
Referenced by operator<<().
|
inline |
DataOStream& co::DataOStream::operator<< | ( | const lunchbox::RefPtr< T > & | ptr | ) |
Write a lunchbox::RefPtr.
Refcount has to managed by caller.
DataOStream& co::DataOStream::operator<< | ( | const lunchbox::Buffer< T > & | buffer | ) |
Write a lunchbox::Buffer.
|
inline |
Transmit a request identifier.
Definition at line 118 of file dataOStream.h.
References co::Global::getObjectBufferSize().
DataOStream& co::DataOStream::operator<< | ( | const std::vector< T > & | value | ) |
Write a std::vector of serializable items.
DataOStream& co::DataOStream::operator<< | ( | const std::map< K, V > & | value | ) |
Write a std::map of serializable items.
DataOStream& co::DataOStream::operator<< | ( | const std::set< T > & | value | ) |
Write a std::set of serializable items.
DataOStream& co::DataOStream::operator<< | ( | const std::unordered_map< K, V > & | value | ) |
Write an unordered_map of serializable items.
DataOStream& co::DataOStream::operator<< | ( | const std::unordered_set< T > & | value | ) |
Write an unordered_set of serializable items.
|
inline |
Optimized specialization to write a std::vector of uint8_t.
Definition at line 160 of file dataOStream.ipp.
|
inline |
Optimized specialization to write a std::vector of uint16_t.
Definition at line 167 of file dataOStream.ipp.
|
inline |
Optimized specialization to write a std::vector of int16_t.
Definition at line 174 of file dataOStream.ipp.
|
inline |
Optimized specialization to write a std::vector of uint32_t.
Definition at line 181 of file dataOStream.ipp.
|
inline |
Optimized specialization to write a std::vector of int32_t.
Definition at line 188 of file dataOStream.ipp.
|
inline |
Optimized specialization to write a std::vector of uint64_t.
Definition at line 195 of file dataOStream.ipp.
|
inline |
Optimized specialization to write a std::vector of int64_t.
Definition at line 202 of file dataOStream.ipp.
|
inline |
Optimized specialization to write a std::vector of float.
Definition at line 209 of file dataOStream.ipp.
|
inline |
Optimized specialization to write a std::vector of double.
Definition at line 216 of file dataOStream.ipp.
|
inline |
Optimized specialization to write a std::vector of ObjectVersion.
Definition at line 223 of file dataOStream.ipp.