Protected Member Functions | Protected Attributes | Friends

eq::net::DataOStream Class Reference

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

#include <dataOStream.h>

Inheritance diagram for eq::net::DataOStream:
Collaboration diagram for eq::net::DataOStream:

List of all members.

Public Member Functions

Internal

 DataOStream ()
virtual ~DataOStream ()
void enable (const Nodes &receivers)
 Enable output, locks the connections to the receivers.
void enable (NodePtr node, const bool useMulticast)
void enable ()
void resend (NodePtr node)
 Resend the saved buffer.
void disable ()
 Disable, flush and unlock the output 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
const base::BufferbgetSaveBuffer () 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.
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< 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 _flush ()
 Flush remaining data in the buffer.
virtual void reset ()
 Reset the whole stream.
Packet sending, implemented by the subclasses

virtual void sendData (const uint32_t compressor, const uint32_t nChunks, const void *const *chunks, const uint64_t *chunkSizes, const uint64_t sizeUncompressed)=0
 Send a data buffer (packet) to the receivers.
virtual void sendFooter (const uint32_t compressor, const uint32_t nChunks, const void *const *chunks, const uint64_t *chunkSizes, const uint64_t sizeUncompressed)=0
 Send the trailing data (packet) to the receivers.

Protected Attributes

Connections _connections
 Locked connections to the receivers, if _enabled.
base::CPUCompressor *const compressor

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


Member Function Documentation

void eq::net::DataOStream::_flush (  )  [protected]

Flush remaining data in the buffer.

Definition at line 203 of file dataOStream.cpp.

References eq::base::Buffer< T >::append(), eq::net::Global::getObjectBufferSize(), and eq::base::Buffer< T >::getSize().

Here is the call graph for this function:

void eq::net::DataOStream::disable (  ) 

Disable, flush and unlock the output to the current receivers.

Definition at line 134 of file dataOStream.cpp.

References eq::base::Buffer< T >::getData(), and eq::base::Buffer< T >::getSize().

Referenced by eq::net::UnbufferedMasterCM::addSlave(), and eq::net::StaticMasterCM::addSlave().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::net::DataOStream::disableSave (  ) 

Disable copying of all data into a saved buffer.

Definition at line 182 of file dataOStream.cpp.

void eq::net::DataOStream::enableSave (  ) 

Enable copying of all data into a saved buffer.

Definition at line 175 of file dataOStream.cpp.

References eq::base::Buffer< T >::getData(), and eq::base::Buffer< T >::getSize().

Here is the call graph for this function:

const base::Bufferb& eq::net::DataOStream::getSaveBuffer (  )  const [inline]
Returns:
the buffer with the saved data.

Definition at line 71 of file dataOStream.h.

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

Definition at line 68 of file dataOStream.h.

Referenced by eq::net::UnbufferedMasterCM::addSlave().

Here is the caller graph for this function:

template<>
DataOStream& eq::net::DataOStream::operator<< ( const Object *const &  object  )  [inline]

Write an object identifier and version.

Definition at line 210 of file dataOStream.h.

References eq::net::Object::isAttached().

Here is the call graph for this function:

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

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

Definition at line 248 of file dataOStream.h.

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

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

Definition at line 253 of file dataOStream.h.

template<>
DataOStream& eq::net::DataOStream::operator<< ( const std::string &  str  )  [inline]

Write a std::string.

Definition at line 198 of file dataOStream.h.

References write().

Here is the call graph for this function:

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

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

Definition at line 273 of file dataOStream.h.

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

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

Definition at line 78 of file dataOStream.h.

References write().

Here is the call graph for this function:

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

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

Definition at line 278 of file dataOStream.h.

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

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

Definition at line 268 of file dataOStream.h.

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

Write a std::vector of serializable items.

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

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

Definition at line 258 of file dataOStream.h.

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

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

Definition at line 263 of file dataOStream.h.

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

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

Definition at line 283 of file dataOStream.h.

void eq::net::DataOStream::resend ( NodePtr  node  ) 

Resend the saved buffer.

Definition at line 113 of file dataOStream.cpp.

References enable().

Here is the call graph for this function:

void eq::net::DataOStream::reset (  )  [protected, virtual]

Reset the whole stream.

Reimplemented in eq::net::ObjectDataOStream.

Definition at line 219 of file dataOStream.cpp.

References eq::base::Buffer< T >::getData(), and eq::base::Buffer< T >::getSize().

Here is the call graph for this function:

virtual void eq::net::DataOStream::sendData ( const uint32_t  compressor,
const uint32_t  nChunks,
const void *const *  chunks,
const uint64_t *  chunkSizes,
const uint64_t  sizeUncompressed 
) [protected, pure virtual]

Send a data buffer (packet) to the receivers.

Implemented in eq::net::ObjectDeltaDataOStream, eq::net::ObjectInstanceDataOStream, and eq::net::ObjectSlaveDataOStream.

template<typename C >
void eq::net::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.

void eq::net::DataOStream::write ( const void *  data,
uint64_t  size 
)

Write a number of bytes from data into the stream.

Definition at line 189 of file dataOStream.cpp.

References eq::base::Buffer< T >::getSize().

Referenced by operator<<(), eqNbody::SharedDataProxy::serialize(), and eqNbody::FrameData::serialize().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Sun Aug 29 2010 13:53:46 for Equalizer 0.9.1 by  doxygen 1.7.1