aggregate.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Class Template aggregate_filter</TITLE>
  5. <LINK REL="stylesheet" HREF="../../../../boost.css">
  6. <LINK REL="stylesheet" HREF="../theme/iostreams.css">
  7. </HEAD>
  8. <BODY>
  9. <!-- Begin Banner -->
  10. <H1 CLASS="title">Class Template <CODE>aggregate_filter</CODE></H1>
  11. <HR CLASS="banner">
  12. <!-- End Banner -->
  13. <DL class="page-index">
  14. <DT><A href="#description">Description</A></DT>
  15. <DT><A href="#headers">Headers</A></DT>
  16. <DT><A href="#reference">Reference</A></DT>
  17. <DT><A href="#examples">Examples</A></DT>
  18. </DL>
  19. <HR>
  20. <A NAME="description"></A>
  21. <H2>Description</H2>
  22. <P>
  23. The class template <CODE>aggregate_filter</CODE> is a <A HREF='../concepts/dual_use_filter.html'>DualUseFilter</A> for use as a base class by Filters which filter an entire character sequence at once. Because a <CODE>aggregate_filter</CODE> must read an entire character sequence into memory before it begins to filter, it is not suitable in low-memory situations or for processing character sequences which have no natural end, such as stock tickers. Because of these limitations, <CODE>aggregate_filter</CODE> is best used as an aid to those learning to use the Iostreams library.
  24. </P>
  25. <P>
  26. When used as an <A HREF="../concepts/input_filter.html">InputFilter</A>, an instance of <CODE>aggregate_filter</CODE> reads to the end of the stream as soon as input is commenced. The entire contents of the stream are filtered using the <CODE>private virtual</CODE> function <A HREF="#do_filter"><CODE>do_filter</CODE></A>. The filtered data is stored and used to satisfy all future requests for input until the end of the filtered data is reached.
  27. </P>
  28. <P>
  29. When used as an <A HREF="../concepts/output_filter.html">OutputFilter</A>, an instance of <CODE>aggregate_filter</CODE> stores all data written to it without passing it downstream. When the stream is closed, the entire contents of the stream are filtered using <A HREF="#do_filter"><CODE>do_filter</CODE></A>. The filtered data is then written, all at once, to the next downstream Filter or Device.
  30. </P>
  31. <A NAME="headers"></A>
  32. <H2>Headers</H2>
  33. <DL class="page-index">
  34. <DT><A CLASS="header" HREF="../../../../boost/iostreams/filter/aggregate.hpp"><CODE>&lt;boost/iostreams/filter/aggregate.hpp&gt;</CODE></A></DT>
  35. </DL>
  36. <A NAME="reference"></A>
  37. <H2>Reference</H2>
  38. <H4>Synopsis</H4>
  39. <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
  40. <SPAN CLASS="preprocessor">#include</SPAN> <SPAN CLASS="literal">&lt;vector&gt;</SPAN>
  41. <SPAN CLASS="keyword"><SPAN CLASS="keyword">template</SPAN></SPAN>&lt; <SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#template_params">Ch</A>,
  42. <SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#template_params">Tr</A> = std::char_traits&lt;Ch&gt;,
  43. <SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#template_params">Alloc</A> = std::allocator&lt;Ch&gt; &gt;
  44. <SPAN CLASS="keyword">class</SPAN> <A CLASS="documented" HREF="#template_params">aggregate_filter</A> {
  45. <SPAN CLASS="keyword">public</SPAN>:
  46. <SPAN CLASS="keyword">typedef</SPAN> Ch char_type;
  47. <SPAN CLASS="keyword">typedef</SPAN> <SPAN CLASS="omitted">implementation-defined</SPAN> category;
  48. <SPAN CLASS="keyword">typedef</SPAN> std::vector&lt;Char, Alloc&gt; vector_type;
  49. <SPAN CLASS="keyword">virtual</SPAN> ~aggregate_filter();
  50. <SPAN CLASS="omitted">...</SPAN>
  51. <SPAN CLASS="keyword">private</SPAN>:
  52. <SPAN CLASS="keyword">virtual</SPAN> <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#do_filter">do_filter</A>(<SPAN CLASS="keyword">const</SPAN> vector_type&amp; src, vector_type&amp; dest) = 0;
  53. };
  54. } } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE>
  55. <A NAME="template_params"></A>
  56. <H4>Template parameters</H4>
  57. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  58. <TR>
  59. <TR>
  60. <TD VALIGN="top"><I>Ch</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  61. <TD>The character type</TD>
  62. </TR>
  63. <TR>
  64. <TD VALIGN="top"><I>Tr</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  65. <TD>The traits type</TD>
  66. </TR>
  67. <TR>
  68. <TD VALIGN="top"><I>Alloc</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  69. <TD>A standard library allocator type (<A CLASS="bib_ref" HREF="../bibliography.html#iso">[ISO]</A>, 20.1.5), used to instantiate <CODE>std::vector</CODE></TD>
  70. </TR>
  71. </TABLE>
  72. <A NAME="do_filter"></A>
  73. <H4><CODE>aggregate_filter::do_filter</CODE></H4>
  74. <PRE CLASS="broken_ie"> <SPAN CLASS="keyword">virtual</SPAN> <SPAN CLASS="keyword">void</SPAN> <B>do_filter</B>(<SPAN CLASS="keyword">const</SPAN> vector_type&amp; src, vector_type&amp; dest) = 0;</PRE>
  75. <P>Reads unflitered characters from <CODE>src</CODE> and appends filtered characters to <CODE>dest</CODE>, returning after all the characters in <CODE>src</CODE> have been consumed.</P>
  76. <A NAME="examples"></A>
  77. <H2>Examples</H2>
  78. <P>For example uses of <CODE>aggregate_filter</CODE>, see the headers <A CLASS="header" HREF="../../../../boost/iostreams/filter/regex.hpp"><CODE>&lt;boost/iostreams/filter/regex.hpp&gt;</CODE></A> and <A CLASS="header" HREF="../../../../boost/iostreams/filter/stdio.hpp"><CODE>&lt;boost/iostreams/filter/stdio.hpp&gt;</CODE></A>.</P>
  79. <!-- Begin Footer -->
  80. <HR>
  81. <P CLASS="copyright">&copy; Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>&copy; Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan Turkanis</a></P>
  82. <P CLASS="copyright">
  83. 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>)
  84. </P>
  85. <!-- End Footer -->
  86. </BODY>