OpenMD  2.5
Molecular Dynamics in the Open
OpenMD::basic_teebuf< CharT, Traits > Class Template Reference

As a subclass of basic_streambuf, basic_teebuf can operate on multiple stream simultaneously. More...

#include "utils/basic_teebuf.hpp"

Inheritance diagram for OpenMD::basic_teebuf< CharT, Traits >:

Public Types

typedef std::basic_streambuf< CharT, Traits > streambuf_type
 
typedef Traits traits_type
 
typedef CharT char_type
 
typedef traits_type::int_type int_type
 

Public Member Functions

template<typename ForwardIterator >
 basic_teebuf (ForwardIterator begin, ForwardIterator end)
 

Protected Member Functions

int_type overflow (int_type c=traits_type::eof())
 
int sync ()
 

Private Attributes

std::vector< streambuf_type * > buffers_
 

Detailed Description

template<class CharT, class Traits = std::char_traits<CharT>>
class OpenMD::basic_teebuf< CharT, Traits >

As a subclass of basic_streambuf, basic_teebuf can operate on multiple stream simultaneously.

std::ofstream file1("file1");
std::ofstream file2("file22");
std::vector<std::streambuf*> buffers;
buffers.push_back(file1.rdbuf());
buffers.push_back(file2.rdbuf());
teebuf tmp(buffers.begin(), buffers.end());
std::ostream myOs(&tmp);
myOs << "hello world";

Definition at line 65 of file basic_teebuf.hpp.

Member Typedef Documentation

◆ char_type

template<class CharT , class Traits = std::char_traits<CharT>>
typedef CharT OpenMD::basic_teebuf< CharT, Traits >::char_type

Definition at line 69 of file basic_teebuf.hpp.

◆ int_type

template<class CharT , class Traits = std::char_traits<CharT>>
typedef traits_type::int_type OpenMD::basic_teebuf< CharT, Traits >::int_type

Definition at line 70 of file basic_teebuf.hpp.

◆ streambuf_type

template<class CharT , class Traits = std::char_traits<CharT>>
typedef std::basic_streambuf<CharT, Traits> OpenMD::basic_teebuf< CharT, Traits >::streambuf_type

Definition at line 67 of file basic_teebuf.hpp.

◆ traits_type

template<class CharT , class Traits = std::char_traits<CharT>>
typedef Traits OpenMD::basic_teebuf< CharT, Traits >::traits_type

Definition at line 68 of file basic_teebuf.hpp.

Constructor & Destructor Documentation

◆ basic_teebuf()

template<class CharT , class Traits = std::char_traits<CharT>>
template<typename ForwardIterator >
OpenMD::basic_teebuf< CharT, Traits >::basic_teebuf ( ForwardIterator  begin,
ForwardIterator  end 
)
inline

Definition at line 73 of file basic_teebuf.hpp.

Member Function Documentation

◆ overflow()

template<class CharT , class Traits = std::char_traits<CharT>>
int_type OpenMD::basic_teebuf< CharT, Traits >::overflow ( int_type  c = traits_type::eof())
inlineprotected

◆ sync()

template<class CharT , class Traits = std::char_traits<CharT>>
int OpenMD::basic_teebuf< CharT, Traits >::sync ( )
inlineprotected

Member Data Documentation

◆ buffers_

template<class CharT , class Traits = std::char_traits<CharT>>
std::vector<streambuf_type*> OpenMD::basic_teebuf< CharT, Traits >::buffers_
private

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