35 #ifndef OMEMORYMAPPED_HH 36 #define OMEMORYMAPPED_HH 1 41 typedef unsigned __int64 uint64_t;
83 unsigned char at (
size_t offset)
const;
86 const unsigned char*
GetData()
const;
92 uint64_t
size()
const;
97 int Remap(uint64_t offset,
size_t mappedBytes);
118 #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 ...
void * _mappedView
pointer to the file contents mapped into memory
bool IsValid() const
true, if file successfully opened
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
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
uint64_t size() const
get file size
unsigned char at(size_t offset) const
access position, including range checking
static int GetPageSize()
get OS page size (for remap)
unsigned char operator[](size_t offset) const
access position, no range checking (faster)
~oMemoryMapped()
close file (see close() )
size_t _mappedBytes
mapped size
int FileHandle
define handle
Declaration of class sOutputManager.
std::string _filename
file name
const unsigned char * GetData() const
raw access
Portable read-only memory mapping (Windows and Linux)
FileHandle _file
file handle
CacheHint _hint
caching strategy
MapRange
how much should be mappend