ddc
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
ddcMapFile< KeyT, ValT > Class Template Reference

#include <ddcMMap.h>

Inheritance diagram for ddcMapFile< KeyT, ValT >:
Inheritance graph
[legend]
Collaboration diagram for ddcMapFile< KeyT, ValT >:
Collaboration graph
[legend]

Classes

struct  KeyLess
 

Public Types

typedef ddcRecFile RecFileT
 
typedef vector< ValT > VecT
 
typedef map< KeyT, VecTMapT
 
typedef KeyT key_type
 
typedef VecT mapped_type
 
typedef pair< KeyT, VecTvalue_type
 
typedef RecFileT::iterator iterator
 
typedef RecFileT::const_iterator const_iterator
 

Public Member Functions

 ddcMapFile ()
 
 ddcMapFile (const std::string &filename, size_t vsize_, bool useMMap=false)
 construct and open More...
 
 ~ddcMapFile ()
 default destructor calls close() More...
 
void clear ()
 clear() method wraps close() More...
 
size_t recsize () const
 returns the number of bytes per record More...
 
size_t vecsize () const
 returns the number of elements per value-vector More...
 
size_t size () const
 returns the number of records in this object More...
 
bool empty () const
 STL-esque wrapper. More...
 
bool opened () const
 returns true iff object is opened (or non-empty) More...
 
 operator bool () const
 implicit typecast to bool More...
 
VecToperator[] (const KeyT &key)
 indexing operator auto-demotes to slurp-mode More...
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
template<typename IterT >
const KeyT & key (const IterT &it) const
 
template<typename IterT >
const ValT * val (const IterT &it) const
 
const ValT * find (const KeyT &key_) const
 simulate std::map::find(), returns NULL on error More...
 
ddcMapFileopen (const std::string &filename, size_t vsize, bool useMMap=false)
 
void close ()
 
void ensureMap ()
 force map-implementation More...
 

Public Attributes

RecFileT m_rfile
 data (read-only: mmap or slurp) More...
 
MapT m_map
 data (read/write: demoted) More...
 
size_t m_vsize
 number of elements per value-vector (constant) More...
 

Detailed Description

template<typename KeyT, typename ValT>
class ddcMapFile< KeyT, ValT >

simulate map<KeyT,ValT> using mmap, slurp, or demote. records should be stored as {KeyT,ValT[]} and sorted in ascending order by key

Member Typedef Documentation

◆ RecFileT

template<typename KeyT, typename ValT>
typedef ddcRecFile ddcMapFile< KeyT, ValT >::RecFileT

◆ VecT

template<typename KeyT, typename ValT>
typedef vector<ValT> ddcMapFile< KeyT, ValT >::VecT

◆ MapT

template<typename KeyT, typename ValT>
typedef map<KeyT, VecT> ddcMapFile< KeyT, ValT >::MapT

◆ key_type

template<typename KeyT, typename ValT>
typedef KeyT ddcMapFile< KeyT, ValT >::key_type

◆ mapped_type

template<typename KeyT, typename ValT>
typedef VecT ddcMapFile< KeyT, ValT >::mapped_type

◆ value_type

template<typename KeyT, typename ValT>
typedef pair<KeyT, VecT> ddcMapFile< KeyT, ValT >::value_type

◆ iterator

template<typename KeyT, typename ValT>
typedef RecFileT::iterator ddcMapFile< KeyT, ValT >::iterator

◆ const_iterator

template<typename KeyT, typename ValT>
typedef RecFileT::const_iterator ddcMapFile< KeyT, ValT >::const_iterator

Constructor & Destructor Documentation

◆ ddcMapFile() [1/2]

template<typename KeyT, typename ValT>
ddcMapFile< KeyT, ValT >::ddcMapFile ( )
inline

◆ ddcMapFile() [2/2]

template<typename KeyT, typename ValT>
ddcMapFile< KeyT, ValT >::ddcMapFile ( const std::string &  filename,
size_t  vsize_,
bool  useMMap = false 
)
inline

construct and open

◆ ~ddcMapFile()

template<typename KeyT, typename ValT>
ddcMapFile< KeyT, ValT >::~ddcMapFile ( )
inline

default destructor calls close()

Member Function Documentation

◆ clear()

template<typename KeyT, typename ValT>
void ddcMapFile< KeyT, ValT >::clear ( )
inline

