mapped_file.html 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Memory-Mapped Files</TITLE>
  5. <LINK REL="stylesheet" HREF="../../../../boost.css">
  6. <LINK REL="stylesheet" HREF="../theme/iostreams.css">
  7. </HEAD>
  8. <BODY>
  9. <!-- Begin Banner -->
  10. <H1 CLASS="title">Memory-Mapped Files</H1>
  11. <HR CLASS="banner">
  12. <!-- End Banner -->
  13. <DL class="page-index">
  14. <DT><A href="#overview">Overview</A></DT>
  15. <DT><A href="#acknowledgments">Acknowledgments</A></DT>
  16. <DT><A href="#installation">Installation</A></DT>
  17. <DT><A href="#headers">Headers</A></DT>
  18. <DT><A href="#reference">Reference</A>
  19. <OL>
  20. <LI CLASS="square"><A href="#mapped_file_params">Class <CODE>mapped_file_params</CODE></A></LI>
  21. <LI CLASS="square"><A href="#mapped_file_source">Class <CODE>mapped_file_source</CODE></A></LI>
  22. <LI CLASS="square"><A href="#mapped_file_sink">Class <CODE>mapped_file_sink</CODE></A></LI>
  23. <LI CLASS="square"><A href="#mapped_file">Class <CODE>mapped_file</CODE></A></LI>
  24. </OL>
  25. </DT>
  26. </DL>
  27. <HR>
  28. <A NAME="overview"></A>
  29. <H2>Overview</H2>
  30. <P>
  31. The classes <CODE>mapped_file_source</CODE>, <CODE>mapped_file_sink</CODE> and <CODE>mapped_file</CODE> provide access to memory-mapped files on Windows and POSIX systems. These <A HREF="../guide/concepts.html#device_concepts">Devices</A> behave much like the <A HREF="file.html">File Wrappers</A> <CODE>basic_file_source</CODE>, <CODE>basic_file_sink</CODE> and <CODE>basic_file</CODE>, with the following important differences:
  32. </P>
  33. <UL>
  34. <LI CLASS="square">By default, files must exist before being opened, and are not truncated; attempting to write past the end of a file results in an error. To map a file which does not yet exist, use <A HREF="#mapped_file_params_size"><CODE>mapped_file_params::new_file_size</CODE></A>.
  35. <LI CLASS="square">Files are always opened in binary mode.
  36. <LI CLASS="square">Wide-character streams are not supported.
  37. </UL>
  38. <P>
  39. Wide-character versions of the memory-mapped file Devices may be defined as follows, using the template <A HREF="code_converter.html"><CODE>code_converter</CODE></A>:
  40. <PRE CLASS="broken_ie"> <SPAN CLASS="preprocessor">#include</SPAN> <A CLASS="header" HREF="../../../../boost/iostreams/code_converter.hpp"><SPAN CLASS="literal">&lt;boost/iostreams/code_converter.hpp&gt;</SPAN></A>
  41. <SPAN CLASS="preprocessor">#include</SPAN> <A CLASS="header" HREF="../../../../boost/iostreams/device/mapped_file.hpp"><SPAN CLASS="literal">&lt;boost/iostreams/device/mapped_file.hpp&gt;</SPAN></A>
  42. <SPAN CLASS="keyword">typedef</SPAN> code_converter&lt;mapped_file_source&gt; <SPAN CLASS="defined">wmapped_file_source</SPAN>;
  43. <SPAN CLASS="keyword">typedef</SPAN> code_converter&lt;mapped_file_sink&gt; <SPAN CLASS="defined">wmapped_file_sink</SPAN>;</PRE>
  44. </P>
  45. <A NAME="acknowledgments"></A>
  46. <H2>Acknowledgments</H2>
  47. <P>
  48. The memory-mapped file Devices are based on the work of Craig Henderson (<A CLASS="bib_ref" HREF="../bibliography.html#henderson">[Henderson]</A>). Additionals features were implemented by Jonathan Graehl.
  49. </P>
  50. <A NAME="installation"></A>
  51. <H2>Installation</H2>
  52. <P>
  53. The memory-mapped file Devices depend on the source file <A CLASS="header" HREF="../../src/mapped_file.cpp"><CODE>&lt;libs/iostreams/src/mapped_file.cpp&gt;</CODE></A>. This source file makes use of Windows or POSIX headers depending on the user's operating system. For installation instructions see <A HREF="../installation.html">Installation</A>.
  54. </P>
  55. <A NAME="headers"></A>
  56. <H2>Headers</H2>
  57. <DL class="page-index">
  58. <DT><A CLASS="header" HREF="../../../../boost/iostreams/device/mapped_file.hpp"><CODE>&lt;boost/iostreams/device/mapped_file.hpp&gt;</CODE></A></DT>
  59. </DL>
  60. <A NAME="reference"></A>
  61. <H2>Reference</H2>
  62. <A NAME="mapped_file_params"></A>
  63. <H3>1. Class <CODE>mapped_file_params</CODE></H3>
  64. <H4>Description</H4>
  65. <P>Class encapsulating the parameters used to open a memory-mapped file.</P>
  66. <H4>Synopsis</H4>
  67. <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
  68. <SPAN CLASS="keyword">struct</SPAN> <SPAN CLASS="defined">mapped_file_params</SPAN> {
  69. <SPAN CLASS='keyword'>explicit</SPAN> mapped_file_params();
  70. <SPAN CLASS='keyword'>explicit</SPAN> mapped_file_params(<SPAN CLASS='keyword'>const</SPAN> std::string&amp; path);
  71. std::string <A CLASS='documented' HREF='#mapped_file_params_hint'>path</A>;
  72. mapped_file::mapmode <A CLASS='documented' HREF='#mapped_file_params_flags'>flags</A>;
  73. std::ios_base::openmode <A CLASS='documented' HREF='#mapped_file_params_mode'>mode</A>; // Deprecated
  74. stream_offset <A CLASS='documented' HREF='#mapped_file_params_offset'>offset</A>;
  75. std::size_t <A CLASS='documented' HREF='#mapped_file_params_length'>length</A>;
  76. stream_offset <A CLASS="documented" HREF="#mapped_file_params_size">new_file_size</A>;
  77. <SPAN CLASS='keyword'>const</SPAN> <SPAN CLASS='keyword'>char</SPAN>* <A CLASS='documented' HREF='#mapped_file_params_hint'>hint</A>;
  78. };
  79. } } // End namespace boost::io</PRE>
  80. <A NAME="mapped_file_params_path"></A>
  81. <H4><CODE>mapped_file_params::path</CODE></H4>
  82. <PRE CLASS="broken_ie"> std::string path;</PRE>
  83. <P>The pathname of the file to map.</P>
  84. <A NAME="mapped_file_params_mode"></A>
  85. <H4><CODE>mapped_file_params::mode</CODE></H4>
  86. <PRE CLASS="broken_ie"> std::ios_base::openmode mode;</PRE>
  87. <P>Indicates whether the file should be opened with read-access, write-access or both. Ignored by <CODE>mapped_file_source</CODE> and <CODE>mapped_file_sink</CODE>. This member is deprecated. Please use flags in new code instead.</P>
  88. <A NAME="mapped_file_params_flags"></A>
  89. <H4><CODE>mapped_file_params::flags</CODE></H4>
  90. <PRE CLASS="broken_ie"> mapped_file::mapmode flags;</PRE>
  91. <P>Indicates whether the file should be opened with read-access, read-write-access, or private access. A file opened with private access can be written to, but the changes will not affect the underlying file.</P>
  92. <A NAME="mapped_file_params_offset"></A>
  93. <H4><CODE>mapped_file_params::offset</CODE></H4>
  94. <PRE CLASS="broken_ie"> stream_offset offset;</PRE>
  95. <P>The offset where the mapping is to begin. This value must be a multiple of the operating system's virtual memory allocation granularity, which can be abotained via the static member function <A HREF="#mapped_file_alignment"><CODE>alignment</CODE></A> of <CODE>mapped_file_source</CODE>, <CODE>mapped_file_sink</CODE> or <CODE>mapped_file</CODE>. Defaults to <CODE>0</CODE>.</P>
  96. <A NAME="mapped_file_params_length"></A>
  97. <H4><CODE>mapped_file_params::length</CODE></H4>
  98. <PRE CLASS="broken_ie"> std::size_t length;</PRE>
  99. <P>The number of bytes to map. If this parameter is not specified, the entire file is mapped.</P>
  100. <A NAME="mapped_file_params_size"></A>
  101. <H4><CODE>mapped_file_params::new_file_size</CODE></H4>
  102. <PRE CLASS="broken_ie"> stream_offset new_file_size;</PRE>
  103. <P>If this value is non-zero it specifies the size of a file to be created. If a file with pathname <I>path</I> already exists, it will be overwritten.</P>
  104. <A NAME="mapped_file_params_hint"></A>
  105. <H4><CODE>mapped_file_params::hint</CODE></H4>
  106. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>const</SPAN> <SPAN CLASS='keyword'>char</SPAN>* hint;</PRE>
  107. <P>Suggests a location in the process's address space for the mapping to begin.</P>
  108. <A NAME="mapped_file_source"></A>
  109. <H3>2. Class <CODE>mapped_file_source</CODE></H3>
  110. <H4>Description</H4>
  111. <P>Model of <A HREF="../concepts/source.html">Source</A> providing read-only access to memory-mapped files on Windows and POSIX systems.</P>
  112. <H4>Synopsis</H4>
  113. <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
  114. <SPAN CLASS="keyword">class</SPAN> <SPAN CLASS="defined">mapped_file_source</SPAN> {
  115. <SPAN CLASS="keyword">public</SPAN>:
  116. <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='keyword'>char</SPAN> char_type;
  117. <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='omitted'>[implementation-defined]</SPAN> category;
  118. <A CLASS='documented' HREF='#mapped_file_source_default_ctor'>mapped_file_source</A>();
  119. <SPAN CLASS='keyword'>explicit</SPAN> <A CLASS='documented' HREF='#mapped_file_source_params_ctor'>mapped_file_source</A>(<A CLASS='documented' HREF='#mapped_file_params'>mapped_file_params</A> params);
  120. <SPAN CLASS='keyword'>explicit</SPAN> <A CLASS='documented' HREF='#mapped_file_source_basic_ctor'>mapped_file_source</A>( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  121. size_type length = max_length,
  122. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN> );
  123. void <A CLASS='documented' HREF='#mapped_file_source_params_open'>open</A>(<A CLASS='documented' HREF='#mapped_file_params'>mapped_file_params</A> params);
  124. void <A CLASS='documented' HREF='#mapped_file_source_basic_open'>open</A>( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  125. size_type length = max_length,
  126. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN> );
  127. <SPAN CLASS='keyword'>bool</SPAN> <A CLASS='documented' HREF='#mapped_file_source_is_open'>is_open</A>() <SPAN CLASS='keyword'>const</SPAN>;
  128. <SPAN CLASS='keyword'>void</SPAN> <A CLASS='documented' HREF='#mapped_file_source_close'>close</A>();
  129. size_type <A CLASS='documented' HREF='#mapped_file_source_size'>size</A>() <SPAN CLASS='keyword'>const</SPAN>;
  130. <SPAN CLASS='keyword'>const</SPAN> <SPAN CLASS='keyword'>char</SPAN>* <A CLASS='documented' HREF='#mapped_file_source_data'>data</A>() <SPAN CLASS='keyword'>const</SPAN>;
  131. iterator <A CLASS='documented' HREF='#mapped_file_source_begin'>begin</A>() <SPAN CLASS='keyword'>const</SPAN>;
  132. iterator <A CLASS='documented' HREF='#mapped_file_source_end'>end</A>() <SPAN CLASS='keyword'>const</SPAN>;
  133. <SPAN CLASS='keyword'>static</SPAN> <SPAN CLASS='keyword'>int</SPAN> <A CLASS='documented' HREF='#mapped_file_source_alignment'>alignment</A>();
  134. };
  135. } } // End namespace boost::io</PRE>
  136. <A NAME="mapped_file_source_default_ctor"></A>
  137. <H4><CODE>mapped_file_source::mapped_file_source</CODE></H4>
  138. <PRE CLASS="broken_ie"> mapped_file_source();</PRE>
  139. <P>Constructs a <CODE>mapped_file_source</CODE> which must be opened before it can be used to perform i/o.</P>
  140. <A NAME="mapped_file_source_params_ctor"></A>
  141. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>explicit</SPAN> mapped_file_source(<A CLASS='documented' HREF='#mapped_file_params'>mapped_file_params</A> params);</PRE>
  142. <P>Constructs a <CODE>mapped_file_source</CODE> from the given parameters.</P>
  143. <A NAME="mapped_file_source_basic_ctor"></A>
  144. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>explicit</SPAN> mapped_file_source( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  145. size_type length = max_length,
  146. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN> );</PRE>
  147. <P>Constructs a <CODE>mapped_file_source</CODE> to access a specified file. The parameters have the following interpretation:</P>
  148. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  149. <TR>
  150. <TR>
  151. <TD VALIGN="top"><I>path</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  152. <TD>The pathname of the file to map.</TD>
  153. </TR>
  154. <TR>
  155. <TD VALIGN="top"><I>length</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  156. <TD>The number of bytes to map. If this parameter is not specified, the entire file is mapped.</TD>
  157. </TR>
  158. <TR>
  159. <TD VALIGN="top"><I>offset</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  160. <TD>The offset where the mapping is to begin. This value must be a multiple of the operating system's virtual memory allocation granularity, which can be obtained using the static member function <A HREF='#mapped_file_source_alignment'><CODE>alignment</CODE></A>.</TD>
  161. </TR>
  162. </TABLE>
  163. <A NAME="mapped_file_source_params_open"></A>
  164. <H4><CODE>mapped_file_source::open</CODE></H4>
  165. <PRE CLASS="broken_ie"> void open(<A CLASS='documented' HREF='#mapped_file_params'>mapped_file_params</A> params);</PRE>
  166. <P>Connects this <CODE>mapped_file_source</CODE> to a memory-mapped file obtained as described by the given parameters.</P>
  167. <A NAME="mapped_file_source_basic_open"></A>
  168. <PRE CLASS="broken_ie"> void open( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  169. size_type length = max_length,
  170. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN> );</PRE>
  171. <P>Connects this <CODE>mapped_file_source</CODE> to a memory-mapped file obtained as described by the given parameters, which have the following interpretation:</P>
  172. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  173. <TR>
  174. <TR>
  175. <TD VALIGN="top"><I>path</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  176. <TD>The pathname of the file to map.</TD>
  177. </TR>
  178. <TR>
  179. <TD VALIGN="top"><I>length</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  180. <TD>The number of bytes to map. If this parameter is not specified, the entire file is mapped.</TD>
  181. </TR>
  182. <TR>
  183. <TD VALIGN="top"><I>offset</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  184. <TD>The offset where the mapping is to begin. This value must be a multiple of the operating system's virtual memory allocation granularity, which can be obtained using the static member function <A HREF='#mapped_file_source_alignment'><CODE>alignment</CODE></A>.</TD>
  185. </TR>
  186. </TABLE>
  187. <A NAME="mapped_file_source_is_open"></A>
  188. <H4><CODE>mapped_file_source::is_open</CODE></H4>
  189. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>bool</SPAN> is_open() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  190. <P>Returns <CODE>true</CODE> if this <CODE>mapped_file_source</CODE> has been successfully opened without subsequently having been closed.</P>
  191. <A NAME="mapped_file_source_close"></A>
  192. <H4><CODE>mapped_file_source::close</CODE></H4>
  193. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>void</SPAN> close();</PRE>
  194. <P>Frees the mapping associated with this <CODE>mapped_file_source</CODE>.</P>
  195. <A NAME="mapped_file_source_size"></A>
  196. <H4><CODE>mapped_file_source::size</CODE></H4>
  197. <PRE CLASS="broken_ie"> size_type size() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  198. <P>Returns the size in bytes of the mapping associated with this <CODE>mapped_file_source</CODE>.</P>
  199. <A NAME="mapped_file_source_data"></A>
  200. <H4><CODE>mapped_file_source::data</CODE></H4>
  201. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>const</SPAN> <SPAN CLASS='keyword'>char</SPAN>* data() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  202. <P>Returns a pointer to the first byte of data in the mapping associated with this <CODE>mapped_file_source</CODE>.</P>
  203. <A NAME="mapped_file_source_begin"></A>
  204. <H4><CODE>mapped_file_source::begin</CODE></H4>
  205. <PRE CLASS="broken_ie"> iterator begin() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  206. <P>Returns an iterator to the first byte of data in the mapping associated with this <CODE>mapped_file_source</CODE>.</P>
  207. <A NAME="mapped_file_source_end"></A>
  208. <H4><CODE>mapped_file_source::end</CODE></H4>
  209. <PRE CLASS="broken_ie"> iterator end() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  210. <P>Returns an iterator to just past the last byte of data in the mapping associated with this <CODE>mapped_file_source</CODE>.</P>
  211. <A NAME="mapped_file_source_alignment"></A>
  212. <H4><CODE>mapped_file_source::alignment</CODE></H4>
  213. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>static</SPAN> <SPAN CLASS='keyword'>int</SPAN> alignment();</PRE>
  214. <P>Returns the operating system's virtual memory allocation granularity.</P>
  215. <A NAME="mapped_file_sink"></A>
  216. <H3>3. Class <CODE>mapped_file_sink</CODE></H3>
  217. <H4>Description</H4>
  218. <P>Model of <A HREF="../concepts/sink.html">Sink</A> providing write-only access to memory-mapped files on Windows and POSIX systems.</P>
  219. <H4>Synopsis</H4>
  220. <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
  221. <SPAN CLASS="keyword">class</SPAN> <SPAN CLASS="defined">mapped_file_sink</SPAN> {
  222. <SPAN CLASS="keyword">public</SPAN>:
  223. <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='keyword'>char</SPAN> char_type;
  224. <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='omitted'>[implementation-defined]</SPAN> category;
  225. <SPAN CLASS='keyword'>enum</SPAN> mapmode { readwrite, priv };
  226. <A CLASS='documented' HREF='#mapped_file_sink_default_ctor'>mapped_file_sink</A>();
  227. <SPAN CLASS='keyword'>explicit</SPAN> <A CLASS='documented' HREF='#mapped_file_sink_params_ctor'>mapped_file_sink</A>(<A CLASS='documented' HREF='#mapped_file_params'>mapped_file_params</A> params);
  228. <SPAN CLASS='keyword'>explicit</SPAN> <A CLASS='documented' HREF='#mapped_file_sink_basic_ctor'>mapped_file_sink</A>( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  229. size_type length = max_length,
  230. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN>,
  231. mapmode flags = readwrite );
  232. void <A CLASS='documented' HREF='#mapped_file_sink_params_open'>open</A>(<A CLASS='documented' HREF='#mapped_file_params'>mapped_file_params</A> params);
  233. void <A CLASS='documented' HREF='#mapped_file_sink_basic_open'>open</A>( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  234. size_type length = max_length,
  235. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN>,
  236. mapmode flags = readwrite );
  237. <SPAN CLASS='keyword'>bool</SPAN> <A CLASS='documented' HREF='#mapped_file_sink_is_open'>is_open</A>() <SPAN CLASS='keyword'>const</SPAN>;
  238. mapmode <A CLASS='documented' HREF='#mapped_file_sink_flags'>flags</A>() <SPAN CLASS='keyword'>const</SPAN>;
  239. <SPAN CLASS='keyword'>void</SPAN> <A CLASS='documented' HREF='#mapped_file_sink_close'>close</A>();
  240. size_type <A CLASS='documented' HREF='#mapped_file_sink_size'>size</A>() <SPAN CLASS='keyword'>const</SPAN>;
  241. <SPAN CLASS='keyword'>char</SPAN>* <A CLASS='documented' HREF='#mapped_file_sink_data'>data</A>() <SPAN CLASS='keyword'>const</SPAN>;
  242. iterator <A CLASS='documented' HREF='#mapped_file_sink_begin'>begin</A>() <SPAN CLASS='keyword'>const</SPAN>;
  243. iterator <A CLASS='documented' HREF='#mapped_file_sink_end'>end</A>() <SPAN CLASS='keyword'>const</SPAN>;
  244. <SPAN CLASS='keyword'>static</SPAN> <SPAN CLASS='keyword'>int</SPAN> <A CLASS='documented' HREF='#mapped_file_sink_alignment'>alignment</A>();
  245. };
  246. } } // End namespace boost::io</PRE>
  247. <A NAME="mapped_file_sink_default_ctor"></A>
  248. <H4><CODE>mapped_file_sink::mapped_file_sink</CODE></H4>
  249. <PRE CLASS="broken_ie"> mapped_file_sink();</PRE>
  250. <P>Constructs a <CODE>mapped_file_sink</CODE> which must be opened before it can be used to perform i/o.</P>
  251. <A NAME="mapped_file_sink_params_ctor"></A>
  252. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>explicit</SPAN> mapped_file_sink(<A CLASS='documented' HREF='#mapped_file_params'>mapped_file_params</A> params);</PRE>
  253. <P>Constructs a <CODE>mapped_file_sink</CODE> from the given parameters.</P>
  254. <A NAME="mapped_file_sink_basic_ctor"></A>
  255. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>explicit</SPAN> mapped_file_sink( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  256. size_type length = max_length,
  257. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN>,
  258. mapmode flags );</PRE>
  259. <P>Constructs a <CODE>mapped_file_sink</CODE> to access a specified file. The parameters have the following interpretation:</P>
  260. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  261. <TR>
  262. <TR>
  263. <TD VALIGN="top"><I>path</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  264. <TD>The pathname of the file to map.</TD>
  265. </TR>
  266. <TR>
  267. <TD VALIGN="top"><I>length</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  268. <TD>The number of bytes to map. If this parameter is not specified, the entire file is mapped.</TD>
  269. </TR>
  270. <TR>
  271. <TD VALIGN="top"><I>offset</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  272. <TD>The offset where the mapping is to begin. This value must be a multiple of the operating system's virtual memory allocation granularity, which can be obtained using the static member function <A HREF='#mapped_file_sink_alignment'><CODE>alignment</CODE></A>.</TD>
  273. </TR>
  274. <TR>
  275. <TD VALIGN="top"><I>flags</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  276. <TD>Indicates whether the <CODE>mapped_file_sink</CODE> should be opened for read-write access or private access.</TD>
  277. </TR>
  278. </TABLE>
  279. <A NAME="mapped_file_sink_params_open"></A>
  280. <H4><CODE>mapped_file_sink::open</CODE></H4>
  281. <PRE CLASS="broken_ie"> void open(<A CLASS='documented' HREF='#mapped_file_params'>mapped_file_params</A> params);</PRE>
  282. <P>Connects this <CODE>mapped_file_sink</CODE> to a memory-mapped file obtained as described by the given parameters.</P>
  283. <A NAME="mapped_file_sink_basic_open"></A>
  284. <PRE CLASS="broken_ie"> void open( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  285. size_type length = max_length,
  286. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN>
  287. mapmode flags );</PRE>
  288. <P>Connects this <CODE>mapped_file_sink</CODE> to a memory-mapped file obtained as described by the given parameters, which have the following interpretation:</P>
  289. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  290. <TR>
  291. <TR>
  292. <TD VALIGN="top"><I>path</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  293. <TD>The pathname of the file to map.</TD>
  294. </TR>
  295. <TR>
  296. <TD VALIGN="top"><I>length</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  297. <TD>The number of bytes to map. If this parameter is not specified, the entire file is mapped.</TD>
  298. </TR>
  299. <TR>
  300. <TD VALIGN="top"><I>offset</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  301. <TD>The offset where the mapping is to begin. This value must be a multiple of the operating system's virtual memory allocation granularity, which can be obtained using the static member function <A HREF='#mapped_file_sink_alignment'><CODE>alignment</CODE></A>.</TD>
  302. </TR>
  303. <TR>
  304. <TD VALIGN="top"><I>flags</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  305. <TD>Indicates whether the <CODE>mapped_file_sink</CODE> should be opened for read-write access or private access.</TD>
  306. </TR>
  307. </TABLE>
  308. <A NAME="mapped_file_sink_is_open"></A>
  309. <H4><CODE>mapped_file_sink::is_open</CODE></H4>
  310. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>bool</SPAN> is_open() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  311. <P>Returns <CODE>true</CODE> if this <CODE>mapped_file_sink</CODE> has been successfully opened without subsequently having been closed.</P>
  312. <A NAME="mapped_file_sink_flags"></A>
  313. <H4><CODE>mapped_file_sink::flags</CODE></H4>
  314. <PRE CLASS="broken_ie"> mapmode flags() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  315. <P>Indicates whether the <CODE>mapped_file_sink</CODE> was opened for read/write-access or private-access.</P>
  316. <A NAME="mapped_file_sink_close"></A>
  317. <H4><CODE>mapped_file_sink::close</CODE></H4>
  318. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>void</SPAN> close();</PRE>
  319. <P>Frees the mapping associated with this <CODE>mapped_file_sink</CODE>.</P>
  320. <A NAME="mapped_file_sink_size"></A>
  321. <H4><CODE>mapped_file_sink::size</CODE></H4>
  322. <PRE CLASS="broken_ie"> size_type size() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  323. <P>Returns the size in bytes of the mapping associated with this <CODE>mapped_file_sink</CODE>.</P>
  324. <A NAME="mapped_file_sink_data"></A>
  325. <H4><CODE>mapped_file_sink::data</CODE></H4>
  326. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>char</SPAN>* data() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  327. <P>Returns a pointer to the first byte of data in the mapping associated with this <CODE>mapped_file_sink</CODE>.</P>
  328. <A NAME="mapped_file_sink_begin"></A>
  329. <H4><CODE>mapped_file_sink::begin</CODE></H4>
  330. <PRE CLASS="broken_ie"> iterator begin() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  331. <P>Returns an iterator to the first byte of data in the mapping associated with this <CODE>mapped_file_sink</CODE>.</P>
  332. <A NAME="mapped_file_sink_end"></A>
  333. <H4><CODE>mapped_file_sink::end</CODE></H4>
  334. <PRE CLASS="broken_ie"> iterator end() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  335. <P>Returns an iterator to just past the last byte of data in the mapping associated with this <CODE>mapped_file_sink</CODE>.</P>
  336. <A NAME="mapped_file_sink_alignment"></A>
  337. <H4><CODE>mapped_file_sink::alignment</CODE></H4>
  338. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>static</SPAN> <SPAN CLASS='keyword'>int</SPAN> alignment();</PRE>
  339. <P>Returns the operating system's virtual memory allocation granularity.</P>
  340. <A NAME="mapped_file"></A>
  341. <H3>4. Class <CODE>mapped_file</CODE></H3>
  342. <H4>Description</H4>
  343. <P>Model of <A HREF="../concepts/seekable_device.html">SeekableDevice</A> providing read-write access to memory-mapped files on Windows and POSIX systems.</P>
  344. <H4>Synopsis</H4>
  345. <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
  346. <SPAN CLASS="keyword">class</SPAN> <SPAN CLASS="defined">mapped_file</SPAN> {
  347. <SPAN CLASS="keyword">public</SPAN>:
  348. <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='keyword'>char</SPAN> char_type;
  349. <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='omitted'>[implementation-defined]</SPAN> category;
  350. <SPAN CLASS='keyword'>enum</SPAN> mapmode { readonly, readwrite, priv };
  351. <A CLASS='documented' HREF='#mapped_file_default_ctor'>mapped_file</A>();
  352. <SPAN CLASS='keyword'>explicit</SPAN> <A CLASS='documented' HREF='#mapped_file_params_ctor'>mapped_file</A>(<A CLASS='documented' HREF='#mapped_file_params'>mapped_file_params</A> params);
  353. <SPAN CLASS='keyword'>explicit</SPAN> <A CLASS='documented' HREF='#mapped_file_basic_ctor'>mapped_file</A>( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  354. std::ios_base::openmode mode =
  355. std::ios_base::in | std::ios_base::out,
  356. size_type length = max_length,
  357. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN> );
  358. <SPAN CLASS='keyword'>explicit</SPAN> <A CLASS='documented' HREF='#mapped_file_mapmode_ctor'>mapped_file</A>( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  359. mapmode mode,
  360. size_type length = max_length,
  361. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN> );
  362. <SPAN CLASS='keyword'>void</SPAN> <A CLASS='documented' HREF='#mapped_file_params_open'>open</A>(<A CLASS='documented' HREF='#mapped_file_params'>mapped_file_params</A> params);
  363. <SPAN CLASS='keyword'>void</SPAN> <A CLASS='documented' HREF='#mapped_file_basic_open'>open</A>( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  364. std::ios_base::openmode mode =
  365. std::ios_base | std::ios_base,
  366. size_type length = max_length,
  367. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN> );
  368. <SPAN CLASS='keyword'>void</SPAN> <A CLASS='documented' HREF='#mapped_file_mapmode_open'>open</A>( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  369. mapmode mode,
  370. size_type length = max_length,
  371. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN> );
  372. <SPAN CLASS='keyword'>bool</SPAN> <A CLASS='documented' HREF='#mapped_file_is_open'>is_open</A>() <SPAN CLASS='keyword'>const</SPAN>;
  373. mapmode <A CLASS='documented' HREF='#mapped_file_flags'>flags</A>() <SPAN CLASS='keyword'>const</SPAN>;
  374. <SPAN CLASS='keyword'>void</SPAN> <A CLASS='documented' HREF='#mapped_file_close'>close</A>();
  375. size_type <A CLASS='documented' HREF='#mapped_file_size'>size</A>() <SPAN CLASS='keyword'>const</SPAN>;
  376. <SPAN CLASS='keyword'>char</SPAN>* <A CLASS='documented' HREF='#mapped_file_data'>data</A>() <SPAN CLASS='keyword'>const</SPAN>;
  377. <SPAN CLASS='keyword'>const</SPAN> <SPAN CLASS='keyword'>char</SPAN>* <A CLASS='documented' HREF='#mapped_file_const_data'>const_data</A>() <SPAN CLASS='keyword'>const</SPAN>;
  378. iterator <A CLASS='documented' HREF='#mapped_file_begin'>begin</A>() <SPAN CLASS='keyword'>const</SPAN>;
  379. const_iterator <A CLASS='documented' HREF='#mapped_file_const_begin'>const_begin</A>() <SPAN CLASS='keyword'>const</SPAN>;
  380. iterator <A CLASS='documented' HREF='#mapped_file_end'>end</A>() <SPAN CLASS='keyword'>const</SPAN>;
  381. const_iterator <A CLASS='documented' HREF='#mapped_file_const_end'>const_end</A>() <SPAN CLASS='keyword'>const</SPAN>;
  382. <SPAN CLASS='keyword'>static</SPAN> <SPAN CLASS='keyword'>int</SPAN> <A CLASS='documented' HREF='#mapped_file_alignment'>alignment</A>();
  383. };
  384. } } // End namespace boost::iostreams</PRE>
  385. <A NAME="mapped_file_default_ctor"></A>
  386. <H4><CODE>mapped_file::mapped_file</CODE></H4>
  387. <PRE CLASS="broken_ie"> mapped_file();</PRE>
  388. <P>Constructs a <CODE>mapped_file</CODE> which must be opened before it can be used to perform i/o.</P>
  389. <A NAME="mapped_file_params_ctor"></A>
  390. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>explicit</SPAN> mapped_file(<A CLASS='documented' HREF='#mapped_file_params'>mapped_file_params</A> params);</PRE>
  391. <P>Constructs a <CODE>mapped_file</CODE> from the given parameters.</P>
  392. <A NAME="mapped_file_basic_ctor"></A>
  393. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>explicit</SPAN> mapped_file( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  394. std::ios_base::openmode mode =
  395. std::ios_base | std::ios_base,
  396. size_type length = max_length,
  397. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN> );</PRE>
  398. <P>Constructs a <CODE>mapped_file</CODE> to access a specified file. The parameters have the following interpretation:</P>
  399. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  400. <TR>
  401. <TR>
  402. <TD VALIGN="top"><I>path</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  403. <TD>The pathname of the file to map.</TD>
  404. </TR>
  405. <TR>
  406. <TD VALIGN="top"><I>mode</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  407. <TD>Indicates whether the file should be opened with read-access, write-access or both. Use of <CODE>std::ios_base::openmode</CODE> with <CODE>mapped_file</CODE> is deprecated. Please use <CODE>mapmode</CODE> instead in new code.</TD>
  408. </TR>
  409. <TR>
  410. <TD VALIGN="top"><I>length</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  411. <TD>The number of bytes to map. If this parameter is not specified, the entire file is mapped.</TD>
  412. </TR>
  413. <TR>
  414. <TD VALIGN="top"><I>offset</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  415. <TD>The offset where the mapping is to begin. This value must be a multiple of the operating system's virtual memory allocation granularity, which can be obtained using the static member function <A HREF='#mapped_file_alignment'><CODE>alignment</CODE></A>.</TD>
  416. </TR>
  417. </TABLE>
  418. <A NAME="mapped_file_mapmode_ctor"></A>
  419. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>explicit</SPAN> mapped_file( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  420. mapmode mode,
  421. size_type length = max_length,
  422. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN> );</PRE>
  423. <P>Constructs a <CODE>mapped_file</CODE> to access a specified file. The parameters have the following interpretation:</P>
  424. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  425. <TR>
  426. <TR>
  427. <TD VALIGN="top"><I>path</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  428. <TD>The pathname of the file to map.</TD>
  429. </TR>
  430. <TR>
  431. <TD VALIGN="top"><I>mode</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  432. <TD>Indicates whether the file should be opened with read-access, read/write-access or private-access.</TD>
  433. </TR>
  434. <TR>
  435. <TD VALIGN="top"><I>length</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  436. <TD>The number of bytes to map. If this parameter is not specified, the entire file is mapped.</TD>
  437. </TR>
  438. <TR>
  439. <TD VALIGN="top"><I>offset</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  440. <TD>The offset where the mapping is to begin. This value must be a multiple of the operating system's virtual memory allocation granularity, which can be obtained using the static member function <A HREF='#mapped_file_alignment'><CODE>alignment</CODE></A>.</TD>
  441. </TR>
  442. </TABLE>
  443. <A NAME="mapped_file_params_open"></A>
  444. <H4><CODE>mapped_file::open</CODE></H4>
  445. <PRE CLASS="broken_ie"> void open(<A CLASS='documented' HREF='#mapped_file_params'>mapped_file_params</A> params);</PRE>
  446. <P>Connects this <CODE>mapped_file</CODE> to a memory-mapped file obtained as described by the given parameters.</P>
  447. <A NAME="mapped_file_basic_open"></A>
  448. <PRE CLASS="broken_ie"> void open( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  449. std::ios_base::openmode mode =
  450. std::ios_base | std::ios_base,
  451. size_type length = max_length,
  452. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN> );</PRE>
  453. <P>Connects this <CODE>mapped_file</CODE> to a memory-mapped file obtained as described by the given parameters, which have the following interpretation:</P>
  454. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  455. <TR>
  456. <TR>
  457. <TD VALIGN="top"><I>path</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  458. <TD>The pathname of the file to map.</TD>
  459. </TR>
  460. <TR>
  461. <TD VALIGN="top"><I>mode</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  462. <TD>Indicates whether the file should be opened with read-access, write-access or both. Use of <CODE>std::ios_base::openmode</CODE> with <CODE>mapped_file</CODE> is deprecated. Please use <CODE>mapmode</CODE> in new code.</TD>
  463. </TR>
  464. <TR>
  465. <TD VALIGN="top"><I>length</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  466. <TD>The number of bytes to map. If this parameter is not specified, the entire file is mapped.</TD>
  467. </TR>
  468. <TR>
  469. <TD VALIGN="top"><I>offset</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  470. <TD>The offset where the mapping is to begin. This value must be a multiple of the operating system's virtual memory allocation granularity, which can be obtained using the static member function <A HREF='#mapped_file_alignment'><CODE>alignment</CODE></A>.</TD>
  471. </TR>
  472. </TABLE>
  473. <A NAME="mapped_file_mapmode_open"></A>
  474. <PRE CLASS="broken_ie"> void open( <SPAN CLASS='keyword'>const</SPAN> std::string&amp; path,
  475. mapmode mode,
  476. size_type length = max_length,
  477. boost::intmax_t offset = <SPAN CLASS='numeric_literal'>0</SPAN> );</PRE>
  478. <P>Connects this <CODE>mapped_file</CODE> to a memory-mapped file obtained as described by the given parameters, which have the following interpretation:</P>
  479. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  480. <TR>
  481. <TR>
  482. <TD VALIGN="top"><I>path</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  483. <TD>The pathname of the file to map.</TD>
  484. </TR>
  485. <TR>
  486. <TD VALIGN="top"><I>mode</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  487. <TD>Indicates whether the file should be opened with read-access, read/write-access or private access.</TD>
  488. </TR>
  489. <TR>
  490. <TD VALIGN="top"><I>length</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  491. <TD>The number of bytes to map. If this parameter is not specified, the entire file is mapped.</TD>
  492. </TR>
  493. <TR>
  494. <TD VALIGN="top"><I>offset</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  495. <TD>The offset where the mapping is to begin. This value must be a multiple of the operating system's virtual memory allocation granularity, which can be obtained using the static member function <A HREF='#mapped_file_alignment'><CODE>alignment</CODE></A>.</TD>
  496. </TR>
  497. </TABLE>
  498. <A NAME="mapped_file_is_open"></A>
  499. <H4><CODE>mapped_file::is_open</CODE></H4>
  500. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>bool</SPAN> is_open() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  501. <P>Returns <CODE>true</CODE> if this <CODE>mapped_file</CODE> has been successfully opened without subsequently having been closed.</P>
  502. <A NAME="mapped_file_flags"></A>
  503. <H4><CODE>mapped_file::flags</CODE></H4>
  504. <PRE CLASS="broken_ie"> mapmode flags() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  505. <P>Indicates whether the <CODE>mapped_file</CODE> was opened for read-access, read/write-access or private-access.</P>
  506. <A NAME="mapped_file_close"></A>
  507. <H4><CODE>mapped_file::close</CODE></H4>
  508. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>void</SPAN> close();</PRE>
  509. <P>Frees the mapping associated with this <CODE>mapped_file</CODE>.</P>
  510. <A NAME="mapped_file_size"></A>
  511. <H4><CODE>mapped_file::size</CODE></H4>
  512. <PRE CLASS="broken_ie"> size_type size() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  513. <P>Returns the size in bytes of the mapping associated with this <CODE>mapped_file</CODE>.</P>
  514. <A NAME="mapped_file_data"></A>
  515. <H4><CODE>mapped_file::data</CODE></H4>
  516. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>char</SPAN>* data() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  517. <P>Returns a pointer to the first byte of data in the mapping associated with this <CODE>mapped_file</CODE>, if it was opened with write-access, and a null pointer otherwise.</P>
  518. <A NAME="mapped_file_const_data"></A>
  519. <H4><CODE>mapped_file::const_data</CODE></H4>
  520. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>const</SPAN> <SPAN CLASS='keyword'>char</SPAN>* const_data() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  521. <P>Returns a pointer to the first byte of data in the mapping associated with this <CODE>mapped_file</CODE>.</P>
  522. <A NAME="mapped_file_begin"></A>
  523. <H4><CODE>mapped_file::begin</CODE></H4>
  524. <PRE CLASS="broken_ie"> iterator begin() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  525. <P>Returns an iterator to the first byte of data in the mapping associated with this <CODE>mapped_file</CODE>, if it was opened with write-access, and a null pointer iterator otherwise.</P>
  526. <A NAME="mapped_file_const_begin"></A>
  527. <H4><CODE>mapped_file::const_begin</CODE></H4>
  528. <PRE CLASS="broken_ie"> const_iterator const_begin() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  529. <P>Returns a const_iterator to the first byte of data in the mapping associated with this <CODE>mapped_file</CODE>.</P>
  530. <A NAME="mapped_file_end"></A>
  531. <H4><CODE>mapped_file::end</CODE></H4>
  532. <PRE CLASS="broken_ie"> iterator end() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  533. <P>Returns an iterator to just past the last byte of data in the mapping associated with this <CODE>mapped_file</CODE>, if it was opened with write-access, and a null pointer otherwise.</P>
  534. <A NAME="mapped_file_const_end"></A>
  535. <H4><CODE>mapped_file::const_end</CODE></H4>
  536. <PRE CLASS="broken_ie"> const_iterator const_end() <SPAN CLASS='keyword'>const</SPAN>;</PRE>
  537. <P>Returns a const_iterator to just past the last byte of data in the mapping associated with this <CODE>mapped_file</CODE>.</P>
  538. <A NAME="mapped_file_alignment"></A>
  539. <H4><CODE>mapped_file::alignment</CODE></H4>
  540. <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>static</SPAN> <SPAN CLASS='keyword'>int</SPAN> alignment();</PRE>
  541. <P>Returns the operating system's virtual memory allocation granularity.</P>
  542. <!-- Begin Footer -->
  543. <HR>
  544. <P CLASS="copyright">&copy; Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>&copy; Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan Turkanis</a></P>
  545. <P CLASS="copyright">
  546. 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>)
  547. </P>
  548. <!-- End Footer -->
  549. </BODY>