The fundamental building blocks of the Iostreams library are the concepts of a Source, which provides read access to a sequence of characters, a Sink, which provides write access to a sequence of characters, an InputFilter, which Filters input read from a Source, and an OutputFilter, which Filters output written to a Sink. Sources, Sinks and their refinements are called Devices. InputFilters, OutputFilter and their refinements are called Filters.
Standard streams and stream buffers are Devices; for example, input streams are Sources and output streams are Sinks.
In general, a Filter or Device may provide access to an input sequence, for reading, an output sequence, for writing, or both. The relationship between the two sequences, as well as the operations that may be performed on them, depends on the Filter or Device type. The various possible relationships between input and output are referred to as modes. The Iostreams library provides one Device concept and one Filter concept for each of eight modes. Source, Sink, InputFilter and OutputFilter correspond to the the modes input and output and are by far the most important of the Filter and Device concepts.
The most common Device and Filter concepts are documented individually. Readers new to the Iostreams library should familiarize themselves with the four central concepts Source, Sink, InputFilter and OutputFilter. The full sets of requirements for the Filter and Device concepts are summarized in the definitions of the concepts Device and Filter which form the roots of the concept hierarchies.
To ease the task of defining new Filter and Device types, the Iostreams library provides a number of convenience templates and
The most important Device concepts are these:
The most important Filter concepts are these:
Boost.Iostreams prvides several concepts corresponding to optional behavior that a Filter or Device might implement:
locale of a stream or stream buffer is set using
The Iostreams library provides several templates intended for derivation by user-defined Filter and Device types. They ease the task of defining Filters and Devices by providing member types and default implementations of several member functions.
device and its specializations
sink help users define new Device types; the template
filter and its specializations
output_filter help users define new Filter types; the template
multichar_filter and its specializations
multichar_output_filter help users define new multichar Filter types. There are also wide-character versions of these templates,
multichar_wfilter, as well as corresponding wide-character
For complete details, see
A more precise definition is given in Modes.
© Copyright 2008 CodeRage, LLC
© Copyright 2004-2007 Jonathan Turkanis
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)