class MappedFile
|
map a named disk file into memory.
More... |
|
|
Public Members
- MappedFile (const char *fname, pos_t offset, size_t size, int mode)
- virtual ~MappedFile ()
- inline void Sync (void)
- inline void Update (unsigned offset, size_t len)
- inline void * Fetch (unsigned offset)
- friend inline void sync (MappedFile &m)
- friend inline void update (MappedFile &m, unsigned offset, size_t len)
- friend inline void * fetch (MappedFile &m, unsigned offset = 0)
Detailed Description
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.
MappedFile (const char *fname, pos_t offset, size_t size, int mode)
|
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.
Parameters:
fname | pathname of file to map into memory.
|
offset | from start of file to begin mapping in bytes.
|
size | of mapped area in bytes.
|
mode | to map file.
|
[virtual]
Release a mapped section of memory associated with a file. The
mapped area is updated back to disk.
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.
inline void Update (unsigned offset, size_t len)
|
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.
Parameters:
offset | into the mapped region of memory.
|
len | of partial region (example, record length).
|
inline void * Fetch (unsigned offset)
|
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.
Parameters:
offset | from start of mapped memory.
|
- Author: David Sugar
- Generated: dyfet@home.sys on Wed Mar 15 14:08:35 200.