Function Template tee

Description
Headers
Reference

Description

The class templates tee_filter and tee_device provide two ways to split an output sequence so that all data is directed simultaneously to two different locations. A tee_filter is an OutputFilter which copies all data to a Sink specified at construction in addition to passing it downstream unmodified. A tee_device is a Sink which copies all data to two Sinks specified at construction.

The overloaded function template tee is an object generator which given a Device or a pair of Sinks returns an appropriate specialization of tee_filter or tee_device.

Headers

<boost/iostreams/tee.hpp>

Reference

Synopsis

namespace boost { namespace iostreams {

template<typename Sink>
class tee_filter {
public:
    typedef typename char_type_of<Sink>::type  char_type;
    typedef [implementation-defined]           category;

    explicit tee_filter([const] Sink& snk);

    // OutputFilter member functions
};

template<typename Sink1, typename Sink2>
class tee_device {
public:
    typedef typename char_type_of<Sink1>::type  char_type;
    typedef [implementation-defined]            category;

    tee_device([const] const& sink1, [const] Sink2& sink2);

    // Sink member functions
};

template<typename Sink>
tee_filter<Sink> tee([const] Sink& snk);

template<typename Sink1, typename Sink2>
tee_device<Sink1, Sink2> tee([const] Sink1& sink1, [const] Sink2& sink2);


} } // End namespace boost::io

Class Template tee_filter

Description

An OutputFilter which copies all data which passes through it to a Sink specified at construction. A tee_filter is Closable, Flushable, Localizable and OptimallyBuffered.

Template parameters

Sink- A Blocking Sink

tee_filter::tee_filter

explicit tee_filter([const] Sink& sink);

Constructs an instance of tee_filter based on the given Sink. The function parameter is a non-const reference if Sink is a stream or stream buffer type, and a const reference otherwise.

Class Template tee_device

Description

A Sink which copies all data to each of two Sinks specified at construction. A tee_device is Closable, Flushable, Localizable and OptimallyBuffered.

Template parameters

Sink1- A Blocking Sink
Sink2- A Blocking Sink with the same character type as Sink1

tee_device::tee_device

tee_device([const] const& sink1, [const] Sink2& sink2);

Constructs an instance of tee_device based on the given pair of Sinks. Each function parameter is a non-const reference if the corresponding template argument is a stream or stream buffer type, and a const reference otherwise.

Function Template tee

template<typename Sink>
tee_filter<Sink> tee([const] Sink& snk);

Template parameters

Sink- A Blocking Sink

Constructs an instance of an appropriate specialization of tee_filter based on the given Sink. The function parameter is a non-const reference if Sink is a stream or stream buffer type, and a const reference otherwise.

template<typename Sink1, typename Sink2>
tee_device<Sink1, Sink2> tee([const] Sink1& sink1, [const] Sink2& sink2);

Template parameters

Sink1- A Blocking Sink
Sink2- A Blocking Sink

Constructs an instance of an appropriate specialization of tee_device based on the given pair of Sinks. Each function parameter is a non-const reference if the corresponding template argument is a stream or stream buffer type, and a const reference otherwise.