• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3  <head>
4    <meta content="text/html; charset=windows-1252" http-equiv="content-type">
5    <title>Class Template chain</title>
6    <link rel="stylesheet" href="../../../../boost.css">
7    <link rel="stylesheet" href="../theme/iostreams.css">
8  </head>
9  <body>
10    <!-- Begin Banner -->
11    <h1 class="title">Function Template <code>invert</code></h1>
12    <hr class="banner">
13    <!-- End Banner -->
14    <dl class="page-index">
15      <dt><a href="#description">Description</a></dt>
16      <dt><a href="#headers">Headers</a></dt>
17      <dt><a href="#reference">Reference</a></dt>
18    </dl>
19    <hr>
20    <a name="description"></a>
21    <h2>Description</h2>
22    <p> The class template <code>inverse</code> is an adapter which transforms
23      an <a href="../concepts/input_filter.html">InputFilter</a> into an <a href="../concepts/output_filter.html">OutputFilter</a>
24      or <i>vice versa</i>. The function template <code>invert</code> is an <a
25        href="http://www.boost.org/more/generic_programming.html#object_generator"
26        target="_top">object generator</a> which when passed a Filter returns a
27      instance of an appropriate specialization of <code>inverse</code>.
28    </p>
29    <p>Given an <a href="../concepts/input_filter.html">InputFilter</a> <code>f</code>,
30      the inverse of <code>f</code> is <a href="../concepts/multi_character.html">Multi-Character</a>
31      <a href="../concepts/output_filter.html">OutputFilter</a> whose member
32      function <code>write</code> is implemented as follows. Given a <a href="../concepts/sink.html">Sink</a>
33      <code>snk</code> and a character type buffer <code>s</code> of length <code>n</code>,
34      we
35    </p>
36    <ul>
37      <li>construct a <a href="../concepts/source.html">Source</a> based on the
38        buffer <code>s</code> and <a href="compose.html"><code>compose</code></a>
39        it with <code>f</code> to form a Source, then </li>
40      <li>repeatedly read sequences of character types from the composite Source
41        and write them to <code>snk</code> until the buffer <code>s</code> is
42        exhausted.
43      </li>
44    </ul>
45    <p>Similarly, given an <a href="../concepts/output_filter.html">OutputFilter</a>
46      <code>f</code>, the inverse of <code>f</code> is <a href="../concepts/multi_character.html">Multi-Character</a>
47      <a href="../concepts/input_filter.html">InputFilter</a> whose member
48      function <code>read</code> is implemented as follows. Given a <a href="../concepts/source.html">Source</a>
49      <code>src</code> and a character type buffer <code>s</code> of length <code>n</code>,
50      we
51    </p>
52    <ul>
53      <li>construct a <a href="../concepts/sink.html">Sink</a> based on the
54        buffer <code>s</code> and <a href="compose.html"><code>compose</code></a>
55        it with <code>f</code> to form a Sink, then </li>
56      <li>repeatedly read sequences of character types from <code>src</code>
57        and write them to the composite Sink until the buffer <code>s</code> is
58        full.
59      </li>
60    </ul>
61    <p> The <a href="../guide/modes.html">mode</a> of a specialization of <code>inverse</code>
62      is equal to <a href="../guide/modes.html#output">output</a> if the mode
63      of the underlying filter refines input, and to <a href="../guide/modes.html#input">input</a>
64      otherwise.
65    </p>
66    <a name="headers"></a>
67    <h2>Headers</h2>
68    <dl class="page-index">
69      <dt><a class="header" href="../../../../boost/iostreams/invert.hpp"><code>&lt;boost/iostreams/invert.hpp&gt;</code></a></dt>
70    </dl>
71    <a name="reference"></a>
72    <h2>Reference</h2>
73    <a name="synopsis"></a>
74    <h4>Synopsis</h4>
75    <pre class="broken_ie"><span class="keyword">namespace</span> boost { <span
76class="keyword">namespace</span> iostreams {
77
78<span class="keyword">template</span>&lt;<span class="keyword">typename</span> <a
79class="documented" href="#inverse_template_params">Filter</a>&gt;
80<span class="keyword">class</span> <a class="documented" href="#inverse">inverse</a> {
81<span class="keyword">public:</span>
82    <span class="keyword">typedef</span> <span class="keyword">typename</span> <a
83class="documented" href="../guide/traits.html#char_type_of_ref">char_type_of</a>&lt;Filter&gt;::type  char_type;
84    <span class="keyword">typedef</span> <span class="omitted">see above</span>                            mode;
85
86    <a class="documented" href="#inverse_ctor">inverse</a>(<span class="keyword">const</span> Filter&amp; filter);
87
88    <span class="comment">// Filter member functions</span>
89};
90
91<span class="keyword">template</span>&lt;<span class="keyword">typename</span> <a
92class="documented" href="#invert_template_params">Filter</a>&gt;
93<a class="documented" href="#inverse">inverse</a>&lt;Filter&gt; <a class="documented"
94href="#invert">invert</a>(<span class="keyword">const</span> Filter&amp; filter);
95
96} } // End namespace boost::io</pre>
97    <a name="inverse"></a>
98    <h2>Class Template <code>inverse</code></h2>
99    <a name="inverse_template_params"></a>
100    <h4>Template parameters</h4>
101    <table style="margin-left:2em" border="0" cellpadding="2">
102      <tbody>
103        <tr>
104        </tr>
105        <tr>
106          <td valign="top"><i>Filter</i></td>
107          <td valign="top" width="2em">-</td>
108          <td>A model of <a href="../concepts/filter.html">Filter</a></td>
109        </tr>
110      </tbody>
111    </table>
112    <a name="inverse_ctor"></a>
113    <h4><code>inverse::inverse</code></h4>
114    <pre class="broken_ie">    inverse(<span class="keyword">const</span> Filter&amp; filter);</pre>
115    <p> Constructs an instance of <code>inverse</code> based on the given
116      filter.
117    </p>
118    <a name="invert"></a>
119    <h2>Function Template <code>invert</code></h2>
120    <pre class="broken_ie"><span class="keyword">template</span>&lt;<span class="keyword">typename</span> Filter&gt;
121inverse&lt;Filter&gt; invert(<span class="keyword">const</span> Filter&amp; filter);</pre>
122    <a name="invert_template_params"></a>
123    <h4>Template parameters</h4>
124    <table style="margin-left:2em" border="0" cellpadding="2">
125      <tbody>
126        <tr>
127        </tr>
128        <tr>
129          <td valign="top"><i>Filter</i></td>
130          <td valign="top" width="2em">-</td>
131          <td>A model of <a href="../concepts/filter.html">Filter</a></td>
132        </tr>
133      </tbody>
134    </table>
135    <p> Constructs an instance of an appropriate specialization of <code>inverse</code>
136      based on the given filter.
137    </p>
138    <!-- Begin Footer -->
139    <hr>
140    <p class="copyright">� Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage,
141        LLC</a><br>
142      � Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan
143        Turkanis</a></p>
144    <p class="copyright"> Distributed under the Boost Software License, Version
145      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>)
146    </p>
147    <!-- End Footer -->
148  </body>
149</html>
150