1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
4 <TITLE>Function Template tee
</TITLE>
5 <LINK REL=
"stylesheet" HREF=
"../../../../boost.css">
6 <LINK REL=
"stylesheet" HREF=
"../theme/iostreams.css">
12 <H1 CLASS=
"title">Function Template
<CODE>tee
</CODE></H1>
17 <DL class=
"page-index">
18 <DT><A href=
"#description">Description
</A></DT>
19 <DT><A href=
"#headers">Headers
</A></DT>
20 <DT><A href=
"#reference">Reference
</A></DT>
25 <A NAME=
"description"></A>
29 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.
33 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 Sink or a pair of Sinks returns an appropriate specialization of
<CODE>tee_filter
</CODE> or
<CODE>tee_device
</CODE>.
36 <A NAME=
"headers"></A>
39 <DL class=
"page-index">
40 <DT><A CLASS=
"header" HREF=
"../../../../boost/iostreams/tee.hpp"><CODE><boost/iostreams/tee.hpp
></CODE></A></DT>
43 <A NAME=
"reference"></A>
46 <A NAME=
"synopsis"></A>
49 <PRE CLASS=
"broken_ie"><SPAN CLASS=
"keyword">namespace
</SPAN> boost {
<SPAN CLASS=
"keyword">namespace
</SPAN> iostreams {
51 <SPAN CLASS='keyword'
>template
</SPAN><<SPAN CLASS='keyword'
>typename
</SPAN> <A CLASS='documented' HREF='#tee_filter_template_params'
>Sink
</A>>
52 <SPAN CLASS='keyword'
>class
</SPAN> <A CLASS='documented' HREF='#tee_filter'
>tee_filter
</A> {
53 <SPAN CLASS='keyword'
>public:
</SPAN>
54 <SPAN CLASS='keyword'
>typedef
</SPAN> <SPAN CLASS='keyword'
>typename
</SPAN> char_type_of
<Sink
>::type char_type;
55 <SPAN CLASS='keyword'
>typedef
</SPAN> <SPAN CLASS='omitted'
>[implementation-defined]
</SPAN> category;
57 <SPAN CLASS='keyword'
>explicit
</SPAN> <A CLASS='documented' HREF='#tee_filter_ctor'
>tee_filter
</A>([
<SPAN CLASS='keyword'
>const
</SPAN>] Sink
& snk);
59 <SPAN CLASS='comment'
>// OutputFilter member functions
</SPAN>
62 <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>>
63 <SPAN CLASS='keyword'
>class
</SPAN> <A CLASS='documented' HREF='#tee_device'
>tee_device
</A> {
64 <SPAN CLASS='keyword'
>public:
</SPAN>
65 <SPAN CLASS='keyword'
>typedef
</SPAN> <SPAN CLASS='keyword'
>typename
</SPAN> char_type_of
<Sink1
>::type char_type;
66 <SPAN CLASS='keyword'
>typedef
</SPAN> <SPAN CLASS='omitted'
>[implementation-defined]
</SPAN> category;
68 <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);
70 <SPAN CLASS='comment'
>// Sink member functions
</SPAN>
73 <SPAN CLASS='keyword'
>template
</SPAN><<SPAN CLASS='keyword'
>typename
</SPAN> <A CLASS='documented' HREF='#tee_unary_template_params'
>Sink
</A>>
74 <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);
76 <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>>
77 <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);
80 } } // End namespace boost::io
</PRE>
82 <A NAME=
"tee_filter"></A>
83 <H2>Class Template
<CODE>tee_filter
</CODE></H2>
87 <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>
89 <A NAME=
"tee_filter_template_params"></A>
90 <H4>Template parameters
</H4>
92 <TABLE STYLE=
"margin-left:2em" BORDER=
0 CELLPADDING=
2>
95 <TD VALIGN=
"top"><I>Sink
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
96 <TD>A
<A HREF='../concepts/blocking.html'
>Blocking
</A> <A HREF='../concepts/sink.html'
>Sink
</A></TD>
100 <A NAME=
"tee_filter_ctor"></A>
101 <H4><CODE>tee_filter::tee_filter
</CODE></H4>
103 <PRE CLASS=
"broken_ie"><SPAN CLASS='keyword'
>explicit
</SPAN> tee_filter([
<SPAN CLASS='keyword'
>const
</SPAN>] Sink
& sink);
</PRE>
106 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.
109 <A NAME=
"tee_device"></A>
110 <H2>Class Template
<CODE>tee_device
</CODE></H2>
114 <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>
116 <A NAME=
"tee_device_template_params"></A>
117 <H4>Template parameters
</H4>
119 <TABLE STYLE=
"margin-left:2em" BORDER=
0 CELLPADDING=
2>
122 <TD VALIGN=
"top"><I>Sink1
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
123 <TD>A
<A HREF='../concepts/blocking.html'
>Blocking
</A> <A HREF='../concepts/sink.html'
>Sink
</A></TD>
126 <TD VALIGN=
"top"><I>Sink2
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
127 <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>
131 <A NAME=
"tee_device_ctor"></A>
132 <H4><CODE>tee_device::tee_device
</CODE></H4>
134 <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>
137 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.
141 <A NAME=
"tee_unary"></A>
142 <H2>Function Template
<CODE>tee
</CODE></H2>
144 <PRE CLASS=
"broken_ie"><SPAN CLASS='keyword'
>template
</SPAN><<SPAN CLASS='keyword'
>typename
</SPAN> Sink
>
145 tee_filter
<Sink
> tee([
<SPAN CLASS='keyword'
>const
</SPAN>] Sink
& snk);
</PRE>
147 <A NAME=
"tee_unary_template_params"></A>
148 <H4>Template parameters
</H4>
149 <TABLE STYLE=
"margin-left:2em" BORDER=
0 CELLPADDING=
2>
152 <TD VALIGN=
"top"><I>Sink
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
153 <TD>A
<A HREF='../concepts/blocking.html'
>Blocking
</A> <A HREF='../concepts/sink.html'
>Sink
</A></TD>
158 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.
161 <A NAME=
"tee_binary"></A>
162 <PRE CLASS=
"broken_ie"><SPAN CLASS='keyword'
>template
</SPAN><<SPAN CLASS='keyword'
>typename
</SPAN> Sink1,
<SPAN CLASS='keyword'
>typename
</SPAN> Sink2
>
163 tee_device
<Sink1, Sink2
> tee([
<SPAN CLASS='keyword'
>const
</SPAN>] Sink1
& sink1, [
<SPAN CLASS='keyword'
>const
</SPAN>] Sink2
& sink2);
</PRE>
165 <A NAME=
"tee_binary_template_params"></A>
166 <H4>Template parameters
</H4>
167 <TABLE STYLE=
"margin-left:2em" BORDER=
0 CELLPADDING=
2>
170 <TD VALIGN=
"top"><I>Sink1
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
171 <TD>A
<A HREF='../concepts/blocking.html'
>Blocking
</A> <A HREF='../concepts/sink.html'
>Sink
</A></TD>
174 <TD VALIGN=
"top"><I>Sink2
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
175 <TD>A
<A HREF='../concepts/blocking.html'
>Blocking
</A> <A HREF='../concepts/sink.html'
>Sink
</A></TD>
180 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.
183 <!-- Begin Footer -->
187 <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>
188 <P CLASS=
"copyright">
189 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>)