Collage  0.6.1
Protected Member Functions | Friends
co::DataOStream Class Reference

A std::ostream buffering and/or retaining data in a binary format. More...

#include <dataOStream.h>

+ Inheritance diagram for co::DataOStream:

List of all members.

Public Member Functions

Internal
CO_API DataOStream ()
virtual CO_API ~DataOStream ()
CO_API void disable ()
 Disable and flush the output to the current receivers.
void disable (const Packet &packet)
 Disable, then send the packet to the current receivers.
void enableSave ()
 Enable copying of all data into a saved buffer.
void disableSave ()
 Disable copying of all data into a saved buffer.
bool hasSentData () const
Data output
template<typename T >
DataOStreamoperator<< (const T &value)
 Write a plain data item by copying it to the stream.
template<typename T >
DataOStreamoperator<< (const std::vector< T > &value)
 Write a std::vector of serializable items.
CO_API void write (const void *data, uint64_t size)
 Write a number of bytes from data into the stream.
template<typename C >
void serializeChildren (const std::vector< C * > &children)
 Serialize child objects.
Specialized output operators
template<>
DataOStreamoperator<< (const std::string &str)
 Write a std::string.
template<>
DataOStreamoperator<< (const Object *const &object)
 Write an object identifier and version.
template<>
DataOStreamoperator<< (const std::vector< uint8_t > &value)
 Optimized specialization to write a std::vector of uint8_t.
template<>
DataOStreamoperator<< (const std::vector< uint16_t > &value)
 Optimized specialization to write a std::vector of uint16_t.
template<>
DataOStreamoperator<< (const std::vector< int16_t > &value)
 Optimized specialization to write a std::vector of int16_t.
template<>
DataOStreamoperator<< (const std::vector< uint32_t > &value)
 Optimized specialization to write a std::vector of uint32_t.
template<>
DataOStreamoperator<< (const std::vector< int32_t > &value)
 Optimized specialization to write a std::vector of int32_t.
template<>
DataOStreamoperator<< (const std::vector< uint64_t > &value)
 Optimized specialization to write a std::vector of uint64_t.
template<>
DataOStreamoperator<< (const std::vector< int64_t > &value)
 Optimized specialization to write a std::vector of int64_t.
template<>
DataOStreamoperator<< (const std::vector< float > &value)
 Optimized specialization to write a std::vector of float.
template<>
DataOStreamoperator<< (const std::vector< double > &value)
 Optimized specialization to write a std::vector of double.
template<>
DataOStreamoperator<< (const std::vector< ObjectVersion > &value)
 Optimized specialization to write a std::vector of ObjectVersion.

Protected Member Functions

void _initCompressor (const uint32_t compressor)
 Initialize the given compressor.
CO_API void _enable ()
 Enable output.
void _flush ()
 Flush remaining data in the buffer.
void _setupConnections (const Nodes &receivers)
 Set up the connection list for a group of nodes, using multicast where possible.
void _setupConnection (NodePtr node, const bool useMulticast)
 Set up the connection (list) for one node.
void _resend ()
 Resend the saved buffer to all enabled connections.
void _send (const Packet &packet)
void _clearConnections ()
virtual CO_API void reset ()
 Reset the whole stream.
Packet sending, used by the subclasses
virtual void sendData (const void *buffer, const uint64_t size, const bool last)=0
 Send a data buffer (packet) to the receivers.
template<typename P >
void sendPacket (P &packet, const void *buffer, const uint64_t size, const bool last)

Friends

class DataStreamTest::Sender

Detailed Description

A std::ostream buffering and/or retaining data in a binary format.

Derived classes send the data using the appropriate command packets.

Definition at line 44 of file dataOStream.h.


Member Function Documentation

CO_API void co::DataOStream::_enable ( ) [protected]

Enable output.

void co::DataOStream::_flush ( ) [protected]

Flush remaining data in the buffer.

void co::DataOStream::_initCompressor ( const uint32_t  compressor) [protected]

Initialize the given compressor.

void co::DataOStream::_resend ( ) [protected]

Resend the saved buffer to all enabled connections.

void co::DataOStream::_setupConnection ( NodePtr  node,
const bool  useMulticast 
) [protected]

Set up the connection (list) for one node.

CO_API void co::DataOStream::disable ( )

Disable and flush the output to the current receivers.

void co::DataOStream::disable ( const Packet packet)

Disable, then send the packet to the current receivers.

Disable copying of all data into a saved buffer.

Enable copying of all data into a saved buffer.

bool co::DataOStream::hasSentData ( ) const [inline]
Returns:
if data was sent since the last enable()

Definition at line 65 of file dataOStream.h.

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

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

Definition at line 71 of file dataOStream.h.

References write().

+ Here is the call graph for this function:

template<typename T >
DataOStream& co::DataOStream::operator<< ( const std::vector< T > &  value)

Write a std::vector of serializable items.

DataOStream & co::DataOStream::operator<< ( const std::string &  str) [inline]

Write a std::string.

Definition at line 213 of file dataOStream.h.

References write().

+ Here is the call graph for this function:

DataOStream & co::DataOStream::operator<< ( const Object *const &  object) [inline]

Write an object identifier and version.

Definition at line 225 of file dataOStream.h.

References co::Object::isAttached().

+ Here is the call graph for this function:

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

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

Definition at line 263 of file dataOStream.h.

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

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

Definition at line 268 of file dataOStream.h.

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

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

Definition at line 273 of file dataOStream.h.

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

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

Definition at line 278 of file dataOStream.h.

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

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

Definition at line 283 of file dataOStream.h.

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

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

Definition at line 288 of file dataOStream.h.

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

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

Definition at line 293 of file dataOStream.h.

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

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

Definition at line 298 of file dataOStream.h.

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

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

Definition at line 303 of file dataOStream.h.

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

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

Definition at line 308 of file dataOStream.h.

virtual CO_API void co::DataOStream::reset ( ) [protected, virtual]

Reset the whole stream.

virtual void co::DataOStream::sendData ( const void *  buffer,
const uint64_t  size,
const bool  last 
) [protected, pure virtual]

Send a data buffer (packet) to the receivers.

Implemented in co::OCommand.

template<typename C >
void co::DataOStream::serializeChildren ( const std::vector< C * > &  children)

Serialize child objects.

The DataIStream has a deserialize counterpart to this method. All child objects have to be registered or mapped beforehand.

CO_API void co::DataOStream::write ( const void *  data,
uint64_t  size 
)

Write a number of bytes from data into the stream.

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