invert.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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
  76. class="keyword">namespace</span> iostreams {
  77. <span class="keyword">template</span>&lt;<span class="keyword">typename</span> <a
  78. class="documented" href="#inverse_template_params">Filter</a>&gt;
  79. <span class="keyword">class</span> <a class="documented" href="#inverse">inverse</a> {
  80. <span class="keyword">public:</span>
  81. <span class="keyword">typedef</span> <span class="keyword">typename</span> <a
  82. class="documented" href="../guide/traits.html#char_type_of_ref">char_type_of</a>&lt;Filter&gt;::type char_type;
  83. <span class="keyword">typedef</span> <span class="omitted">see above</span> mode;
  84. <a class="documented" href="#inverse_ctor">inverse</a>(<span class="keyword">const</span> Filter&amp; filter);
  85. <span class="comment">// Filter member functions</span>
  86. };
  87. <span class="keyword">template</span>&lt;<span class="keyword">typename</span> <a
  88. class="documented" href="#invert_template_params">Filter</a>&gt;
  89. <a class="documented" href="#inverse">inverse</a>&lt;Filter&gt; <a class="documented"
  90. href="#invert">invert</a>(<span class="keyword">const</span> Filter&amp; filter);
  91. } } // End namespace boost::io</pre>
  92. <a name="inverse"></a>
  93. <h2>Class Template <code>inverse</code></h2>
  94. <a name="inverse_template_params"></a>
  95. <h4>Template parameters</h4>
  96. <table style="margin-left:2em" border="0" cellpadding="2">
  97. <tbody>
  98. <tr>
  99. </tr>
  100. <tr>
  101. <td valign="top"><i>Filter</i></td>
  102. <td valign="top" width="2em">-</td>
  103. <td>A model of <a href="../concepts/filter.html">Filter</a></td>
  104. </tr>
  105. </tbody>
  106. </table>
  107. <a name="inverse_ctor"></a>
  108. <h4><code>inverse::inverse</code></h4>
  109. <pre class="broken_ie"> inverse(<span class="keyword">const</span> Filter&amp; filter);</pre>
  110. <p> Constructs an instance of <code>inverse</code> based on the given
  111. filter.
  112. </p>
  113. <a name="invert"></a>
  114. <h2>Function Template <code>invert</code></h2>
  115. <pre class="broken_ie"><span class="keyword">template</span>&lt;<span class="keyword">typename</span> Filter&gt;
  116. inverse&lt;Filter&gt; invert(<span class="keyword">const</span> Filter&amp; filter);</pre>
  117. <a name="invert_template_params"></a>
  118. <h4>Template parameters</h4>
  119. <table style="margin-left:2em" border="0" cellpadding="2">
  120. <tbody>
  121. <tr>
  122. </tr>
  123. <tr>
  124. <td valign="top"><i>Filter</i></td>
  125. <td valign="top" width="2em">-</td>
  126. <td>A model of <a href="../concepts/filter.html">Filter</a></td>
  127. </tr>
  128. </tbody>
  129. </table>
  130. <p> Constructs an instance of an appropriate specialization of <code>inverse</code>
  131. based on the given filter.
  132. </p>
  133. <!-- Begin Footer -->
  134. <hr>
  135. <p class="copyright">© Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage,
  136. LLC</a><br>
  137. © Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan
  138. Turkanis</a></p>
  139. <p class="copyright"> Distributed under the Boost Software License, Version
  140. 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>)
  141. </p>
  142. <!-- End Footer -->
  143. </body>
  144. </html>