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:
Inheritance graph
[legend]
Collaboration diagram for eq::net::DataOStream:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Internal



 DataOStream ()
virtual ~DataOStream ()
void enable (const NodeVector &receivers)
 Enable output, locks the connections to the receivers.
void enable (NodePtr node)
void enable ()
void resend (NodePtr node)
 Resend the saved buffer.
void disable ()
 Disable, flush and unlock the output to the current receivers.
void enableBuffering ()
 Enable aggregation/copy of data before sending it.
void disableBuffering ()
 Disable aggregation/copy of data before sending it.
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



void flush ()
 Flush remaining data in the buffer.
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.
void writeOnce (const void *data, uint64_t size)
 Write one block of data into the stream and close it immediately.
Specialized output operators



template<>
DataOStreamoperator<< (const std::string &str)
 Write a std::string.
template<>
DataOStreamoperator<< (const base::UUID &id)
 Write a base::UUID.
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.

Protected Member Functions

virtual void reset ()
 Reset the whole stream.
Packet sending, implemented by the subclasses



virtual void sendHeader (const void *buffer, const uint64_t size)=0
 Send the leading data (packet) to the receivers.
virtual void sendBuffer (const void *buffer, const uint64_t size)=0
 Send a data buffer (packet) to the receivers.
virtual void sendFooter (const void *buffer, const uint64_t size)=0
 Send the trailing data (packet) to the receivers.
virtual void sendSingle (const void *buffer, const uint64_t size)
 Send only one data item (packet) to the receivers.

Protected Attributes

ConnectionVector _connections
 Locked connections to the receivers, if _enabled.

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


Member Function Documentation

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

Resend the saved buffer.

Definition at line 106 of file dataOStream.cpp.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Definition at line 125 of file dataOStream.cpp.

References _connections, eq::base::Buffer< T >::getData(), eq::base::Buffer< T >::getSize(), reset(), sendFooter(), and sendSingle().

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::enableBuffering (  ) 

Enable aggregation/copy of data before sending it.

Definition at line 163 of file dataOStream.cpp.

void eq::net::DataOStream::disableBuffering (  ) 

Disable aggregation/copy of data before sending it.

Definition at line 168 of file dataOStream.cpp.

References flush().

Here is the call graph for this function:

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

Enable copying of all data into a saved buffer.

Definition at line 177 of file dataOStream.cpp.

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

Here is the call graph for this function:

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

Disable copying of all data into a saved buffer.

Definition at line 184 of file dataOStream.cpp.

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

Here is the call graph for this function:

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

Definition at line 72 of file dataOStream.h.

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

Here is the caller graph for this function:

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

Definition at line 75 of file dataOStream.h.

void eq::net::DataOStream::flush (  ) 

Flush remaining data in the buffer.

Definition at line 225 of file dataOStream.cpp.

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

Referenced by disableBuffering(), and write().

Here is the call graph for this function:

Here is the caller graph for this function:

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

References write().

Here is the call graph for this function:

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

Write a std::vector of serializable items.

Definition at line 91 of file dataOStream.h.

References write().

Here is the call graph for this function:

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

Write a number of bytes from data into the stream.

Definition at line 191 of file dataOStream.cpp.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Write one block of data into the stream and close it immediately.

Definition at line 207 of file dataOStream.cpp.

References _connections, eq::base::Buffer< T >::append(), reset(), and sendSingle().

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

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void eq::net::DataOStream::sendBuffer ( const void *  buffer,
const uint64_t  size 
) [protected, pure virtual]

Send a data buffer (packet) to the receivers.

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

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

Reset the whole stream.

Reimplemented in eq::net::ObjectDataOStream.

Definition at line 233 of file dataOStream.cpp.

Referenced by disable(), and writeOnce().

Here is the caller graph for this function:

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

Write a std::string.

Definition at line 176 of file dataOStream.h.

References write().

Here is the call graph for this function:

template<>
DataOStream& eq::net::DataOStream::operator<< ( const base::UUID id  )  [inline]

Write a base::UUID.

Definition at line 188 of file dataOStream.h.

References eq::base::UUID::convertToNetwork(), and write().

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

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 214 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 222 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 230 of file dataOStream.h.

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

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

Definition at line 238 of file dataOStream.h.

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

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

Definition at line 246 of file dataOStream.h.


The documentation for this class was generated from the following files:
Generated on Sat Feb 6 13:09:08 2010 for Equalizer 0.9.1 by  doxygen 1.6.1