Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXMemMap Class Reference

A Memory Map provides a view of a file as an array of memory; this allows the file itself to be used as backing for the data and very simplified file access results. More...

#include <FXMemMap.h>

Inheritance diagram for FX::FXMemMap:
FX::FXFile FX::FXIODevice FX::FXIO

List of all members.

Public Member Functions

 FXMemMap ()
 Construct a memory map.
void * openMap (const FXString &filename, FXlong off=0, FXival len=-1L, FXuint m=FXIO::Reading, FXuint p=FXIO::AllReadWrite)
 Open a file, and map a view of it into memory; the offset must be a multiple of the page size.
void * openMap (FXInputHandle h, FXlong off=0, FXival len=-1L, FXuint m=FXIO::Reading)
 Open map using existing file handle, and map a view of it into memory.
void * map (FXlong off=0, FXival len=-1L)
 Map a view of the already open file into memory.
void * base () const
 Return pointer to memory area.
FXival length () const
 Obtain length of the map.
FXlong offset () const
 Obtain offset of the map.
virtual FXlong position () const
 Get current file position.
virtual FXlong position (FXlong off, FXuint from=FXIO::Begin)
 Change file position, returning new position from start.
void * unmap ()
 Unmap the view of the file.
virtual FXival readBlock (void *ptr, FXival count)
 Read block of bytes, returning number of bytes read.
virtual FXival writeBlock (const void *ptr, FXival count)
 Write block of bytes, returning number of bytes written.
virtual FXbool flush ()
 Flush to disk.
virtual FXbool close ()
 Close file, and also the map.
 ~FXMemMap ()
 Destroy the map.
- Public Member Functions inherited from FX::FXFile
 FXFile ()
 Construct file.
 FXFile (FXInputHandle h, FXuint m=FXIO::Reading)
 Construct file and attach existing handle h.
 FXFile (const FXString &file, FXuint m=FXIO::Reading, FXuint perm=FXIO::AllReadWrite)
 Construct and open a file.
virtual FXbool open (const FXString &file, FXuint m=FXIO::Reading, FXuint perm=FXIO::AllReadWrite)
 Open file.
virtual FXbool open (FXInputHandle h, FXuint m=FXIO::Reading)
 Open device with access mode and handle.
virtual FXbool isSerial () const
 Return true if serial access only.
virtual FXlong truncate (FXlong sz)
 Truncate file to size s.
virtual FXint eof ()
 Test if we're at the end; -1 if error.
virtual FXlong size ()
 Return file size.
- Public Member Functions inherited from FX::FXIODevice
 FXIODevice ()
 Construct.
 FXIODevice (FXInputHandle h, FXuint m=FXIO::Reading)
 Construct device and attach existing handle h.
FXInputHandle handle () const
 Return handle.
virtual FXbool setMode (FXuint m)
 Change access mode of open device.
virtual FXbool isOpen () const
 Return true if open.
virtual FXbool attach (FXInputHandle h, FXuint m)
 Attach existing device handle, taking ownership of the handle.
virtual FXbool detach ()
 Detach device handle.
virtual ~FXIODevice ()
 Destroy and close.
- Public Member Functions inherited from FX::FXIO
FXbool isReadable () const
 Is readable.
FXbool isWritable () const
 Is writable.
FXuint mode () const
 Return access mode.
FXbool readChar (FXchar &ch)
 Read character.
FXbool writeChar (FXchar ch)
 Write character.
virtual ~FXIO ()
 Destroy and close.

Additional Inherited Members

- Static Public Member Functions inherited from FX::FXFile
static FXbool create (const FXString &file, FXuint perm=FXIO::AllReadWrite)
 Create new (empty) file.
static FXbool link (const FXString &srcfile, const FXString &dstfile)
 Link file.
static FXString symlink (const FXString &file)
 Read symbolic link.
static FXbool symlink (const FXString &srcfile, const FXString &dstfile)
 Symbolic link file.
static FXbool identical (const FXString &file1, const FXString &file2)
 Return true if files are identical (identical node on disk)
static FXbool copy (const FXString &srcfile, const FXString &dstfile, FXbool overwrite=false)
 Copy srcfile to dstfile, overwriting dstfile if allowed.
static FXbool copyFiles (const FXString &srcfile, const FXString &dstfile, FXbool overwrite=false)
 Recursively copy files or directories from srcfile to dstfile, overwriting dstfile if allowed.
static FXbool move (const FXString &srcfile, const FXString &dstfile, FXbool overwrite=false)
 Move or rename srcfile to dstfile, overwriting dstfile if allowed.
static FXbool moveFiles (const FXString &srcfile, const FXString &dstfile, FXbool overwrite=false)
 Recursively copy or move files or directories from srcfile to dstfile, overwriting dstfile if allowed.
static FXbool remove (const FXString &file)
 Remove file.
static FXbool removeFiles (const FXString &path, FXbool recursive=false)
 Recursively remove file or directory, recurse if allowed.
static FXbool concat (const FXString &srcfile1, const FXString &srcfile2, const FXString &dstfile, FXbool overwrite=false)
 Concatenate srcfile1 and srcfile2 to dstfile, overwriting dstfile if allowed.

Detailed Description

A Memory Map provides a view of a file as an array of memory; this allows the file itself to be used as backing for the data and very simplified file access results.

Moreover, mapped files may be shared by processes, resuling in far less "real" memory being used than would otherwise be the case.


The documentation for this class was generated from the following file:

Copyright © 1997-2016 Jeroen van der Zijp