SHORE API
|
Memory mapped file handling. More...
Public Member Functions | |
mmapping (const std::string &fn=std::string()) | |
Constructor; if a file name is given, opens the file, but does not map() it. | |
mmapping (const mmapping &other) | |
Copy contructor; if the other file is open, opens it, if the other file is mapped, maps it and leaves it open if the other mapping's file is open; file size and offset and size of the mapped range are copied. | |
~mmapping () | |
Destructor; unmap and close file. | |
mmapping & | operator= (const mmapping &other) |
Assignment; see copy constructor. | |
void | open_file () |
Open the current file; only stat()s if the file size is not available previously. | |
void | open_file (const std::string &fn) |
Close the current file, open another one. | |
void | close_file () |
Close the current file (but do not unmap). | |
bool | has_file () const |
std::streamsize | get_filesize () const |
Get the size of the last opened file. | |
const std::string & | get_filename () const |
Get the name of the last opened file. | |
bool | is_file_open () const |
void | map (const std::streamoff ofs, const std::streamsize size=0) |
Map with a new offset and possibly size. | |
void | map () |
Map with the currently set offset and size. | |
void | unmap () |
Unmap. | |
bool | is_mapped () const |
Check if we're currently mapped. | |
const char * | begin () const |
Pointer to the start of the mapped range. More... | |
const char * | end () const |
Pointer to the end of the mapped range. More... | |
Memory mapped file handling.
Memory mapping that is designed to be copyable.
const char* shore::mmapping::begin | ( | ) | const |
Pointer to the start of the mapped range.
The range returned is exactly the one requested by map(), internal page alignment adjustments for mmap() are hidden.
const char* shore::mmapping::end | ( | ) | const |
Pointer to the end of the mapped range.
The range returned is exactly the one requested by map(), internal page alignment adjustments for mmap() are hidden.