• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4    <TITLE>Function Template tee</TITLE>
5    <LINK REL="stylesheet" HREF="../../../../boost.css">
6    <LINK REL="stylesheet" HREF="../theme/iostreams.css">
7</HEAD>
8<BODY>
9
10<!-- Begin Banner -->
11
12    <H1 CLASS="title">Function Template <CODE>tee</CODE></H1>
13    <HR CLASS="banner">
14
15<!-- End Banner -->
16
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>
21</DL>
22
23<HR>
24
25<A NAME="description"></A>
26<H2>Description</H2>
27
28<P>
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.
30</P>
31
32<P>
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>.
34</P>
35
36<A NAME="headers"></A>
37<H2>Headers</H2>
38
39<DL class="page-index">
40  <DT><A CLASS="header" HREF="../../../../boost/iostreams/tee.hpp"><CODE>&lt;boost/iostreams/tee.hpp&gt;</CODE></A></DT>
41</DL>
42
43<A NAME="reference"></A>
44<H2>Reference</H2>
45
46<A NAME="synopsis"></A>
47<H4>Synopsis</H4>
48
49<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
50
51<SPAN CLASS='keyword'>template</SPAN>&lt;<SPAN CLASS='keyword'>typename</SPAN> <A CLASS='documented' HREF='#tee_filter_template_params'>Sink</A>&gt;
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&lt;Sink&gt;::type  char_type;
55    <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='omitted'>[implementation-defined]</SPAN>           category;
56
57    <SPAN CLASS='keyword'>explicit</SPAN> <A CLASS='documented' HREF='#tee_filter_ctor'>tee_filter</A>([<SPAN CLASS='keyword'>const</SPAN>] Sink&amp; snk);
58
59    <SPAN CLASS='comment'>// OutputFilter member functions</SPAN>
60};
61
62<SPAN CLASS='keyword'>template</SPAN>&lt;<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>&gt;
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&lt;Sink1&gt;::type  char_type;
66    <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='omitted'>[implementation-defined]</SPAN>            category;
67
68    <A CLASS='documented' HREF='#tee_device_ctor'>tee_device</A>([<SPAN CLASS='keyword'>const</SPAN>] <SPAN CLASS='keyword'>const</SPAN>&amp; sink1, [<SPAN CLASS='keyword'>const</SPAN>] Sink2&amp; sink2);
69
70    <SPAN CLASS='comment'>// Sink member functions</SPAN>
71};
72
73<SPAN CLASS='keyword'>template</SPAN>&lt;<SPAN CLASS='keyword'>typename</SPAN> <A CLASS='documented' HREF='#tee_unary_template_params'>Sink</A>&gt;
74<A CLASS='documented' HREF='#tee_filter'>tee_filter</A>&lt;Sink&gt; <A CLASS='documented' HREF='#tee_unary'>tee</A>([<SPAN CLASS='keyword'>const</SPAN>] Sink&amp; snk);
75
76<SPAN CLASS='keyword'>template</SPAN>&lt;<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>&gt;
77<A CLASS='documented' HREF='#tee_device'>tee_device</A>&lt;Sink1, Sink2&gt; <A CLASS='documented' HREF='#tee_binary'>tee</A>([<SPAN CLASS='keyword'>const</SPAN>] Sink1&amp; sink1, [<SPAN CLASS='keyword'>const</SPAN>] Sink2&amp; sink2);
78
79
80} } // End namespace boost::io</PRE>
81
82<A NAME="tee_filter"></A>
83<H2>Class Template <CODE>tee_filter</CODE></H2>
84
85<H4>Description</H4>
86
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>
88
89<A NAME="tee_filter_template_params"></A>
90<H4>Template parameters</H4>
91
92<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
93<TR>
94    <TR>
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>
97    </TR>
98</TABLE>
99
100<A NAME="tee_filter_ctor"></A>
101<H4><CODE>tee_filter::tee_filter</CODE></H4>
102
103<PRE CLASS="broken_ie"><SPAN CLASS='keyword'>explicit</SPAN> tee_filter([<SPAN CLASS='keyword'>const</SPAN>] Sink&amp; sink);</PRE>
104
105<P>
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.
107</P>
108
109<A NAME="tee_device"></A>
110<H2>Class Template <CODE>tee_device</CODE></H2>
111
112<H4>Description</H4>
113
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>
115
116<A NAME="tee_device_template_params"></A>
117<H4>Template parameters</H4>
118
119<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
120<TR>
121    <TR>
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>
124    </TR>
125    <TR>
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>
128    </TR>
129</TABLE>
130
131<A NAME="tee_device_ctor"></A>
132<H4><CODE>tee_device::tee_device</CODE></H4>
133
134<PRE CLASS="broken_ie">tee_device([<SPAN CLASS='keyword'>const</SPAN>] <SPAN CLASS='keyword'>const</SPAN>&amp; sink1, [<SPAN CLASS='keyword'>const</SPAN>] Sink2&amp; sink2);</PRE>
135
136<P>
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.
138</P>
139
140<A NAME="tee"></A>
141<A NAME="tee_unary"></A>
142<H2>Function Template <CODE>tee</CODE></H2>
143
144<PRE CLASS="broken_ie"><SPAN CLASS='keyword'>template</SPAN>&lt;<SPAN CLASS='keyword'>typename</SPAN> Sink&gt;
145tee_filter&lt;Sink&gt; tee([<SPAN CLASS='keyword'>const</SPAN>] Sink&amp; snk);</PRE>
146
147<A NAME="tee_unary_template_params"></A>
148<H4>Template parameters</H4>
149<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
150<TR>
151    <TR>
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>
154    </TR>
155</TABLE>
156
157<P>
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.
159</P>
160
161<A NAME="tee_binary"></A>
162<PRE CLASS="broken_ie"><SPAN CLASS='keyword'>template</SPAN>&lt;<SPAN CLASS='keyword'>typename</SPAN> Sink1, <SPAN CLASS='keyword'>typename</SPAN> Sink2&gt;
163tee_device&lt;Sink1, Sink2&gt; tee([<SPAN CLASS='keyword'>const</SPAN>] Sink1&amp; sink1, [<SPAN CLASS='keyword'>const</SPAN>] Sink2&amp; sink2);</PRE>
164
165<A NAME="tee_binary_template_params"></A>
166<H4>Template parameters</H4>
167<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
168<TR>
169    <TR>
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>
172    </TR>
173    <TR>
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>
176    </TR>
177</TABLE>
178
179<P>
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.
181</P>
182
183<!-- Begin Footer -->
184
185<HR>
186
187<P CLASS="copyright">&copy; Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>&copy; Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" 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>)
190</P>
191
192<!-- End Footer -->
193
194</BODY>
195