invert
The class template inverse
is an adapter which transforms an InputFilter into an OutputFilter or vice versa. The function template invert
is an object generator which when passed a Filter returns a instance of an appropriate specialization of inverse
.
Given an InputFilter f
, the inverse of f
is Multi-Character OutputFilter whose member function write
is implemented as follows. Given a Sink snk
and a character buffer s
of length n
, we
s
and compose
it with f
to form a Source, then
snk
until the buffer s
is exhausted.
Similarly, given an OutputFilter f
, the inverse of f
is Multi-Character InputFilter whose member function read
is implemented as follows. Given a Source src
and a character buffer s
of length n
, we
s
and compose
it with f
to form a Sink, then
src
and write them to the composite Sink until the buffer s
is full.
The mode of a specialization of inverse
is equal to output if the mode of the underlying filter refines input, and to input otherwise.
<boost/iostreams/invert.hpp>
namespace boost { namespace iostreams { template<typename Filter> class inverse { public: typedef typename char_type_of<Filter>::type char_type; typedef see above mode; inverse(const Filter& filter); // Filter member functions }; template<typename Filter> inverse<Filter> invert(const Filter& filter); } } // End namespace boost::io
inverse
Filter | - | A model of Filter |
inverse::inverse
inverse(const Filter& filter);
Constructs an instance of inverse
based on the given filter.
invert
template<typename Filter> inverse<Filter> invert(const Filter& filter);
Filter | - | A model of Filter |
Constructs an instance of an appropriate specialization of inverse
based on the given filter.
Revised 20 May, 2004
© Copyright Jonathan Turkanis, 2004
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)