Storm
A Modern Probabilistic Model Checker
|
Opens a file and maps it to memory providing a char* containing the file content. More...
#include <MappedFile.h>
Public Member Functions | |
MappedFile (const char *filename) | |
Constructs a MappedFile. | |
~MappedFile () | |
Destructs a MappedFile. | |
char const * | getData () const |
Returns a pointer to the beginning of the mapped file data. | |
char const * | getDataEnd () const |
Returns a pointer to the end of the mapped file data. | |
std::size_t | getDataSize () const |
Returns the size of the mapped file data. | |
Opens a file and maps it to memory providing a char* containing the file content.
This class is a very simple interface to read files efficiently. The given file is opened and mapped to memory using mmap(). The public member data is a pointer to the actual file content. Using this method, the kernel will take care of all buffering. This is most probably much more efficient than doing this manually.
Definition at line 33 of file MappedFile.h.
storm::parser::MappedFile::MappedFile | ( | const char * | filename | ) |
Constructs a MappedFile.
This will stat the given file, open it and map it to memory. If anything of this fails, an appropriate exception is raised and a log entry is written.
filename | Path and name of the file to be opened. |
Definition at line 23 of file MappedFile.cpp.
storm::parser::MappedFile::~MappedFile | ( | ) |
Destructs a MappedFile.
This will unmap the data and close the file.
Definition at line 84 of file MappedFile.cpp.
char const * storm::parser::MappedFile::getData | ( | ) | const |
Returns a pointer to the beginning of the mapped file data.
Definition at line 94 of file MappedFile.cpp.
char const * storm::parser::MappedFile::getDataEnd | ( | ) | const |
Returns a pointer to the end of the mapped file data.
Definition at line 98 of file MappedFile.cpp.
std::size_t storm::parser::MappedFile::getDataSize | ( | ) | const |
Returns the size of the mapped file data.
Definition at line 102 of file MappedFile.cpp.