A Sink is a Device whose mode refines output.
A Sink provides write-access to a sequence of characters of a given type. In general, a Sink may expose this sequence in two ways:
write, invoked indirectly by the Iostreams library through the function boost::iostreams::write;
    output_sequence returning a pair of pointers delimiting the sequence in its entirety.
    As a special case, Boost.Iostreams treats standard output streams as Sinks. (For details, see write.)
The mode of a Sink is output or one of its refinements.
To be usable with the streams and stream buffers provided by the Boost Iostreams library, Sinks must model Blocking.
A model of Sink can be defined as follows:
struct Sink { typedef char char_type; typedef sink_tag category; std::streamsize write(const char* s, std::streamsize n) { // Write up to n characters from the buffer // s to the output sequence, returning the // number of characters written } };
    Here sink_tag is a category tag identifying the type as a model of Sink. Typically a Sink can be defined by deriving from the helper classes sink or wsink and defining a member function write.
Same as Device, with the following additional requirements:
| Category | A type convertible to device_tagand tooutput | 
| S | - A type which is a model of Sink | 
| Ch | - The character type | 
| snk | - Object of type S | 
| s | - Object of type const Ch* | 
| n | - Object of type std::streamsize | 
| io | - Alias for namespace boost::iostreams | 
Same as Device, with the following additional requirements:
| Expression | Expression Type | Category Precondition | Semantics | 
|---|---|---|---|
|  | typenameof the character type | - | - | 
|  | typenameof the category | - | - | 
|  | std::streamsize | Not convertible to direct_tag | Writes up to ncharacters from the sequence beginning atsto the output sequence controlled bydev, returning the number of characters written | 
|  |  | Convertible to direct_tag | Returns a pair of pointers delimiting the sequence controlled by snk | 
    Errors which occur during the execution of member functions write or output_sequence
    are indicated by throwing exceptions. Attempting to write past the end of the sequence is always an error.
After an exception is thrown, a Sink must be in a consistent state; further i/o operations may throw exceptions but must have well-defined behaviour.
array_sink, file_sink, file_descriptor_sink, mapped_file_sink.
© 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)