MeteoIODoc 20241222.207bde49
mio::FileUtils::FileIndexer Class Reference

#include <FileUtils.h>

Public Member Functions

 FileIndexer ()
 
void setIndex (const Date &i_date, const std::streampos &i_pos, const size_t &linenr=static_cast< size_t >(-1))
 Add a new position to the index. More...
 
void setIndex (const std::string &i_date, const std::streampos &i_pos, const size_t &linenr=static_cast< size_t >(-1))
 
void setIndex (const double &i_date, const std::streampos &i_pos, const size_t &linenr=static_cast< size_t >(-1))
 
std::streampos getIndex (const Date &i_date) const
 Get the file position suitable for a given date. More...
 
std::streampos getIndex (const std::string &i_date) const
 
std::streampos getIndex (const double &i_date) const
 
std::streampos getIndex (const Date &i_date, size_t &o_linenr) const
 Get the file position suitable for a given date. More...
 
std::streampos getIndex (const std::string &i_date, size_t &o_linenr) const
 
std::streampos getIndex (const double &i_date, size_t &o_linenr) const
 
const std::string toString () const
 

Constructor & Destructor Documentation

◆ FileIndexer()

mio::FileUtils::FileIndexer::FileIndexer ( )
inline

Member Function Documentation

◆ getIndex() [1/6]

std::streampos mio::FileUtils::FileIndexer::getIndex ( const Date i_date) const

Get the file position suitable for a given date.

Parameters
[in]i_datedate for which a position is requested
Returns
closest streampos position before the requested date, -1 if nothing could be found (empty index)

◆ getIndex() [2/6]

std::streampos mio::FileUtils::FileIndexer::getIndex ( const Date i_date,
size_t &  o_linenr 
) const

Get the file position suitable for a given date.

Parameters
[in]i_datedate for which a position is requested
[out]o_linenrthe original line number if the position has been found (otherwise, it remains unchanged)
Returns
closest streampos position before the requested date, -1 if nothing could be found (empty index)

◆ getIndex() [3/6]

std::streampos mio::FileUtils::FileIndexer::getIndex ( const double &  i_date) const

◆ getIndex() [4/6]

std::streampos mio::FileUtils::FileIndexer::getIndex ( const double &  i_date,
size_t &  o_linenr 
) const

◆ getIndex() [5/6]

std::streampos mio::FileUtils::FileIndexer::getIndex ( const std::string &  i_date) const

◆ getIndex() [6/6]

std::streampos mio::FileUtils::FileIndexer::getIndex ( const std::string &  i_date,
size_t &  o_linenr 
) const

◆ setIndex() [1/3]

void mio::FileUtils::FileIndexer::setIndex ( const Date i_date,
const std::streampos &  i_pos,
const size_t &  linenr = static_cast<size_t>(-1) 
)

Add a new position to the index.

Parameters
[in]i_datedate of the new position
[in]i_posstreampos position
[in]linenrline number in the input file

◆ setIndex() [2/3]

void mio::FileUtils::FileIndexer::setIndex ( const double &  i_date,
const std::streampos &  i_pos,
const size_t &  linenr = static_cast<size_t>(-1) 
)

◆ setIndex() [3/3]

void mio::FileUtils::FileIndexer::setIndex ( const std::string &  i_date,
const std::streampos &  i_pos,
const size_t &  linenr = static_cast<size_t>(-1) 
)

◆ toString()

const std::string mio::FileUtils::FileIndexer::toString ( ) const

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