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 (const ConnectionVector &receivers)
void enable (const NodePtr node)
void enable ()
void resend (const 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

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.


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


Member Function Documentation

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

Resend the saved buffer.

Definition at line 96 of file dataOStream.cpp.

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

Referenced by eq::net::DeltaMasterCM::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 112 of file dataOStream.cpp.

References _connections, eq::base::Buffer< T >::getData(), eq::base::Buffer< T >::getSize(), 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 150 of file dataOStream.cpp.

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

Disable aggregation/copy of data before sending it.

Definition at line 155 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 164 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 171 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 69 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 72 of file dataOStream.h.

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

Flush remaining data in the buffer.

Definition at line 212 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 83 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 88 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 178 of file dataOStream.cpp.

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

Referenced by operator<<().

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 194 of file dataOStream.cpp.

References _connections, eq::base::Buffer< T >::append(), 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.

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

Write a std::string.

Definition at line 171 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 183 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 193 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 201 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 209 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 217 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 225 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 233 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 241 of file dataOStream.h.


The documentation for this class was generated from the following files:
Generated on Mon Aug 10 18:58:44 2009 for Equalizer 0.9 by  doxygen 1.5.8