ModErn Text Analysis
META Enumerates Textual Applications
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
meta::io::mmap_file Class Reference

Memory maps a text file readonly. More...

#include <mmap_file.h>

Classes

class  mmap_file_exception
 Basic exception for mmap_file interactions. More...
 

Public Member Functions

 mmap_file (const std::string &path)
 Constructor. More...
 
 mmap_file (mmap_file &&)
 Move constructor.
 
mmap_fileoperator= (mmap_file &&)
 Move assignment operator.
 
 ~mmap_file ()
 Destructor; deallocates memory used to store this object, closing the text file.
 
char operator[] (uint64_t index) const
 
uint64_t size () const
 
std::string path () const
 
char * begin () const
 

Private Member Functions

 mmap_file (const mmap_file &other)=delete
 No copying */.
 
const mmap_fileoperator= (const mmap_file &other)=delete
 no copying */
 

Private Attributes

std::string path_
 Filename of the text file.
 
char * start_
 Pointer to the beginning of the text file.
 
uint64_t size_
 Size of the current text file.
 
int file_descriptor_
 File descriptor for the open text file.
 

Detailed Description

Memory maps a text file readonly.

Constructor & Destructor Documentation

meta::io::mmap_file::mmap_file ( const std::string &  path)

Constructor.

Parameters
pathPath to the text file to open

Member Function Documentation

char meta::io::mmap_file::operator[] ( uint64_t  index) const
Parameters
indexThe byte in the memory-mapped file to access
Returns
the requested byte; an exception is thrown if the index is out of bounds of the mapped region
uint64_t meta::io::mmap_file::size ( ) const
Returns
the length of the file in bytes
std::string meta::io::mmap_file::path ( ) const
Returns
the title of the text file (the parameter given to the contructor)
char * meta::io::mmap_file::begin ( ) const
Returns
a pointer to the beginning of the file

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