| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <HTML> |
| <HEAD> |
| <TITLE>Function Template tee</TITLE> |
| <LINK REL="stylesheet" HREF="../../../../boost.css"> |
| <LINK REL="stylesheet" HREF="../theme/iostreams.css"> |
| </HEAD> |
| <BODY> |
| |
| <!-- Begin Banner --> |
| |
| <H1 CLASS="title">Function Template <CODE>tee</CODE></H1> |
| <HR CLASS="banner"> |
| |
| <!-- End Banner --> |
| |
| <DL class="page-index"> |
| <DT><A href="#description">Description</A></DT> |
| <DT><A href="#headers">Headers</A></DT> |
| <DT><A href="#reference">Reference</A></DT> |
| </DL> |
| |
| <HR> |
| |
| <A NAME="description"></A> |
| <H2>Description</H2> |
| |
| <P> |
| The class templates <CODE>tee_filter</CODE> and <CODE>tee_device</CODE> provide two ways to split an output sequence so that all data is directed simultaneously to two different locations. A <CODE>tee_filter</CODE> is an <A HREF="../concepts/output_filter.html">OutputFilter</A> which copies all data to a <A HREF="../concepts/sink.html">Sink</A> specified at construction in addition to passing it downstream unmodified. A <CODE>tee_device</CODE> is a <A HREF="../concepts/sink.html">Sink</A> which copies all data to two Sinks specified at construction. |
| </P> |
| |
| <P> |
| The overloaded function template <A HREF='#tee'><CODE>tee</CODE></A> is an <A HREF='http://www.boost.org/more/generic_programming.html#object_generator' TARGET='_top'>object generator</A> which given a Device or a pair of Sinks returns an appropriate specialization of <CODE>tee_filter</CODE> or <CODE>tee_device</CODE>. |
| </P> |
| |
| <A NAME="headers"></A> |
| <H2>Headers</H2> |
| |
| <DL class="page-index"> |
| <DT><A CLASS="header" HREF="../../../../boost/iostreams/tee.hpp"><CODE><boost/iostreams/tee.hpp></CODE></A></DT> |
| </DL> |
| |
| <A NAME="reference"></A> |
| <H2>Reference</H2> |
| |
| <A NAME="synopsis"></A> |
| <H4>Synopsis</H4> |
| |
| <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams { |
| |
| <SPAN CLASS='keyword'>template</SPAN><<SPAN CLASS='keyword'>typename</SPAN> <A CLASS='documented' HREF='#tee_filter_template_params'>Sink</A>> |
| <SPAN CLASS='keyword'>class</SPAN> <A CLASS='documented' HREF='#tee_filter'>tee_filter</A> { |
| <SPAN CLASS='keyword'>public:</SPAN> |
| <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='keyword'>typename</SPAN> char_type_of<Sink>::type char_type; |
| <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='omitted'>[implementation-defined]</SPAN> category; |
| |
| <SPAN CLASS='keyword'>explicit</SPAN> <A CLASS='documented' HREF='#tee_filter_ctor'>tee_filter</A>([<SPAN CLASS='keyword'>const</SPAN>] Sink& snk); |
| |
| <SPAN CLASS='comment'>// OutputFilter member functions</SPAN> |
| }; |
| |
| <SPAN CLASS='keyword'>template</SPAN><<SPAN CLASS='keyword'>typename</SPAN> <A CLASS='documented' HREF='#tee_device_template_params'>Sink1</A>, <SPAN CLASS='keyword'>typename</SPAN> <A CLASS='documented' HREF='#tee_device_template_params'>Sink2</A>> |
| <SPAN CLASS='keyword'>class</SPAN> <A CLASS='documented' HREF='#tee_device'>tee_device</A> { |
| <SPAN CLASS='keyword'>public:</SPAN> |
| <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='keyword'>typename</SPAN> char_type_of<Sink1>::type char_type; |
| <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='omitted'>[implementation-defined]</SPAN> category; |
| |
| <A CLASS='documented' HREF='#tee_device_ctor'>tee_device</A>([<SPAN CLASS='keyword'>const</SPAN>] <SPAN CLASS='keyword'>const</SPAN>& sink1, [<SPAN CLASS='keyword'>const</SPAN>] Sink2& sink2); |
| |
| <SPAN CLASS='comment'>// Sink member functions</SPAN> |
| }; |
| |
| <SPAN CLASS='keyword'>template</SPAN><<SPAN CLASS='keyword'>typename</SPAN> <A CLASS='documented' HREF='#tee_unary_template_params'>Sink</A>> |
| <A CLASS='documented' HREF='#tee_filter'>tee_filter</A><Sink> <A CLASS='documented' HREF='#tee_unary'>tee</A>([<SPAN CLASS='keyword'>const</SPAN>] Sink& snk); |
| |
| <SPAN CLASS='keyword'>template</SPAN><<SPAN CLASS='keyword'>typename</SPAN> <A CLASS='documented' HREF='#tee_binary_template_params'>Sink1</A>, <SPAN CLASS='keyword'>typename</SPAN> <A CLASS='documented' HREF='#tee_binary_template_params'>Sink2</A>> |
| <A CLASS='documented' HREF='#tee_device'>tee_device</A><Sink1, Sink2> <A CLASS='documented' HREF='#tee_binary'>tee</A>([<SPAN CLASS='keyword'>const</SPAN>] Sink1& sink1, [<SPAN CLASS='keyword'>const</SPAN>] Sink2& sink2); |
| |
| |
| } } // End namespace boost::io</PRE> |
| |
| <A NAME="tee_filter"></A> |
| <H2>Class Template <CODE>tee_filter</CODE></H2> |
| |
| <H4>Description</H4> |
| |
| <P>An <A HREF='../concepts/output_filter.html'>OutputFilter</A> which copies all data which passes through it to a <A HREF='../concepts/sink.html'>Sink</A> specified at construction. A <CODE>tee_filter</CODE> is <A HREF='../concepts/closable.html'>Closable</A>, <A HREF='../concepts/flushable.html'>Flushable</A>, <A HREF='../concepts/localizable.html'>Localizable</A> and <A HREF='../concepts/optimally_buffered.html'>OptimallyBuffered</A>.</P> |
| |
| <A NAME="tee_filter_template_params"></A> |
| <H4>Template parameters</H4> |
| |
| <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> |
| <TR> |
| <TR> |
| <TD VALIGN="top"><I>Sink</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> |
| <TD>A <A HREF='../concepts/blocking.html'>Blocking</A> <A HREF='../concepts/sink.html'>Sink</A></TD> |
| </TR> |
| </TABLE> |
| |
| <A NAME="tee_filter_ctor"></A> |
| <H4><CODE>tee_filter::tee_filter</CODE></H4> |
| |
| <PRE CLASS="broken_ie"><SPAN CLASS='keyword'>explicit</SPAN> tee_filter([<SPAN CLASS='keyword'>const</SPAN>] Sink& sink);</PRE> |
| |
| <P> |
| Constructs an instance of <CODE>tee_filter</CODE> based on the given Sink. The function parameter is a non-<CODE>const</CODE> reference if <CODE>Sink</CODE> is a stream or stream buffer type, and a <CODE>const</CODE> reference otherwise. |
| </P> |
| |
| <A NAME="tee_device"></A> |
| <H2>Class Template <CODE>tee_device</CODE></H2> |
| |
| <H4>Description</H4> |
| |
| <P>A <A HREF='../concepts/sink.html'>Sink</A> which copies all data to each of two Sinks specified at construction. A <CODE>tee_device</CODE> is <A HREF='../concepts/closable.html'>Closable</A>, <A HREF='../concepts/flushable.html'>Flushable</A>, <A HREF='../concepts/localizable.html'>Localizable</A> and <A HREF='../concepts/optimally_buffered.html'>OptimallyBuffered</A>.</P> |
| |
| <A NAME="tee_device_template_params"></A> |
| <H4>Template parameters</H4> |
| |
| <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> |
| <TR> |
| <TR> |
| <TD VALIGN="top"><I>Sink1</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> |
| <TD>A <A HREF='../concepts/blocking.html'>Blocking</A> <A HREF='../concepts/sink.html'>Sink</A></TD> |
| </TR> |
| <TR> |
| <TD VALIGN="top"><I>Sink2</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> |
| <TD>A <A HREF='../concepts/blocking.html'>Blocking</A> <A HREF='../concepts/sink.html'>Sink</A> with the same <A HREF='../guide/traits.html#char_type'>character type</A> as <I>Sink1</I></TD> |
| </TR> |
| </TABLE> |
| |
| <A NAME="tee_device_ctor"></A> |
| <H4><CODE>tee_device::tee_device</CODE></H4> |
| |
| <PRE CLASS="broken_ie">tee_device([<SPAN CLASS='keyword'>const</SPAN>] <SPAN CLASS='keyword'>const</SPAN>& sink1, [<SPAN CLASS='keyword'>const</SPAN>] Sink2& sink2);</PRE> |
| |
| <P> |
| Constructs an instance of <CODE>tee_device</CODE> based on the given pair of Sinks. Each function parameter is a non-<CODE>const</CODE> reference if the corresponding template argument is a stream or stream buffer type, and a <CODE>const</CODE> reference otherwise. |
| </P> |
| |
| <A NAME="tee"></A> |
| <A NAME="tee_unary"></A> |
| <H2>Function Template <CODE>tee</CODE></H2> |
| |
| <PRE CLASS="broken_ie"><SPAN CLASS='keyword'>template</SPAN><<SPAN CLASS='keyword'>typename</SPAN> Sink> |
| tee_filter<Sink> tee([<SPAN CLASS='keyword'>const</SPAN>] Sink& snk);</PRE> |
| |
| <A NAME="tee_unary_template_params"></A> |
| <H4>Template parameters</H4> |
| <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> |
| <TR> |
| <TR> |
| <TD VALIGN="top"><I>Sink</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> |
| <TD>A <A HREF='../concepts/blocking.html'>Blocking</A> <A HREF='../concepts/sink.html'>Sink</A></TD> |
| </TR> |
| </TABLE> |
| |
| <P> |
| Constructs an instance of an appropriate specialization of <CODE>tee_filter</CODE> based on the given Sink. The function parameter is a non-<CODE>const</CODE> reference if <CODE>Sink</CODE> is a stream or stream buffer type, and a <CODE>const</CODE> reference otherwise. |
| </P> |
| |
| <A NAME="tee_binary"></A> |
| <PRE CLASS="broken_ie"><SPAN CLASS='keyword'>template</SPAN><<SPAN CLASS='keyword'>typename</SPAN> Sink1, <SPAN CLASS='keyword'>typename</SPAN> Sink2> |
| tee_device<Sink1, Sink2> tee([<SPAN CLASS='keyword'>const</SPAN>] Sink1& sink1, [<SPAN CLASS='keyword'>const</SPAN>] Sink2& sink2);</PRE> |
| |
| <A NAME="tee_binary_template_params"></A> |
| <H4>Template parameters</H4> |
| <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> |
| <TR> |
| <TR> |
| <TD VALIGN="top"><I>Sink1</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> |
| <TD>A <A HREF='../concepts/blocking.html'>Blocking</A> <A HREF='../concepts/sink.html'>Sink</A></TD> |
| </TR> |
| <TR> |
| <TD VALIGN="top"><I>Sink2</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> |
| <TD>A <A HREF='../concepts/blocking.html'>Blocking</A> <A HREF='../concepts/sink.html'>Sink</A></TD> |
| </TR> |
| </TABLE> |
| |
| <P> |
| Constructs an instance of an appropriate specialization of <CODE>tee_device</CODE> based on the given pair of Sinks. Each function parameter is a non-<CODE>const</CODE> reference if the corresponding template argument is a stream or stream buffer type, and a <CODE>const</CODE> reference otherwise. |
| </P> |
| |
| <!-- Begin Footer --> |
| |
| <HR> |
| <P CLASS="copyright">Revised 02 Feb 2008</P> |
| |
| <P CLASS="copyright">© Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>© Copyright 2004-2007 <a href="http://www.coderage.com/turkanis/" target="_top">Jonathan Turkanis</a></P> |
| <P CLASS="copyright"> |
| Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <A HREF="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>) |
| </P> |
| |
| <!-- End Footer --> |
| |
| </BODY> |