Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
storm::parser::MappedFile Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MappedFile()

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.

Parameters
filenamePath and name of the file to be opened.

Definition at line 23 of file MappedFile.cpp.

◆ ~MappedFile()

storm::parser::MappedFile::~MappedFile ( )

Destructs a MappedFile.

This will unmap the data and close the file.

Definition at line 84 of file MappedFile.cpp.

Member Function Documentation

◆ getData()

char const * storm::parser::MappedFile::getData ( ) const

Returns a pointer to the beginning of the mapped file data.

Returns
A pointer to the first character of the mapped file data.

Definition at line 94 of file MappedFile.cpp.

◆ getDataEnd()

char const * storm::parser::MappedFile::getDataEnd ( ) const

Returns a pointer to the end of the mapped file data.

Returns
A pointer to the first position after the last character of the mapped file data.

Definition at line 98 of file MappedFile.cpp.

◆ getDataSize()

std::size_t storm::parser::MappedFile::getDataSize ( ) const

Returns the size of the mapped file data.

Definition at line 102 of file MappedFile.cpp.


The documentation for this class was generated from the following files: