36 #ifndef OMEMORYMAPPED_HH
37 #define OMEMORYMAPPED_HH 1
42 typedef unsigned __int64 uint64_t;
84 unsigned char at (
size_t offset)
const;
87 const unsigned char*
GetData()
const;
93 uint64_t
size()
const;
98 int Remap(uint64_t offset,
size_t mappedBytes);
119 #if defined(_WIN32) || defined(CASTOR_USE_MINGW)
This header file is mainly used to declare some macro definitions and all includes needed from the st...
oMemoryMapped & operator=(const oMemoryMapped &)
don't copy object
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 ...
bool IsValid() const
true, if file successfully opened
unsigned char at(size_t offset) const
access position, including range checking
void * _mappedView
pointer to the file contents mapped into memory
int Open(const std::string &filename, size_t mappedBytes=WholeFile, CacheHint hint=Normal)
open file, mappedBytes = 0 maps the whole file
oMemoryMapped()
do nothing, must use open()
CacheHint
tweak performance
unsigned char operator[](size_t offset) const
access position, no range checking (faster)
everything ... be careful when file is larger than memory
read file only once with few seeks
uint64_t _filesize
file size
size_t mappedSize() const
get number of actually mapped bytes
const unsigned char * GetData() const
raw access
static int GetPageSize()
get OS page size (for remap)
~oMemoryMapped()
close file (see close() )
size_t _mappedBytes
mapped size
uint64_t size() const
get file size
int FileHandle
define handle
Declaration of class sOutputManager.
std::string _filename
file name
Portable read-only memory mapping (Windows and Linux)
FileHandle _file
file handle
CacheHint _hint
caching strategy
MapRange
how much should be mappend