![]() |
CASToR
3.2
Tomographic Reconstruction (PET/SPECT/CT)
|
Portable read-only memory mapping (Windows and Linux) More...
#include <oMemoryMapped.hh>
Public Types | |
enum | CacheHint { Normal, SequentialScan, RandomAccess, Normal, SequentialScan, RandomAccess } |
tweak performance More... | |
enum | MapRange { WholeFile = 0, WholeFile = 0 } |
how much should be mappend More... | |
enum | CacheHint { Normal, SequentialScan, RandomAccess, Normal, SequentialScan, RandomAccess } |
tweak performance More... | |
enum | MapRange { WholeFile = 0, WholeFile = 0 } |
how much should be mappend More... | |
Public Member Functions | |
oMemoryMapped () | |
do nothing, must use open() More... | |
oMemoryMapped (const std::string &filename, size_t mappedBytes=WholeFile, CacheHint hint=Normal) | |
open file, mappedBytes = 0 maps the whole file More... | |
~oMemoryMapped () | |
close file (see close() ) More... | |
int | Open (const std::string &filename, size_t mappedBytes=WholeFile, CacheHint hint=Normal) |
open file, mappedBytes = 0 maps the whole file More... | |
void | Close () |
close file More... | |
unsigned char | operator[] (size_t offset) const |
access position, no range checking (faster) More... | |
unsigned char | at (size_t offset) const |
access position, including range checking More... | |
const unsigned char * | GetData () const |
raw access More... | |
bool | IsValid () const |
true, if file successfully opened More... | |
uint64_t | size () const |
get file size More... | |
size_t | mappedSize () const |
get number of actually mapped bytes More... | |
int | Remap (uint64_t offset, size_t mappedBytes) |
replace mapping by a new one of the same file, offset MUST be a multiple of the page size More... | |
oMemoryMapped () | |
do nothing, must use open() More... | |
oMemoryMapped (const std::string &filename, size_t mappedBytes=WholeFile, CacheHint hint=Normal) | |
open file, mappedBytes = 0 maps the whole file More... | |
~oMemoryMapped () | |
close file (see close() ) More... | |
int | Open (const std::string &filename, size_t mappedBytes=WholeFile, CacheHint hint=Normal) |
open file, mappedBytes = 0 maps the whole file More... | |
void | Close () |
close file More... | |
unsigned char | operator[] (size_t offset) const |
access position, no range checking (faster) More... | |
unsigned char | at (size_t offset) const |
access position, including range checking More... | |
const unsigned char * | GetData () const |
raw access More... | |
bool | IsValid () const |
true, if file successfully opened More... | |
uint64_t | size () const |
get file size More... | |
size_t | mappedSize () const |
get number of actually mapped bytes More... | |
int | Remap (uint64_t offset, size_t mappedBytes) |
replace mapping by a new one of the same file, offset MUST be a multiple of the page size More... | |
Private Types | |
typedef int | FileHandle |
define handle More... | |
typedef int | FileHandle |
define handle More... | |
Private Member Functions | |
oMemoryMapped (const oMemoryMapped &) | |
don't copy object More... | |
oMemoryMapped & | operator= (const oMemoryMapped &) |
don't copy object More... | |
oMemoryMapped (const oMemoryMapped &) | |
don't copy object More... | |
oMemoryMapped & | operator= (const oMemoryMapped &) |
don't copy object More... | |
Static Private Member Functions | |
static int | GetPageSize () |
get OS page size (for remap) More... | |
static int | GetPageSize () |
get OS page size (for remap) More... | |
Private Attributes | |
std::string | _filename |
file name More... | |
uint64_t | _filesize |
file size More... | |
CacheHint | _hint |
caching strategy More... | |
size_t | _mappedBytes |
mapped size More... | |
FileHandle | _file |
file handle More... | |
void * | _mappedView |
pointer to the file contents mapped into memory More... | |
Portable read-only memory mapping (Windows and Linux)
Filesize limited by size_t, usually 2^32 or 2^64
Definition at line 29 of file code/include/datafile/oMemoryMapped.hh.
|
private |
define handle
Definition at line 101 of file code/include/datafile/oMemoryMapped.hh.
|
private |
define handle
Definition at line 101 of file include/datafile/oMemoryMapped.hh.
tweak performance
Definition at line 33 of file code/include/datafile/oMemoryMapped.hh.
tweak performance
Definition at line 33 of file include/datafile/oMemoryMapped.hh.
how much should be mappend
Enumerator | |
---|---|
WholeFile | everything ... be careful when file is larger than memory |
WholeFile | everything ... be careful when file is larger than memory |
Definition at line 41 of file include/datafile/oMemoryMapped.hh.
how much should be mappend
Enumerator | |
---|---|
WholeFile | everything ... be careful when file is larger than memory |
WholeFile | everything ... be careful when file is larger than memory |
Definition at line 41 of file code/include/datafile/oMemoryMapped.hh.
oMemoryMapped::oMemoryMapped | ( | ) |
do nothing, must use open()
Definition at line 47 of file code/src/datafile/oMemoryMapped.cc.
oMemoryMapped::oMemoryMapped | ( | const std::string & | filename, |
size_t | mappedBytes = WholeFile , |
||
CacheHint | hint = Normal |
||
) |
open file, mappedBytes = 0 maps the whole file
Definition at line 66 of file code/src/datafile/oMemoryMapped.cc.
oMemoryMapped::~oMemoryMapped | ( | ) |
close file (see close() )
Definition at line 86 of file code/src/datafile/oMemoryMapped.cc.
|
private |
don't copy object
oMemoryMapped::oMemoryMapped | ( | ) |
do nothing, must use open()
oMemoryMapped::oMemoryMapped | ( | const std::string & | filename, |
size_t | mappedBytes = WholeFile , |
||
CacheHint | hint = Normal |
||
) |
open file, mappedBytes = 0 maps the whole file
oMemoryMapped::~oMemoryMapped | ( | ) |
close file (see close() )
|
private |
don't copy object
unsigned char oMemoryMapped::at | ( | size_t | offset | ) | const |
access position, including range checking
Definition at line 258 of file code/src/datafile/oMemoryMapped.cc.
unsigned char oMemoryMapped::at | ( | size_t | offset | ) | const |
access position, including range checking
void oMemoryMapped::Close | ( | ) |
close file
Definition at line 206 of file code/src/datafile/oMemoryMapped.cc.
void oMemoryMapped::Close | ( | ) |
close file
const unsigned char* oMemoryMapped::GetData | ( | ) | const |
raw access
const unsigned char * oMemoryMapped::GetData | ( | ) | const |
raw access
Definition at line 275 of file code/src/datafile/oMemoryMapped.cc.
|
staticprivate |
get OS page size (for remap)
Definition at line 420 of file code/src/datafile/oMemoryMapped.cc.
|
staticprivate |
get OS page size (for remap)
bool oMemoryMapped::IsValid | ( | ) | const |
true, if file successfully opened
bool oMemoryMapped::IsValid | ( | ) | const |
true, if file successfully opened
Definition at line 286 of file code/src/datafile/oMemoryMapped.cc.
size_t oMemoryMapped::mappedSize | ( | ) | const |
get number of actually mapped bytes
Definition at line 308 of file code/src/datafile/oMemoryMapped.cc.
size_t oMemoryMapped::mappedSize | ( | ) | const |
get number of actually mapped bytes
int oMemoryMapped::Open | ( | const std::string & | filename, |
size_t | mappedBytes = WholeFile , |
||
CacheHint | hint = Normal |
||
) |
open file, mappedBytes = 0 maps the whole file
open file
Definition at line 97 of file code/src/datafile/oMemoryMapped.cc.
int oMemoryMapped::Open | ( | const std::string & | filename, |
size_t | mappedBytes = WholeFile , |
||
CacheHint | hint = Normal |
||
) |
open file, mappedBytes = 0 maps the whole file
|
private |
don't copy object
|
private |
don't copy object
unsigned char oMemoryMapped::operator[] | ( | size_t | offset | ) | const |
access position, no range checking (faster)
Definition at line 247 of file code/src/datafile/oMemoryMapped.cc.
unsigned char oMemoryMapped::operator[] | ( | size_t | offset | ) | const |
access position, no range checking (faster)
int oMemoryMapped::Remap | ( | uint64_t | offset, |
size_t | mappedBytes | ||
) |
replace mapping by a new one of the same file, offset MUST be a multiple of the page size
Definition at line 319 of file code/src/datafile/oMemoryMapped.cc.
int oMemoryMapped::Remap | ( | uint64_t | offset, |
size_t | mappedBytes | ||
) |
replace mapping by a new one of the same file, offset MUST be a multiple of the page size
uint64_t oMemoryMapped::size | ( | ) | const |
get file size
uint64_t oMemoryMapped::size | ( | ) | const |
get file size
Definition at line 297 of file code/src/datafile/oMemoryMapped.cc.
|
private |
file handle
Definition at line 105 of file code/include/datafile/oMemoryMapped.hh.
|
private |
file name
Definition at line 87 of file code/include/datafile/oMemoryMapped.hh.
|
private |
file size
Definition at line 89 of file code/include/datafile/oMemoryMapped.hh.
|
private |
caching strategy
Definition at line 91 of file code/include/datafile/oMemoryMapped.hh.
|
private |
mapped size
Definition at line 93 of file code/include/datafile/oMemoryMapped.hh.
|
private |
pointer to the file contents mapped into memory
Definition at line 107 of file code/include/datafile/oMemoryMapped.hh.