iostreams/doc/classes/aggregate.html

114 lines
5.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Class Template aggregate_filter</TITLE>
<LINK REL="stylesheet" HREF="../../../../boost.css">
<LINK REL="stylesheet" HREF="../theme/iostreams.css">
</HEAD>
<BODY>
<!-- Begin Banner -->
<H1 CLASS="title">Class Template <CODE>aggregate_filter</CODE></H1>
<HR CLASS="banner">
<!-- End Banner -->
<DL class="page-index">
<DT><A href="#description">Description</A></DT>
<DT><A href="#headers">Headers</A></DT>
<DT><A href="#reference">Reference</A></DT>
<DT><A href="#examples">Examples</A></DT>
</DL>
<HR>
<A NAME="description"></A>
<H2>Description</H2>
<P>
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.
</P>
<P>
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.
</P>
<P>
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.
</P>
<A NAME="headers"></A>
<H2>Headers</H2>
<DL class="page-index">
<DT><A CLASS="header" HREF="../../../../boost/iostreams/filter/aggregate.hpp"><CODE>&lt;boost/iostreams/filter/aggregate.hpp&gt;</CODE></A></DT>
</DL>
<A NAME="reference"></A>
<H2>Reference</H2>
<H4>Synopsis</H4>
<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
<SPAN CLASS="preprocessor">#include</SPAN> <SPAN CLASS="literal">&lt;vector&gt;</SPAN>
<SPAN CLASS="keyword"><SPAN CLASS="keyword">template</SPAN></SPAN>&lt; <SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#template_params">Ch</A>,
<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#template_params">Tr</A> = std::char_traits&lt;Ch&gt;,
<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#template_params">Alloc</A> = std::allocator&lt;Ch&gt; &gt;
<SPAN CLASS="keyword">class</SPAN> <A CLASS="documented" HREF="#template_params">aggregate_filter</A> {
<SPAN CLASS="keyword">public</SPAN>:
<SPAN CLASS="keyword">typedef</SPAN> Ch char_type;
<SPAN CLASS="keyword">typedef</SPAN> <SPAN CLASS="omitted">implementation-defined</SPAN> category;
<SPAN CLASS="keyword">typedef</SPAN> std::vector&lt;Char, Alloc&gt; vector_type;
<SPAN CLASS="keyword">virtual</SPAN> ~aggregate_filter();
<SPAN CLASS="omitted">...</SPAN>
<SPAN CLASS="keyword">private</SPAN>:
<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;
};
} } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE>
<A NAME="template_params"></A>
<H4>Template parameters</H4>
<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
<TR>
<TR>
<TD VALIGN="top"><I>Ch</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>The character type</TD>
</TR>
<TR>
<TD VALIGN="top"><I>Tr</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>The traits type</TD>
</TR>
<TR>
<TD VALIGN="top"><I>Alloc</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<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>
</TR>
</TABLE>
<A NAME="do_filter"></A>
<H4><CODE>aggregate_filter::do_filter</CODE></H4>
<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>
<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>
<A NAME="examples"></A>
<H2>Examples</H2>
<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>
<!-- Begin Footer -->
<HR>
<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>
<P CLASS="copyright">
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>)
</P>
<!-- End Footer -->
</BODY>