FleCSI Core API Version: 2.3.2
 
Loading...
Searching...
No Matches
tee_buffer_t Class Reference

The tee_buffer_t type provides a stream buffer that allows output to multiple targets. More...

Classes

struct  buffer_data_t
 The buffer_data_t type is used to hold state and the actual low-level stream buffer pointer. More...
 

Public Member Functions

void add_buffer (std::string key, std::streambuf *sb, bool colorized)
 Add a buffer to which output should be written.
 
void disable_buffer (std::string key)
 Disable a buffer so that output is not written to it.
 
void enable_buffer (std::string key)
 Enable a buffer so that output is written to it.
 

Protected Member Functions

virtual int overflow (int c)
 Override the overflow method.
 
virtual int sync ()
 Override the sync method so that we sync all of the output buffers.
 

Detailed Description

The tee_buffer_t type provides a stream buffer that allows output to multiple targets.

Member Function Documentation

◆ add_buffer()

void add_buffer ( std::string key,
std::streambuf * sb,
bool colorized )

Add a buffer to which output should be written.

This also enables the buffer,i.e., output will be written to it. For a given key, only the first call to this method will have an effect.

◆ enable_buffer()

void enable_buffer ( std::string key)

Enable a buffer so that output is written to it.

This is mainly for buffers that have been disabled and need to be re-enabled.

◆ disable_buffer()

void disable_buffer ( std::string key)

Disable a buffer so that output is not written to it.

◆ overflow()

virtual int overflow ( int c)
protectedvirtual

Override the overflow method.

This streambuf has no buffer, so overflow happens for every character that is written to the string, allowing us to write to multiple output streams. This method also detects colorization strings embedded in the character stream and removes them from output that is going to non-colorized buffers.

Parameters
cThe character to write. This is passed in as an int so that non-characters like EOF can be written to the stream.

◆ sync()

virtual int sync ( )
protectedvirtual

Override the sync method so that we sync all of the output buffers.