[29] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
| 2 | <HTML> |
---|
| 3 | <HEAD> |
---|
| 4 | <TITLE>Class Template chain</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>compose</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 | 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. |
---|
| 30 | </P> |
---|
| 31 | |
---|
| 32 | <P> |
---|
| 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='../../../../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>. |
---|
| 34 | </P> |
---|
| 35 | |
---|
| 36 | <P> |
---|
| 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>. |
---|
| 38 | </P> |
---|
| 39 | |
---|
| 40 | <A NAME="headers"></A> |
---|
| 41 | <H2>Headers</H2> |
---|
| 42 | |
---|
| 43 | <DL class="page-index"> |
---|
| 44 | <DT><A CLASS="header" HREF="../../../../boost/iostreams/compose.hpp"><CODE><boost/iostreams/compose.hpp></CODE></A></DT> |
---|
| 45 | </DL> |
---|
| 46 | |
---|
| 47 | <A NAME="reference"></A> |
---|
| 48 | <H2>Reference</H2> |
---|
| 49 | |
---|
| 50 | <A NAME="synopsis"></A> |
---|
| 51 | <H4>Synopsis</H4> |
---|
| 52 | |
---|
| 53 | <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams { |
---|
| 54 | |
---|
| 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; |
---|
| 60 | |
---|
| 61 | <A CLASS='documented' HREF='#composite_ctor'>composite</A>(<SPAN CLASS='keyword'>const</SPAN> Filter& first, [<SPAN CLASS='keyword'>const</SPAN>] FilterOrDevice& second); |
---|
| 62 | |
---|
| 63 | <SPAN CLASS='comment'>// Filter or Device member functions</SPAN> |
---|
| 64 | }; |
---|
| 65 | |
---|
| 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); |
---|
| 69 | |
---|
| 70 | } } // End namespace boost::io</PRE> |
---|
| 71 | |
---|
| 72 | <A NAME="composite"></A> |
---|
| 73 | <H2>Class Template <CODE>composite</CODE></H2> |
---|
| 74 | |
---|
| 75 | <A NAME="composite_template_params"></A> |
---|
| 76 | <H4>Template parameters</H4> |
---|
| 77 | |
---|
| 78 | <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> |
---|
| 79 | <TR> |
---|
| 80 | <TR> |
---|
| 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> |
---|
| 83 | </TR> |
---|
| 84 | <TR> |
---|
| 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> |
---|
| 87 | </TR> |
---|
| 88 | </TABLE> |
---|
| 89 | |
---|
| 90 | <A NAME="composite_ctor"></A> |
---|
| 91 | <H4><CODE>composite::composite</CODE></H4> |
---|
| 92 | |
---|
| 93 | <PRE CLASS="broken_ie"> composite(<SPAN CLASS='keyword'>const</SPAN> Filter& first, [<SPAN CLASS='keyword'>const</SPAN>] FilterOrDevice& second);</PRE> |
---|
| 94 | |
---|
| 95 | <P> |
---|
| 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. |
---|
| 97 | </P> |
---|
| 98 | |
---|
| 99 | <A NAME="compose"></A> |
---|
| 100 | <H2>Function Template <CODE>compose</CODE></H2> |
---|
| 101 | |
---|
| 102 | <PRE CLASS="broken_ie"> composite(<SPAN CLASS='keyword'>const</SPAN> Filter& first, [<SPAN CLASS='keyword'>const</SPAN>] FilterOrDevice& second);</PRE> |
---|
| 103 | |
---|
| 104 | <A NAME="compose_template_params"></A> |
---|
| 105 | <H4>Template parameters</H4> |
---|
| 106 | |
---|
| 107 | <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> |
---|
| 108 | <TR> |
---|
| 109 | <TR> |
---|
| 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> |
---|
| 112 | </TR> |
---|
| 113 | <TR> |
---|
| 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> |
---|
| 116 | </TR> |
---|
| 117 | </TABLE> |
---|
| 118 | |
---|
| 119 | <P> |
---|
| 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. |
---|
| 121 | </P> |
---|
| 122 | |
---|
| 123 | <!-- Begin Footer --> |
---|
| 124 | |
---|
| 125 | <HR> |
---|
| 126 | <P CLASS="copyright">Revised |
---|
| 127 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> |
---|
| 128 | 20 May, 2004 |
---|
| 129 | <!--webbot bot="Timestamp" endspan i-checksum="38504" --> |
---|
| 130 | </P> |
---|
| 131 | |
---|
| 132 | <P CLASS="copyright">© Copyright <A HREF="http://www.kangaroologic.com" TARGET="_top">Jonathan Turkanis</A>, 2004</P> |
---|
| 133 | <P CLASS="copyright"> |
---|
| 134 | 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>) |
---|
| 135 | </P> |
---|
| 136 | |
---|
| 137 | <!-- End Footer --> |
---|
| 138 | |
---|
| 139 | </BODY> |
---|