casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Member Functions
casa::MMapIO Class Reference

Memory-mapped IO on a file. More...

#include <MMapIO.h>

Inheritance diagram for casa::MMapIO:
casa::MMapfdIO casa::LargeFiledesIO casa::ByteIO

List of all members.

Public Member Functions

 MMapIO (const RegularFile &regularFile, ByteIO::OpenOption=ByteIO::Old)
 Open the given file and map it entirely into memory with read access.
 ~MMapIO ()
 Destructor.

Private Member Functions

 MMapIO (const MMapIO &)
 Forbid copy constructor and assignment.
MMapIOoperator= (const MMapIO &)

Detailed Description

Memory-mapped IO on a file.

Synopsis

Memory-mapped IO lets the OS take care of caching file segments. This is particularly useful for the Tiled Storage Manager which keeps a cache of tiles. When using memory-mapped IO it does not need to do that anymore.

On 32-bit systems its use is limited because for large files the 4 GB memory space is insufficient. However, for 64-bit systems the memory space is large enough to make use of it.

In the general case there is direct access to the mapped file space. The read and write methods copies the data into/from a buffer. However, to avoid the copying it is possible to get a direct pointer to the mapped data. This should be used with care, because writing to it will cause a segmentation if the file is readonly. If the file is writable, writing into the mapped data segment means changing the file contents.

Definition at line 62 of file MMapIO.h.


Constructor & Destructor Documentation

casa::MMapIO::MMapIO ( const RegularFile regularFile,
ByteIO::OpenOption  = ByteIO::Old 
) [explicit]

Open the given file and map it entirely into memory with read access.

The map has write access if the file is opened for write.

Destructor.

It will flush and unmap the file.

casa::MMapIO::MMapIO ( const MMapIO ) [private]

Forbid copy constructor and assignment.


Member Function Documentation

MMapIO& casa::MMapIO::operator= ( const MMapIO ) [private]

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