All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
Public Member Functions | List of all members
paal::data_structures::mapped_file Class Reference

data structure that gets new lines for many threads More...

#include <mapped_file.hpp>

Public Member Functions

 mapped_file (char const *file, size_t file_size, unsigned chunk_index, unsigned chunk_cnt)
 Initializes mmaped file with the specific chunk - so that every thread could use different part of the file. More...
 
 mapped_file (char const *file, size_t file_size)
 Initializes mmaped file. More...
 
std::string get_line ()
 Gets line from the m_current file. Eof and End Of Chunk aren't checked here. More...
 
bool eof () const
 is m_currently at the end of file
 
bool end_of_chunk () const
 is m_currently at the end of requested part of the file
 
template<typename Functor >
void for_each_line (Functor f)
 Computes functor on every line of the file. It takes care of the chunks and end of file. More...
 

Detailed Description

data structure that gets new lines for many threads

Definition at line 43 of file mapped_file.hpp.

Constructor & Destructor Documentation

paal::data_structures::mapped_file::mapped_file ( char const *  file,
size_t  file_size,
unsigned  chunk_index,
unsigned  chunk_cnt 
)
inline

Initializes mmaped file with the specific chunk - so that every thread could use different part of the file.

Parameters
filemmap file pointer
file_sizesize of the mmaped file
chunk_indexm_current chunk index
chunk_cntnumber of the chunks (usually equal the number of the threads)

Definition at line 62 of file mapped_file.hpp.

paal::data_structures::mapped_file::mapped_file ( char const *  file,
size_t  file_size 
)
inline

Initializes mmaped file.

Parameters
file- mmap file pointer
file_size- size of the mmaped file

Definition at line 79 of file mapped_file.hpp.

Member Function Documentation

template<typename Functor >
void paal::data_structures::mapped_file::for_each_line ( Functor  f)
inline

Computes functor on every line of the file. It takes care of the chunks and end of file.

Template Parameters
Functor
Parameters
f- Functor that should be computed

Definition at line 121 of file mapped_file.hpp.

std::string paal::data_structures::mapped_file::get_line ( )
inline

Gets line from the m_current file. Eof and End Of Chunk aren't checked here.

Returns
copied line

Definition at line 91 of file mapped_file.hpp.


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