Array Devices

Overview
Implementation
Headers
Reference
Class template array_source
Class template array_sink
Class template array
Acknowledgments

Overview

The classes array_source, array_sink and array provide access to a sequence of characters in memory. They array Devices do not manage the lifetimes of the underlying character sequences.

Implementation

The array Devices are implemented as Direct Devices in order to provide efficient unbuffered access to the underlying character sequences.

Headers

<boost/iostreams/device/array.hpp>

Reference

Class template array_source

Description

Model of Source providing read-only access to a sequence of characters in memory.

Synopsis

namespace boost { namespace iostreams {

template<typename Ch>
class array_source { 
public:
    typedef Ch          char_type;
    typedef source_tag  io_category;

    template<int N> array_source(char_type (&)[N]);
    array_source(char_type* begin, char_type* end);
    array_source(char_type* begin, std::size_t length);
    array_source(const char_type* begin, const char_type* end);
    array_source(const char_type* begin, std::size_t length);
    ...
};

} } // End namespace boost::io

Template parameters

Ch- The character type.

array_source::array_source

template<int N> array_source(char_type (&)[N]);
array_source(char_type* begin, char_type* end);
array_source(char_type* begin, std::size_t length);
array_source(const char_type* begin, const char_type* end);
array_source(const char_type* begin, std::size_t length);

Constructs an array_source to read from the indicated character sequence.

Class template array_sink

Description

Model of Sink providing write-only access to a sequence of characters in memory.

Synopsis

namespace boost { namespace iostreams {

template<typename Ch>
class array_sink { 
public:
    typedef Ch        char_type;
    typedef sink_tag  io_category;

    template<int N> array_sink(char_type (&)[N]);
    array_sink(char_type* begin, char_type* end);
    array_sink(char_type* begin, std::size_t length);

    // Additional nember functions
};

} } // End namespace boost::io

Template parameters

Ch- The character type.

array_sink::array_sink

template<int N> array_sink(char_type (&)[N]);
array_sink(char_type* begin, char_type* end);
array_sink(char_type* begin, std::size_t length);

Constructs an array_sink to write to the indicated character sequence.

Class template array

Description

Model of SeekableDevice providing read-write access to a sequence of characters in memory.

Synopsis

namespace boost { namespace iostreams {

template<typename Ch>
class array {
public:    
    typedef Ch                   char_type;
    typedef seekable_device_tag  io_category;

    template<int N> array(char_type (&)[N]);
    array(char_type* begin, char_type* end);
    array(char_type* begin, std::size_t length);

    // Additional nember functions
};

} } // End namespace boost::io

Template parameters

Ch- The character type.

array::array

template<int N> array(char_type (&)[N]);
array(char_type* begin, char_type* end);
array(char_type* begin, std::size_t length);

Constructs an array to access the indicated character sequence.

Acknowledgments

The concept of Devices which provide unbuffered access to character sequences was suggested by Daryle Walker's array_stream template.