Collage  1.0.1
Object-Oriented C++ Network Library
Protected Member Functions | Friends | List of all members
co::DataOStream Class Referenceabstract

A std::ostream-like interface for object serialization. More...

#include <dataOStream.h>

+ Inheritance diagram for co::DataOStream:
+ Collaboration diagram for co::DataOStream:

Public Member Functions

Internal
CO_API void disable ()
 
void enableSave ()
 
void disableSave ()
 
CO_API bool hasSentData () const
 
CO_API const ConnectionsgetConnections () const
 
DataOStreamstreamDataHeader (DataOStream &os)
 
void sendBody (ConnectionPtr connection, const void *data, const uint64_t size)
 
uint64_t getCompressedDataSize () const
 
Data output
template<class T >
DataOStreamoperator<< (const T &value)
 Write a plain data item by copying it to the stream. More...
 
template<class T >
DataOStreamoperator<< (Array< T > array)
 Write a C array. More...
 
template<class T >
DataOStreamoperator<< (const lunchbox::Buffer< T > &buffer)
 Write a lunchbox::Buffer. More...
 
template<class T >
DataOStreamoperator<< (const std::vector< T > &value)
 Write a std::vector of serializable items. More...
 
template<class K , class V >
DataOStreamoperator<< (const std::map< K, V > &value)
 Write a std::map of serializable items. More...
 
template<class T >
DataOStreamoperator<< (const std::set< T > &value)
 Write a std::set of serializable items. More...
 
template<class K , class V >
DataOStreamoperator<< (const stde::hash_map< K, V > &value)
 Write a stde::hash_map of serializable items. More...
 
template<class T >
DataOStreamoperator<< (const stde::hash_set< T > &value)
 Write a stde::hash_set of serializable items. More...
 
template<typename C >
void serializeChildren (const std::vector< C * > &children)
 
Specialized output operators
template<>
DataOStreamoperator<< (const std::string &str)
 Write a std::string. More...
 
template<>
DataOStreamoperator<< (const Object *const &object)
 Write an object identifier and version. More...
 
template<>
DataOStreamoperator<< (const std::vector< uint8_t > &value)
 Optimized specialization to write a std::vector of uint8_t. More...
 
template<>
DataOStreamoperator<< (const std::vector< uint16_t > &value)
 Optimized specialization to write a std::vector of uint16_t. More...
 
template<>
DataOStreamoperator<< (const std::vector< int16_t > &value)
 Optimized specialization to write a std::vector of int16_t. More...
 
template<>
DataOStreamoperator<< (const std::vector< uint32_t > &value)
 Optimized specialization to write a std::vector of uint32_t. More...
 
template<>
DataOStreamoperator<< (const std::vector< int32_t > &value)
 Optimized specialization to write a std::vector of int32_t. More...
 
template<>
DataOStreamoperator<< (const std::vector< uint64_t > &value)
 Optimized specialization to write a std::vector of uint64_t. More...
 
template<>
DataOStreamoperator<< (const std::vector< int64_t > &value)
 Optimized specialization to write a std::vector of int64_t. More...
 
template<>
DataOStreamoperator<< (const std::vector< float > &value)
 Optimized specialization to write a std::vector of float. More...
 
template<>
DataOStreamoperator<< (const std::vector< double > &value)
 Optimized specialization to write a std::vector of double. More...
 
template<>
DataOStreamoperator<< (const std::vector< ObjectVersion > &value)
 Optimized specialization to write a std::vector of ObjectVersion. More...
 

Protected Member Functions

 DataOStream (DataOStream &rhs)
 
CO_API lunchbox::Bufferb & getBuffer ()
 
void _initCompressor (const uint32_t compressor)
 
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
 

Detailed Description

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 46 of file dataOStream.h.

Member Function Documentation

template<>
DataOStream& co::DataOStream::operator<< ( const std::string &  str)
inline

Write a std::string.

Definition at line 27 of file dataOStream.ipp.

template<>
DataOStream& co::DataOStream::operator<< ( const Object *const &  object)
inline

Write an object identifier and version.

Definition at line 39 of file dataOStream.ipp.

References co::Object::isAttached().

+ Here is the call graph for this function:

template<class T >
DataOStream& co::DataOStream::operator<< ( const T &  value)
inline

Write a plain data item by copying it to the stream.

Version
1.0

Definition at line 80 of file dataOStream.h.

template<class T >
DataOStream& co::DataOStream::operator<< ( Array< T >  array)
inline

Write a C array.

Version
1.0

Definition at line 84 of file dataOStream.h.

template<class T >
DataOStream& co::DataOStream::operator<< ( const lunchbox::Buffer< T > &  buffer)

Write a lunchbox::Buffer.

Version
1.0
template<class T >
DataOStream& co::DataOStream::operator<< ( const std::vector< T > &  value)

Write a std::vector of serializable items.

Version
1.0
template<class K , class V >
DataOStream& co::DataOStream::operator<< ( const std::map< K, V > &  value)

Write a std::map of serializable items.

Version
1.0
template<class T >
DataOStream& co::DataOStream::operator<< ( const std::set< T > &  value)

Write a std::set of serializable items.

Version
1.0
template<class K , class V >
DataOStream& co::DataOStream::operator<< ( const stde::hash_map< K, V > &  value)

Write a stde::hash_map of serializable items.

Version
1.0
template<class T >
DataOStream& co::DataOStream::operator<< ( const stde::hash_set< T > &  value)

Write a stde::hash_set of serializable items.

Version
1.0
template<>
DataOStream& co::DataOStream::operator<< ( const std::vector< uint8_t > &  value)
inline

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

Definition at line 135 of file dataOStream.ipp.

template<>
DataOStream& co::DataOStream::operator<< ( const std::vector< uint16_t > &  value)
inline

Optimized specialization to write a std::vector of uint16_t.

Definition at line 140 of file dataOStream.ipp.

template<>
DataOStream& co::DataOStream::operator<< ( const std::vector< int16_t > &  value)
inline

Optimized specialization to write a std::vector of int16_t.

Definition at line 145 of file dataOStream.ipp.

template<>
DataOStream& co::DataOStream::operator<< ( const std::vector< uint32_t > &  value)
inline

Optimized specialization to write a std::vector of uint32_t.

Definition at line 150 of file dataOStream.ipp.

template<>
DataOStream& co::DataOStream::operator<< ( const std::vector< int32_t > &  value)
inline

Optimized specialization to write a std::vector of int32_t.

Definition at line 155 of file dataOStream.ipp.

template<>
DataOStream& co::DataOStream::operator<< ( const std::vector< uint64_t > &  value)
inline

Optimized specialization to write a std::vector of uint64_t.

Definition at line 160 of file dataOStream.ipp.

template<>
DataOStream& co::DataOStream::operator<< ( const std::vector< int64_t > &  value)
inline

Optimized specialization to write a std::vector of int64_t.

Definition at line 165 of file dataOStream.ipp.

template<>
DataOStream& co::DataOStream::operator<< ( const std::vector< float > &  value)
inline

Optimized specialization to write a std::vector of float.

Definition at line 170 of file dataOStream.ipp.

template<>
DataOStream& co::DataOStream::operator<< ( const std::vector< double > &  value)
inline

Optimized specialization to write a std::vector of double.

Definition at line 175 of file dataOStream.ipp.

template<>
DataOStream& co::DataOStream::operator<< ( const std::vector< ObjectVersion > &  value)
inline

Optimized specialization to write a std::vector of ObjectVersion.

Definition at line 180 of file dataOStream.ipp.


The documentation for this class was generated from the following files: