casacore
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
casa
IO
MMapIO.h
Go to the documentation of this file.
1
//# MMapIO.h: Memory-mapped IO on a file
2
//#
3
//# Copyright (C) 2009
4
//# Associated Universities, Inc. Washington DC, USA.
5
//#
6
//# This library is free software; you can redistribute it and/or modify it
7
//# under the terms of the GNU Library General Public License as published by
8
//# the Free Software Foundation; either version 2 of the License, or (at your
9
//# option) any later version.
10
//#
11
//# This library is distributed in the hope that it will be useful, but WITHOUT
12
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14
//# License for more details.
15
//#
16
//# You should have received a copy of the GNU Library General Public License
17
//# along with this library; if not, write to the Free Software Foundation,
18
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
19
//#
20
//# Correspondence concerning AIPS++ should be addressed as follows:
21
//# Internet email: aips2-request@nrao.edu.
22
//# Postal address: AIPS++ Project Office
23
//# National Radio Astronomy Observatory
24
//# 520 Edgemont Road
25
//# Charlottesville, VA 22903-2475 USA
26
//#
27
//# $Id$
28
29
#ifndef CASA_MMAPIO_H
30
#define CASA_MMAPIO_H
31
32
//# Includes
33
#include <
casacore/casa/aips.h
>
34
#include <
casacore/casa/IO/MMapfdIO.h
>
35
#include <
casacore/casa/OS/RegularFile.h
>
36
37
namespace
casacore
38
{
39
40
// <summary>
41
// Memory-mapped IO on a file.
42
// </summary>
43
44
// <synopsis>
45
// Memory-mapped IO lets the OS take care of caching file segments.
46
// This is particularly useful for the Tiled Storage Manager which keeps a
47
// cache of tiles. When using memory-mapped IO it does not need to do that
48
// anymore.
49
//
50
// On 32-bit systems its use is limited because for large files the 4 GB
51
// memory space is insufficient. However, for 64-bit systems the memory
52
// space is large enough to make use of it.
53
//
54
// In the general case there is direct access to the mapped file space.
55
// The read and write methods copies the data into/from a buffer.
56
// However, to avoid the copying it is possible to get a direct pointer
57
// to the mapped data. This should be used with care, because writing to
58
// it will cause a segmentation if the file is readonly. If the file is
59
// writable, writing into the mapped data segment means changing the file
60
// contents.
61
// </synopsis>
62
63
class
MMapIO
:
public
MMapfdIO
64
{
65
public
:
66
// Open the given file and map it entirely into memory with read access.
67
// The map has write access if the file is opened for write.
68
explicit
MMapIO
(
const
RegularFile
& regularFile,
69
ByteIO::OpenOption
=
ByteIO::Old
);
70
71
// Destructor.
72
// It will flush and unmap the file.
73
~MMapIO
();
74
75
private
:
76
// Forbid copy constructor and assignment
77
// <group>
78
MMapIO
(
const
MMapIO
&);
79
MMapIO
&
operator=
(
const
MMapIO
&);
80
// </group>
81
};
82
83
}
// end namespace
84
85
#endif
RegularFile.h
aips.h
casacore::MMapIO::MMapIO
MMapIO(const RegularFile ®ularFile, ByteIO::OpenOption=ByteIO::Old)
Open the given file and map it entirely into memory with read access.
MMapfdIO.h
casacore::MMapfdIO
Memory-mapped IO on a file.
Definition:
MMapfdIO.h:63
casacore::ByteIO::Old
Definition:
ByteIO.h:66
casacore::MMapIO::~MMapIO
~MMapIO()
Destructor.
casacore::RegularFile
Manipulate and get information about regular files.
Definition:
RegularFile.h:91
casacore::MMapIO
Memory-mapped IO on a file.
Definition:
MMapIO.h:63
casacore::ByteIO::OpenOption
OpenOption
Define the possible ByteIO open options.
Definition:
ByteIO.h:65
casacore::MMapIO::operator=
MMapIO & operator=(const MMapIO &)
Generated by
1.8.5