clear() method wraps close()

Referenced by CStringIndexSet::ConvertLoadIndexToWorkingIndex(), and CIndexSetForQueryingStage::DestroyIndexSet().

Here is the caller graph for this function:

◆ recsize()

template<typename KeyT, typename ValT>
size_t ddcMapFile< KeyT, ValT >::recsize ( ) const
inline

returns the number of bytes per record

◆ vecsize()

template<typename KeyT, typename ValT>
size_t ddcMapFile< KeyT, ValT >::vecsize ( ) const
inline

returns the number of elements per value-vector

◆ size()

template<typename KeyT, typename ValT>
size_t ddcMapFile< KeyT, ValT >::size ( ) const
inline

returns the number of records in this object

◆ empty()

template<typename KeyT, typename ValT>
bool ddcMapFile< KeyT, ValT >::empty ( void  ) const
inline

STL-esque wrapper.

◆ opened()

template<typename KeyT, typename ValT>
bool ddcMapFile< KeyT, ValT >::opened ( ) const
inline

returns true iff object is opened (or non-empty)

◆ operator bool()

template<typename KeyT, typename ValT>
ddcMapFile< KeyT, ValT >::operator bool ( ) const
inline

implicit typecast to bool

◆ operator[]()

template<typename KeyT, typename ValT>
VecT& ddcMapFile< KeyT, ValT >::operator[] ( const KeyT &  key)
inline

indexing operator auto-demotes to slurp-mode

◆ begin() [1/2]

template<typename KeyT, typename ValT>
iterator ddcMapFile< KeyT, ValT >::begin ( )
inline

Referenced by CIndexSetForQueryingStage::AddOccurs().

Here is the caller graph for this function:

◆ end() [1/2]

template<typename KeyT, typename ValT>
iterator ddcMapFile< KeyT, ValT >::end ( )
inline

Referenced by CIndexSetForQueryingStage::AddOccurs().

Here is the caller graph for this function:

◆ begin() [2/2]

template<typename KeyT, typename ValT>
const_iterator ddcMapFile< KeyT, ValT >::begin ( ) const
inline

◆ end() [2/2]

template<typename KeyT, typename ValT>
const_iterator ddcMapFile< KeyT, ValT >::end ( ) const
inline

◆ key()

template<typename KeyT, typename ValT>
template<typename IterT >
const KeyT& ddcMapFile< KeyT, ValT >::key ( const IterT &  it) const
inline

Referenced by CIndexSetForQueryingStage::AddOccurs().

Here is the caller graph for this function:

◆ val()

template<typename KeyT, typename ValT>
template<typename IterT >
const ValT* ddcMapFile< KeyT, ValT >::val ( const IterT &  it) const
inline

◆ find()

template<typename KeyT, typename ValT>
const ValT* ddcMapFile< KeyT, ValT >::find ( const KeyT &  key_) const
inline

simulate std::map::find(), returns NULL on error

Referenced by CIndexSetForQueryingStage::AddOccurs().

Here is the caller graph for this function:

◆ open()

template<typename KeyT, typename ValT>
ddcMapFile& ddcMapFile< KeyT, ValT >::open ( const std::string &  filename,
size_t  vsize,
bool  useMMap = false 
)
inline

Referenced by CIndexSetForQueryingStage::LoadPeriodDivision().

Here is the caller graph for this function:

◆ close()

template<typename KeyT, typename ValT>
void ddcMapFile< KeyT, ValT >::close ( void  )
inline

◆ ensureMap()

template<typename KeyT, typename ValT>
void ddcMapFile< KeyT, ValT >::ensureMap ( )
inline

force map-implementation

Referenced by CIndexSetForQueryingStage::BuildPeriodsDivisionAndCompress(), and CIndexSetForQueryingStage::WritePeriodsDivision().

Here is the caller graph for this function:

Member Data Documentation

◆ m_rfile

template<typename KeyT, typename ValT>
RecFileT ddcMapFile< KeyT, ValT >::m_rfile

data (read-only: mmap or slurp)

◆ m_map

template<typename KeyT, typename ValT>
MapT ddcMapFile< KeyT, ValT >::m_map

◆ m_vsize

template<typename KeyT, typename ValT>
size_t ddcMapFile< KeyT, ValT >::m_vsize

number of elements per value-vector (constant)


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