1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
4 <TITLE>Class Template chain
</TITLE>
5 <LINK REL=
"stylesheet" HREF=
"../../../../boost.css">
6 <LINK REL=
"stylesheet" HREF=
"../theme/iostreams.css">
12 <H1 CLASS=
"title">Function Template
<CODE>compose
</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 Given a Filter
<CODE>f
</CODE> and a Device
<CODE>d
</CODE>, we may construct a device
<CODE>c
</CODE> whose member functions are implemented by invoking the fundamental i/o operations
<A HREF='../functions/read.html'
><CODE>read
</CODE></A>,
<A HREF='../functions/write.html'
><CODE>write
</CODE></A>,
<I>etc.
</I> with
<CODE>f
</CODE> as the first argument and
<CODE>d
</CODE> as the second. Similarly, if we are given two filters
<CODE>f1
</CODE> and
<CODE>f2
</CODE>, we may construct a third filter
<CODE>f3
</CODE> whose member function templates are implemented by invoking the fundamental i/o operations
<A HREF='../functions/read.html'
><CODE>read
</CODE></A>,
<A HREF='../functions/write.html'
><CODE>write
</CODE></A>,
<I>etc.
</I>, with first argument equal to
<CODE>f1
</CODE> and second argument equal to the result of composing
<CODE>f2
</CODE> with the provided Device.
33 The function template
<A HREF='#composite'
><CODE>composite
</CODE></A> represents a Filter or Device which has been constructed in the above manner. The function template
<A HREF='#compose'
><CODE>compose
</CODE></A> is an
<A HREF='http://www.boost.org/more/generic_programming.html#object_generator' TARGET='_top'
>object generator
</A> which given a pair of components returns an appropriate instance of
<CODE>composite
</CODE>.
37 The
<A HREF='../guide/modes.html'
>mode
</A> of a
<CODE>composite
</CODE> is defined to provide a maximal subset of the common functionality of the two components. A
<CODE>composite
</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>.
40 <A NAME=
"headers"></A>
43 <DL class=
"page-index">
44 <DT><A CLASS=
"header" HREF=
"../../../../boost/iostreams/compose.hpp"><CODE><boost/iostreams/compose.hpp
></CODE></A></DT>
47 <A NAME=
"reference"></A>
50 <A NAME=
"synopsis"></A>
53 <PRE CLASS=
"broken_ie"><SPAN CLASS=
"keyword">namespace
</SPAN> boost {
<SPAN CLASS=
"keyword">namespace
</SPAN> iostreams {
55 <SPAN CLASS=
"keyword">template
</SPAN><<SPAN CLASS=
"keyword">typename
</SPAN> <A CLASS=
"documented" HREF=
"#composite_template_params">Filter
</A>,
<SPAN CLASS=
"keyword">typename
</SPAN> <A CLASS=
"documented" HREF=
"#composite_template_params">FilterOrDevice
</A>>
56 <SPAN CLASS='keyword'
>class
</SPAN> <A CLASS='documented' HREF='#composite'
>composite
</A> {
57 <SPAN CLASS='keyword'
>public:
</SPAN>
58 <SPAN CLASS='keyword'
>typedef
</SPAN> <SPAN CLASS='keyword'
>typename
</SPAN> <A CLASS='documented' HREF='../guide/traits.html#char_type'
>char_type_of
</A><Filter
>::type char_type;
59 <SPAN CLASS='keyword'
>typedef
</SPAN> <SPAN CLASS='omitted'
>implementation-defined
</SPAN> mode;
61 <A CLASS='documented' HREF='#composite_ctor'
>composite
</A>(
<SPAN CLASS='keyword'
>const
</SPAN> Filter
& first, [
<SPAN CLASS='keyword'
>const
</SPAN>] FilterOrDevice
& second);
63 <SPAN CLASS='comment'
>// Filter or Device member functions
</SPAN>
66 <SPAN CLASS=
"keyword">template
</SPAN><<SPAN CLASS=
"keyword">typename
</SPAN> <A CLASS=
"documented" HREF=
"#compose_template_params">Filter
</A>,
<SPAN CLASS=
"keyword">typename
</SPAN> <A CLASS=
"documented" HREF=
"#compose_template_params">FilterOrDevice
</A>>
67 <A CLASS='documented' HREF='#composite'
>composite
</A><Filter, FilterOrDevice
>
68 <A CLASS='documented' HREF='#compose'
>compose
</A>(
<SPAN CLASS='keyword'
>const
</SPAN> Filter
& first, [
<SPAN CLASS='keyword'
>const
</SPAN>] FilterOrDevice
& second);
70 } } // End namespace boost::io
</PRE>
72 <A NAME=
"composite"></A>
73 <H2>Class Template
<CODE>composite
</CODE></H2>
75 <A NAME=
"composite_template_params"></A>
76 <H4>Template parameters
</H4>
78 <TABLE STYLE=
"margin-left:2em" BORDER=
0 CELLPADDING=
2>
81 <TD VALIGN=
"top"><I>Filter
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
82 <TD>A model of
<A HREF='../concepts/filter.html'
>Filter
</A></TD>
85 <TD VALIGN=
"top"><I>FilterOrDevice
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
86 <TD>A model of
<A HREF='../concepts/filter.html'
>Filter
</A> or
<A HREF='../concepts/device.html'
>Device
</A></TD>
90 <A NAME=
"composite_ctor"></A>
91 <H4><CODE>composite::composite
</CODE></H4>
93 <PRE CLASS=
"broken_ie"> composite(
<SPAN CLASS='keyword'
>const
</SPAN> Filter
& first, [
<SPAN CLASS='keyword'
>const
</SPAN>] FilterOrDevice
& second);
</PRE>
96 Constructs an instance of
<CODE>composite
</CODE> based on the given components. If
<CODE>FilterOrDevice
</CODE> is a stream or stream buffer type, the second parameter is a non-
<CODE>const
</CODE> reference; otherwise it is a
<CODE>const
</CODE> reference.
99 <A NAME=
"compose"></A>
100 <H2>Function Template
<CODE>compose
</CODE></H2>
102 <PRE CLASS=
"broken_ie"> composite(
<SPAN CLASS='keyword'
>const
</SPAN> Filter
& first, [
<SPAN CLASS='keyword'
>const
</SPAN>] FilterOrDevice
& second);
</PRE>
104 <A NAME=
"compose_template_params"></A>
105 <H4>Template parameters
</H4>
107 <TABLE STYLE=
"margin-left:2em" BORDER=
0 CELLPADDING=
2>
110 <TD VALIGN=
"top"><I>Filter
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
111 <TD>A model of
<A HREF='../concepts/filter.html'
>Filter
</A></TD>
114 <TD VALIGN=
"top"><I>FilterOrDevice
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
115 <TD>A model of
<A HREF='../concepts/filter.html'
>Filter
</A> or
<A HREF='../concepts/device.html'
>Device
</A></TD>
120 Returns an instance of an appropriate specialization of
<CODE>composite
</CODE> constructed from the given components. If
<CODE>FilterOrDevice
</CODE> is a stream or stream buffer type, the second parameter is a non-
<CODE>const
</CODE> reference; otherwise it is a
<CODE>const
</CODE> reference.
123 <!-- Begin Footer -->
127 <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>
128 <P CLASS=
"copyright">
129 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>)