Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
xstream::tee::ostreambuf Class Reference

fork output stream class More...

#include <tee.h>

+ Inheritance diagram for xstream::tee::ostreambuf:

Public Member Functions

 ostreambuf ()
 construct NOP object More...
 
void add (std::streambuf *sb)
 add an output streembuf to write to More...
 
void remove (std::streambuf *sb)
 remove a streambuf to write to More...
 
void add (std::ostream &os)
 add an output ostream to write to More...
 
void remove (std::ostream &os)
 remove an output ostream to write to More...
 
 ~ostreambuf ()
 closes the streambuf stream More...
 

Protected Member Functions

std::streamsize available () const
 remaining characters in the buffer More...
 
std::streamsize taken () const
 number of characters in the buffer More...
 

Private Member Functions

int sync ()
 flush as much data as possible (overloaded from streambuf) More...
 
int overflow (int c)
 write a character that supasses buffer end (overloaded from streambuf) More...
 
std::streamsize xsputn (const char *buffer, std::streamsize n)
 write an entire buffer (overloaded from streambuf) More...
 

Private Attributes

std::set< std::streambuf * > destinations
 

Detailed Description

fork output stream class

when data is written to it, it writes it to several other streambufs error handling is as follows:

  • if writting to a streambuf returns an error, that streambuf is removed from the internal list and no more data is written to it
  • when there is no streambuf left to write to eof is returned
Note
doesn't catch any exceptions, so let's the io library decide if they should be propagated

Definition at line 36 of file tee.h.

Constructor & Destructor Documentation

xstream::tee::ostreambuf::ostreambuf ( )
inline

construct NOP object

Definition at line 64 of file tee.h.

xstream::tee::ostreambuf::~ostreambuf ( )

closes the streambuf stream

Definition at line 130 of file tee.cpp.

Member Function Documentation

void xstream::tee::ostreambuf::add ( std::streambuf *  sb)

add an output streembuf to write to

Definition at line 15 of file tee.cpp.

References destinations, and LOG.

Referenced by main().

void xstream::tee::ostreambuf::add ( std::ostream &  os)

add an output ostream to write to

higher level syntatic sugar for the streambuf version

Definition at line 20 of file tee.cpp.

References destinations, and LOG.

std::streamsize xstream::ostreambuf::available ( ) const
inlineprotectedinherited

remaining characters in the buffer

Definition at line 28 of file common.h.

Referenced by xstream::base64::ostreambuf::~ostreambuf().

int xstream::tee::ostreambuf::overflow ( int  c)
private

write a character that supasses buffer end (overloaded from streambuf)

Definition at line 66 of file tee.cpp.

References c, destinations, xstream::tee::eof, and LOG.

void xstream::tee::ostreambuf::remove ( std::streambuf *  sb)

remove a streambuf to write to

Definition at line 25 of file tee.cpp.

References destinations, and LOG.

void xstream::tee::ostreambuf::remove ( std::ostream &  os)

remove an output ostream to write to

higher level syntatic sugar for the streambuf version

Definition at line 30 of file tee.cpp.

References destinations, and LOG.

int xstream::tee::ostreambuf::sync ( )
private

flush as much data as possible (overloaded from streambuf)

Definition at line 35 of file tee.cpp.

References destinations, xstream::tee::eof, and LOG.

std::streamsize xstream::ostreambuf::taken ( ) const
inlineprotectedinherited

number of characters in the buffer

Definition at line 36 of file common.h.

Referenced by xstream::digest::stream::xsputn().

std::streamsize xstream::tee::ostreambuf::xsputn ( const char *  buffer,
std::streamsize  n 
)
private

write an entire buffer (overloaded from streambuf)

Definition at line 98 of file tee.cpp.

References destinations, xstream::tee::eof, and LOG.

Member Data Documentation

std::set<std::streambuf*> xstream::tee::ostreambuf::destinations
private

set of streambufs to write to

Definition at line 40 of file tee.h.

Referenced by add(), overflow(), remove(), sync(), and xsputn().


The documentation for this class was generated from the following files: