1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
<HTML><HEAD><TITLE>MappedFile Class</TITLE></HEAD>
<BODY bgcolor="#ffffff">
<H1>MappedFile Class Reference</H1>
<p>
[<A HREF="index.html">APE Index</A>] [<A HREF="hier.html">APE Hierarchy</A>]
[<A HREF="header-list.html">Headers</A>]
</p>
<HR>
<P>map a named disk file into memory. <a href="#short">More...</a></P>
<P>
<code>
#include <<a href="file-h.html">file.h</a>>
</code>
</P>
<P>
Inherits: <a href="File.html">File</a>
<P>
<H2>Public Members</H2>
<UL>
<LI> <b><a href="#ref0">MappedFile</a></b> (const char *fname, pos_t offset, size_t size, int mode)
</LI>
<LI>virtual <b><a href="#ref1">~MappedFile</a></b> ()
</LI>
<LI>inline void <b><a href="#ref2">Sync</a></b> (void)
</LI>
<LI>inline void <b><a href="#ref3">Update</a></b> (unsigned offset, size_t len)
</LI>
<LI>inline void* <b><a href="#ref4">Fetch</a></b> (unsigned offset)
</LI>
<LI>friend inline void <b><a name="ref5">sync</a></b> (MappedFile &m)
</LI>
<LI>friend inline void <b><a name="ref6">update</a></b> (MappedFile &m, unsigned offset, size_t len)
</LI>
<LI>friend inline void* <b><a name="ref7">fetch</a></b> (MappedFile &m, unsigned offset = 0)
</LI>
</UL>
<HR>
<H2><a name="short">Detailed Description</a></H2>
<P>
Create and map a disk file into memory. This portable class works
under both Posix via mmap and under the win32 API. A mapped file
can be referenced directly by it's memory segment.
</P><HR>
<H3><b> <a name="ref0"></a><a name="MappedFile">MappedFile</a>(const char *fname, pos_t offset, size_t size, int mode) </b><code>[public]</code></H3>
<p>Map a portion or all of a specified file in the specified
shared memory access mode. Valid mapping modes include
FILE_MAPPED_READ, FILE_MAPPED_WRITE, and FILE_MAPPED_RDWR.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
size</td><td align="left" valign="top">
of mapped area in bytes.</td></tr>
<tr><td align="left" valign="top">
mode</td><td align="left" valign="top">
to map file.</td></tr>
<tr><td align="left" valign="top">
offset</td><td align="left" valign="top">
from start of file to begin mapping in bytes.</td></tr>
<tr><td align="left" valign="top">
fname</td><td align="left" valign="top">
pathname of file to map into memory.</td></tr>
</table>
</dl>
<H3><b> <a name="ref1"></a><a name="~MappedFile">~MappedFile</a>() </b><code>[public virtual]</code></H3>
<p>Release a mapped section of memory associated with a file. The
mapped area is updated back to disk.
</p>
<H3><b>inline void <a name="ref2"></a><a name="Sync">Sync</a>(void) </b><code>[public]</code></H3>
<p>Synchronize the contents of the mapped portion of memory with
the disk file and wait for completion. This assures the memory
mapped from the file is written back.
</p>
<H3><b>inline void <a name="ref3"></a><a name="Update">Update</a>(unsigned offset, size_t len) </b><code>[public]</code></H3>
<p>Map a portion of the memory mapped from the file back to the
file and do not wait for completion. This is useful when mapping
a database file and updating a single record.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
len</td><td align="left" valign="top">
of partial region (example, record length).</td></tr>
<tr><td align="left" valign="top">
offset</td><td align="left" valign="top">
into the mapped region of memory.</td></tr>
</table>
</dl>
<H3><b>inline void* <a name="ref4"></a><a name="Fetch">Fetch</a>(unsigned offset) </b><code>[public]</code></H3>
<p>Fetch a pointer to an offset within the memory mapped portion
of the disk file. This really is used for convience of matching
operations between Update and Fetch, as one could simply have
accessed the base pointer where the file was mapped directly.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
offset</td><td align="left" valign="top">
from start of mapped memory.</td></tr>
</table>
</dl>
<HR>
<TABLE WIDTH="100%"><TR><TD ALIGN="left" VALIGN="top">
<UL><LI><I>Author</I>: David Sugar </LI>
<LI>Documentation generated by dyfet@home.sys on Thu Dec 16 09:54:26 EST 1999
</LI>
</UL></TD><TD ALIGN="RIGHT" VALIGN="TOP">
<b>K</b><i>doc</i>
</TD>
</TR></TABLE></BODY></HTML>
|