Collage
0.6.1
|
A std::ostream buffering and/or retaining data in a binary format. More...
#include <dataOStream.h>
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 > | |
DataOStream & | operator<< (const T &value) |
Write a plain data item by copying it to the stream. | |
template<typename T > | |
DataOStream & | operator<< (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<> | |
DataOStream & | operator<< (const std::string &str) |
Write a std::string. | |
template<> | |
DataOStream & | operator<< (const Object *const &object) |
Write an object identifier and version. | |
template<> | |
DataOStream & | operator<< (const std::vector< uint8_t > &value) |
Optimized specialization to write a std::vector of uint8_t. | |
template<> | |
DataOStream & | operator<< (const std::vector< uint16_t > &value) |
Optimized specialization to write a std::vector of uint16_t. | |
template<> | |
DataOStream & | operator<< (const std::vector< int16_t > &value) |
Optimized specialization to write a std::vector of int16_t. | |
template<> | |
DataOStream & | operator<< (const std::vector< uint32_t > &value) |
Optimized specialization to write a std::vector of uint32_t. | |
template<> | |
DataOStream & | operator<< (const std::vector< int32_t > &value) |
Optimized specialization to write a std::vector of int32_t. | |
template<> | |
DataOStream & | operator<< (const std::vector< uint64_t > &value) |
Optimized specialization to write a std::vector of uint64_t. | |
template<> | |
DataOStream & | operator<< (const std::vector< int64_t > &value) |
Optimized specialization to write a std::vector of int64_t. | |
template<> | |
DataOStream & | operator<< (const std::vector< float > &value) |
Optimized specialization to write a std::vector of float. | |
template<> | |
DataOStream & | operator<< (const std::vector< double > &value) |
Optimized specialization to write a std::vector of double. | |
template<> | |
DataOStream & | operator<< (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 |
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.
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.
void co::DataOStream::disableSave | ( | ) |
Disable copying of all data into a saved buffer.
void co::DataOStream::enableSave | ( | ) |
Enable copying of all data into a saved buffer.
bool co::DataOStream::hasSentData | ( | ) | const [inline] |
Definition at line 65 of file dataOStream.h.
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().
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().
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().
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.
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<<().