casacore::MMapIO Class Reference

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

#include <MMapIO.h>

Inheritance diagram for casacore::MMapIO:
casacore::MMapfdIO casacore::FiledesIO casacore::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 &)
 Assignment, should not be used.

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 63 of file MMapIO.h.


Constructor & Destructor Documentation

casacore::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.

casacore::MMapIO::~MMapIO (  ) 

Destructor.

It will flush and unmap the file.

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

Forbid copy constructor and assignment.


Member Function Documentation

MMapIO& casacore::MMapIO::operator= ( const MMapIO that  )  [private]

Assignment, should not be used.

Reimplemented from casacore::MMapfdIO.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1