1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4 <TITLE>Array Devices</TITLE> 5 <LINK REL="stylesheet" HREF="../../../../boost.css"> 6 <LINK REL="stylesheet" HREF="../theme/iostreams.css"> 7</HEAD> 8<BODY> 9 10<!-- Begin Banner --> 11 12 <H1 CLASS="title">Array Devices</H1> 13 <HR CLASS="banner"> 14 15<!-- End Banner --> 16 17<DL class="page-index"> 18 <DT><A href="#overview">Overview</A></DT> 19 <DT><A href="#implementation">Implementation</A></DT> 20 <DT><A href="#headers">Headers</A></DT> 21 <DT><A href="#reference">Reference</A> 22 <DL> 23 <DT><A href="#array_source">Class template <CODE>basic_array_source</CODE></A></DT> 24 <DT><A href="#array_sink">Class template <CODE>basic_array_sink</CODE></A></DT> 25 <DT><A href="#array">Class template <CODE>basic_array</CODE></A></DT> 26 </DL> 27 </DT> 28 <DT><A href="#acknowledgments">Acknowledgments</A></DT> 29</DL> 30 31<HR> 32 33<A NAME="overview"></A> 34<H2>Overview</H2> 35 36<P> 37 The class templates <CODE>basic_array_source</CODE>, <CODE>basic_array_sink</CODE> and <CODE>basic_array</CODE> provide access to a sequence of characters in memory. The array Devices do not manage the lifetimes of the underlying character sequences. 38</P> 39 40<A NAME="implementation"></A> 41<H2>Implementation</H2> 42 43<P> 44 The array Devices are implemented as <A HREF="../concepts/direct.html">Direct</A> Devices in order to provide efficient unbuffered access to the underlying character sequences. 45</P> 46 47<A NAME="headers"></A> 48<H2>Headers</H2> 49 50<DL class="page-index"> 51 <DT><A CLASS="header" HREF="../../../../boost/iostreams/device/array.hpp"><CODE><boost/iostreams/device/array.hpp></CODE></A></DT> 52</DL> 53 54<A NAME="reference"></A> 55<H2>Reference</H2> 56 57<A NAME="array_source"></A> 58<H3>Class template <CODE>basic_array_source</CODE></H3> 59 60<H4>Description</H4> 61 62<P>Model of <A HREF="../concepts/source.html">Source</A> providing read-only access to a sequence of characters in memory.</P> 63 64<H4>Synopsis</H4> 65 66<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams { 67 68<SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#array_source_params">Ch</A>> 69<SPAN CLASS="keyword">class</SPAN> <A CLASS="documented" HREF="#array_source_params">basic_array_source</A> { 70<SPAN CLASS="keyword">public</SPAN>: 71 <SPAN CLASS="keyword">typedef</SPAN> Ch char_type; 72 <SPAN CLASS="keyword">typedef</SPAN> source_tag category; 73 74 <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">int</SPAN> N> <A CLASS="documented" HREF="#array_source_constructors">basic_array_source</A>(char_type (&)[N]); 75 <A CLASS="documented" HREF="#array_source_constructors">basic_array_source</A>(<SPAN CLASS="keyword">const</SPAN> char_type* begin, <SPAN CLASS="keyword">const</SPAN> char_type* end); 76 <A CLASS="documented" HREF="#array_source_constructors">basic_array_source</A>(<SPAN CLASS="keyword">const</SPAN> char_type* begin, std::size_t length); 77 <SPAN CLASS="omitted">...</SPAN> 78}; 79 80<SPAN CLASS="keyword">typedef</SPAN> basic_array_source<<SPAN CLASS="keyword">char</SPAN>> <SPAN CLASS='defined'>array_source</SPAN>; 81<SPAN CLASS="keyword">typedef</SPAN> basic_array_source<<SPAN CLASS="keyword">wchar_t</SPAN>> <SPAN CLASS='defined'>warray_source</SPAN>; 82 83} } <SPAN CLASS='comment'>// End namespace boost::io</SPAN></PRE> 84 85<A NAME="array_source_params"></A> 86<H4>Template parameters</H4> 87 88<TABLE STYLE="margin-left:2em"> 89<TR> 90 <TD><I>Ch</I></TD><TD VALIGN="top">-</TD> 91 <TD>The character type.</TD> 92</TR> 93</TABLE> 94 95<A NAME="array_source_constructors"></A> 96<H4><CODE>basic_array_source::basic_array_source</CODE></H4> 97 98<PRE CLASS="broken_ie"><SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">int</SPAN> N> basic_array_source(char_type (&)[N]); 99basic_array_source(<SPAN CLASS="keyword">const</SPAN> char_type* begin, <SPAN CLASS="keyword">const</SPAN> char_type* end); 100basic_array_source(<SPAN CLASS="keyword">const</SPAN> char_type* begin, std::size_t length);</PRE> 101 102<P>Constructs a <CODE>basic_array_source</CODE> to read from the indicated character sequence.</P> 103 104<A NAME="array_sink"></A> 105<H3>Class template <CODE>basic_array_sink</CODE></H3> 106 107<H4>Description</H4> 108 109<P>Model of <A HREF="../concepts/sink.html">Sink</A> providing write-only access to a sequence of characters in memory. 110 111<H4>Synopsis</H4> 112 113<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams { 114 115<SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#array_sink_params">Ch</A>> 116<SPAN CLASS="keyword">class</SPAN> <A CLASS="documented" HREF="#array_sink_params">basic_array_sink</A> { 117<SPAN CLASS="keyword">public</SPAN>: 118 <SPAN CLASS="keyword">typedef</SPAN> Ch char_type; 119 <SPAN CLASS="keyword">typedef</SPAN> sink_tag category; 120 121 <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">int</SPAN> N> <A CLASS="documented" HREF="#array_sink_constructors">basic_array_sink</A>(char_type (&)[N]); 122 <A CLASS="documented" HREF="#array_sink_constructors">basic_array_sink</A>(char_type* begin, char_type* end); 123 <A CLASS="documented" HREF="#array_sink_constructors">basic_array_sink</A>(char_type* begin, std::size_t length); 124 125 <SPAN CLASS="comment">// Additional nember functions</SPAN> 126}; 127 128<SPAN CLASS="keyword">typedef</SPAN> basic_array_sink<<SPAN CLASS="keyword">char</SPAN>> <SPAN CLASS='defined'>array_sink</SPAN>; 129<SPAN CLASS="keyword">typedef</SPAN> basic_array_sink<<SPAN CLASS="keyword">wchar_t</SPAN>> <SPAN CLASS='defined'>warray_sink</SPAN>; 130 131} } <SPAN CLASS='comment'>// End namespace boost::io</SPAN></PRE> 132 133<A NAME="array_sink_params"></A> 134<H4>Template parameters</H4> 135 136<TABLE STYLE="margin-left:2em"> 137<TR> 138 <TD><I>Ch</I></TD><TD VALIGN="top">-</TD> 139 <TD>The character type.</TD> 140</TR> 141</TABLE> 142 143<A NAME="array_sink_constructors"></A> 144<H4><CODE>basic_array_sink::basic_array_sink</CODE></H4> 145 146<PRE CLASS="broken_ie"><SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">int</SPAN> N> basic_array_sink(char_type (&)[N]); 147basic_array_sink(char_type* begin, char_type* end); 148basic_array_sink(char_type* begin, std::size_t length);</PRE> 149 150<P>Constructs an <CODE>basic_array_sink</CODE> to write to the indicated character sequence.</P> 151 152<A NAME="array"></A> 153<H3>Class template <CODE>basic_array</CODE></H3> 154 155<H4>Description</H4> 156 157<P>Model of <A HREF="../concepts/seekable_device.html">SeekableDevice</A> providing read-write access to a sequence of characters in memory. 158 159<H4>Synopsis</H4> 160 161<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams { 162 163<SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#array_params">Ch</A>> 164<SPAN CLASS="keyword">class</SPAN> <A CLASS="documented" HREF="#array_params">basic_array</A> { 165<SPAN CLASS="keyword">public</SPAN>: 166 <SPAN CLASS="keyword">typedef</SPAN> Ch char_type; 167 <SPAN CLASS="keyword">typedef</SPAN> seekable_device_tag category; 168 169 <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">int</SPAN> N> <A CLASS="documented" HREF="#array_constructor">basic_array</A>(char_type (&)[N]); 170 <A CLASS="documented" HREF="#array_constructor">basic_array</A>(char_type* begin, char_type* end); 171 <A CLASS="documented" HREF="#array_constructor">basic_array</A>(char_type* begin, std::size_t length); 172 173 <SPAN CLASS="comment">// Additional nember functions</SPAN> 174}; 175 176<SPAN CLASS="keyword">typedef</SPAN> basic_array<<SPAN CLASS="keyword">char</SPAN>> <SPAN CLASS='defined'>array</SPAN>; 177<SPAN CLASS="keyword">typedef</SPAN> basic_array<<SPAN CLASS="keyword">wchar_t</SPAN>> <SPAN CLASS='defined'>warray</SPAN>; 178 179} } <SPAN CLASS='comment'>// End namespace boost::io</SPAN></PRE> 180 181<A NAME="array_params"></A> 182<H4>Template parameters</H4> 183 184<TABLE STYLE="margin-left:2em"> 185<TR> 186 <TD><I>Ch</I></TD><TD VALIGN="top">-</TD> 187 <TD>The character type.</TD> 188</TR> 189</TABLE> 190 191<A NAME="array_constructor"></A> 192<H4><CODE>array::array</CODE></H4> 193 194<PRE CLASS="broken_ie"><SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">int</SPAN> N> basic_array(char_type (&)[N]); 195basic_array(char_type* begin, char_type* end); 196basic_array(char_type* begin, std::size_t length);</PRE> 197 198<P>Constructs a <CODE>basic_array</CODE> to access the indicated character sequence.</P> 199 200<A NAME="acknowledgments"></A> 201<H2>Acknowledgments</H2> 202 203<P> 204The concept of Devices which provide unbuffered access to character sequences was suggested by <A HREF="http://www.boost.org/people/daryle_walker.html">Daryle Walker's</A> <A HREF="http://boost-sandbox.cvs.sourceforge.net/viewvc/boost-sandbox/boost-sandbox/libs/io/doc/array_stream.html"><CODE>array_stream</CODE></A> template. 205</P> 206 207<!-- Begin Footer --> 208 209<HR> 210 211<P CLASS="copyright">© Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>© Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan Turkanis</a></P> 212<P CLASS="copyright"> 213 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>) 214</P> 215 216<!-- End Footer --> 217 218</BODY>