Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/iostreams/doc/functions/invert.html @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 6.3 KB
Line 
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>invert</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 template <CODE>inverse</CODE> is an adapter which transforms an <A HREF='../concepts/input_filter.html'>InputFilter</A> into an <A HREF='../concepts/output_filter.html'>OutputFilter</A> or <I>vice versa</I>. The function template <CODE>invert</CODE> is an <A HREF='../../../../more/generic_programming.html#object_generator' TARGET='_top'>object generator</A> which when passed a Filter returns a instance of an appropriate specialization of <CODE>inverse</CODE>.
30</P>
31
32<P>Given an <A HREF='../concepts/input_filter.html'>InputFilter</A> <CODE>f</CODE>, the inverse of <CODE>f</CODE> is <A HREF='../concepts/multi_character.html'>Multi-Character</A> <A HREF='../concepts/output_filter.html'>OutputFilter</A> whose member function <CODE>write</CODE> is implemented as follows. Given a <A HREF='../concepts/sink.html'>Sink</A> <CODE>snk</CODE> and a character buffer <CODE>s</CODE> of length <CODE>n</CODE>, we
33</P>
34<UL>
35    <LI>construct a <A HREF='../concepts/source.html'>Source</A> based on the buffer <CODE>s</CODE> and <A HREF='compose.html'><CODE>compose</CODE></A> it with <CODE>f</CODE> to form a Source, then
36    <LI>repeatedly read sequences of characters from the composite Source and write them to <CODE>snk</CODE> until the buffer <CODE>s</CODE> is exhausted.
37</UL>
38
39<P>Similarly, given an <A HREF='../concepts/output_filter.html'>OutputFilter</A> <CODE>f</CODE>, the inverse of <CODE>f</CODE> is <A HREF='../concepts/multi_character.html'>Multi-Character</A> <A HREF='../concepts/input_filter.html'>InputFilter</A> whose member function <CODE>read</CODE> is implemented as follows. Given a <A HREF='../concepts/source.html'>Source</A> <CODE>src</CODE> and a character buffer <CODE>s</CODE> of length <CODE>n</CODE>, we
40</P>
41<UL>
42    <LI>construct a <A HREF='../concepts/sink.html'>Sink</A> based on the buffer <CODE>s</CODE> and <A HREF='compose.html'><CODE>compose</CODE></A> it with <CODE>f</CODE> to form a Sink, then
43    <LI>repeatedly read sequences of characters from <CODE>src</CODE> and write them to the composite Sink until the buffer <CODE>s</CODE> is full.
44</UL>
45
46<P>
47    The <A HREF='../guide/modes.html'>mode</A> of a specialization of <CODE>inverse</CODE> is equal to <A HREF='../guide/modes.html#output'>output</A> if the mode of the underlying filter refines input, and to <A HREF='../guide/modes.html#input'>input</A> otherwise.
48</P>
49
50<A NAME="headers"></A>
51<H2>Headers</H2>
52
53<DL class="page-index">
54  <DT><A CLASS="header" HREF="../../../../boost/iostreams/invert.hpp"><CODE>&lt;boost/iostreams/invert.hpp&gt;</CODE></A></DT>
55</DL>
56
57<A NAME="reference"></A>
58<H2>Reference</H2>
59
60<A NAME="synopsis"></A>
61<H4>Synopsis</H4>
62
63<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
64
65<SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#inverse_template_params">Filter</A>&gt;
66<SPAN CLASS='keyword'>class</SPAN> <A CLASS='documented' HREF='#inverse'>inverse</A> {
67<SPAN CLASS='keyword'>public:</SPAN>
68    <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='keyword'>typename</SPAN> <A CLASS='documented' HREF='../guide/traits.html#char_type_of_ref'>char_type_of</A>&lt;Filter&gt;::type  char_type;
69    <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='omitted'>see above</SPAN>                            mode;
70
71    <A CLASS='documented' HREF='#inverse_ctor'>inverse</A>(<SPAN CLASS='keyword'>const</SPAN> Filter& filter);
72
73    <SPAN CLASS='comment'>// Filter member functions</SPAN>
74};
75
76<SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#invert_template_params">Filter</A>&gt;
77<A CLASS='documented' HREF='#inverse'>inverse</A>&lt;Filter&gt; <A CLASS='documented' HREF='#invert'>invert</A>(<SPAN CLASS='keyword'>const</SPAN> Filter& filter);
78
79} } // End namespace boost::io</PRE>
80
81<A NAME="inverse"></A>
82<H2>Class Template <CODE>inverse</CODE></H2>
83
84<A NAME="inverse_template_params"></A>
85<H4>Template parameters</H4>
86
87<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
88<TR>
89    <TR>
90        <TD VALIGN="top"><I>Filter</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
91        <TD>A model of <A HREF='../concepts/filter.html'>Filter</A></TD>
92    </TR>
93</TABLE>
94
95<A NAME="inverse_ctor"></A>
96<H4><CODE>inverse::inverse</CODE></H4>
97
98<PRE CLASS="broken_ie">    inverse(<SPAN CLASS='keyword'>const</SPAN> Filter& filter);</PRE>
99
100<P>
101    Constructs an instance of <CODE>inverse</CODE> based on the given filter.
102</P>
103
104<A NAME="invert"></A>
105<H2>Function Template <CODE>invert</CODE></H2>
106
107<PRE CLASS="broken_ie"><SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> Filter&gt;
108inverse&lt;Filter&gt; invert(<SPAN CLASS='keyword'>const</SPAN> Filter& filter);</PRE>
109
110<A NAME="invert_template_params"></A>
111<H4>Template parameters</H4>
112
113<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
114<TR>
115    <TR>
116        <TD VALIGN="top"><I>Filter</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
117        <TD>A model of <A HREF='../concepts/filter.html'>Filter</A></TD>
118    </TR>
119</TABLE>
120
121<P>
122    Constructs an instance of an appropriate specialization of <CODE>inverse</CODE> based on the given filter.
123</P>
124
125<!-- Begin Footer -->
126
127<HR>
128<P CLASS="copyright">Revised
129<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
13020 May, 2004
131<!--webbot bot="Timestamp" endspan i-checksum="38504" -->
132</P>
133
134<P CLASS="copyright">&copy; Copyright <A HREF="http://www.kangaroologic.com" TARGET="_top">Jonathan Turkanis</A>, 2004</P>
135<P CLASS="copyright"> 
136    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>)
137</P>
138
139<!-- End Footer -->
140
141</BODY>
Note: See TracBrowser for help on using the repository browser.