libept  0.5.25
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ept::debtags::Vocabulary Class Reference

#include <vocabulary.h>

Collaboration diagram for ept::debtags::Vocabulary:
Collaboration graph
[legend]

Classes

class  FacetIndex
 
class  TagIndex
 

Public Member Functions

 Vocabulary ()
 
 ~Vocabulary ()
 
time_t timestamp () const
 Get the timestamp of when the index was last updated. More...
 
bool hasData () const
 Return true if this data source has data, false if it's empty. More...
 
const FacetIndexfacetIndex () const
 
const TagIndextagIndex () const
 
bool hasFacet (const std::string &name) const
 Check if the vocabulary contains the facet `name'. More...
 
bool hasTag (const std::string &fullname) const
 Check if the vocabulary contains the tag `fullname'. More...
 
Facet facetByID (int id) const
 Return the facet with the given name. More...
 
Tag tagByID (int id) const
 Return the tag with the given full name. More...
 
template<typename IDS >
std::set< TagtagsByID (const IDS &ids) const
 
Facet facetByTag (int id) const
 Return the facet for the tag with the given ID. More...
 
Facet facetByName (const std::string &name) const
 Return the facet with the given name. More...
 
Tag tagByName (const std::string &fullname) const
 Return the tag with the given full name. More...
 
std::set< Facetfacets () const
 Return all the facets in the vocabulary. More...
 
std::set< Tagtags () const
 Return all the tags in the vocabulary. More...
 
std::set< Tagtags (int facet) const
 Return the tags in the given facet. More...
 
std::set< Tagtags (const std::string &facetName) const
 
std::set< Tagtags (const Facet &facet) const
 
std::string facetName (int id) const
 Get the facet name given the facet id. More...
 
std::string tagName (int id) const
 Get the tag name given the tag id. More...
 
std::string tagShortName (int id) const
 Get the tag name given the tag id. More...
 
const std::map< std::string, std::string > & facetData (int id) const
 
const std::map< std::string, std::string > & tagData (int id) const
 

Protected Member Functions

void parseVocBuf (std::map< std::string, std::string > &res, size_t ofs, size_t len) const
 

Protected Attributes

tagcoll::diskindex::MasterMMap mastermmap
 
time_t m_timestamp
 
std::string voc_fname
 
int voc_fd
 
size_t voc_size
 
const char * voc_buf
 
FacetIndex findex
 
TagIndex tindex
 
std::vector< std::map< std::string, std::string > > m_facetData
 
std::vector< std::map< std::string, std::string > > m_tagData
 
std::map< std::string, std::string > emptyData
 

Constructor & Destructor Documentation

ept::debtags::Vocabulary::Vocabulary ( )
ept::debtags::Vocabulary::~Vocabulary ( )

References voc_buf, voc_fd, and voc_size.

Member Function Documentation

Facet ept::debtags::Vocabulary::facetByID ( int  id) const

Return the facet with the given name.

Referenced by facetByName(), facetByTag(), and hasTag().

Facet ept::debtags::Vocabulary::facetByName ( const std::string &  name) const
inline

Return the facet with the given name.

References facetByID(), and ept::debtags::Vocabulary::FacetIndex::id().

Facet ept::debtags::Vocabulary::facetByTag ( int  id) const
inline

Return the facet for the tag with the given ID.

References ept::debtags::Vocabulary::TagIndex::facet(), and facetByID().

Referenced by ept::debtags::Tag::facet().

const std::map< std::string, std::string > & ept::debtags::Vocabulary::facetData ( int  id) const
const FacetIndex& ept::debtags::Vocabulary::facetIndex ( ) const
inline

References findex.

std::string ept::debtags::Vocabulary::facetName ( int  id) const
inline

Get the facet name given the facet id.

References ept::debtags::Vocabulary::FacetIndex::name().

Referenced by ept::debtags::Facet::name().

std::set< Facet > ept::debtags::Vocabulary::facets ( ) const
inline

Return all the facets in the vocabulary.

References ept::debtags::Vocabulary::FacetIndex::size().

Referenced by TestVocabulary::_21(), and tags().

bool ept::debtags::Vocabulary::hasData ( ) const
inline

Return true if this data source has data, false if it's empty.

Referenced by TestVocabulary::_21().

bool ept::debtags::Vocabulary::hasFacet ( const std::string &  name) const
inline

Check if the vocabulary contains the facet `name'.

References ept::debtags::Vocabulary::FacetIndex::id().

bool ept::debtags::Vocabulary::hasTag ( const std::string &  fullname) const
inline

Check if the vocabulary contains the tag `fullname'.

References facetByID(), ept::debtags::Vocabulary::TagIndex::id(), and tagByID().

Referenced by ept::debtags::Facet::hasTag().

void ept::debtags::Vocabulary::parseVocBuf ( std::map< std::string, std::string > &  res,
size_t  ofs,
size_t  len 
) const
protected

References voc_buf, and voc_fname.

Referenced by facetData(), and tagData().

Tag ept::debtags::Vocabulary::tagByID ( int  id) const
Tag ept::debtags::Vocabulary::tagByName ( const std::string &  fullname) const
inline
const std::map< std::string, std::string > & ept::debtags::Vocabulary::tagData ( int  id) const
const TagIndex& ept::debtags::Vocabulary::tagIndex ( ) const
inline

References tindex.

std::string ept::debtags::Vocabulary::tagName ( int  id) const
inline

Get the tag name given the tag id.

References facetData(), ept::debtags::Vocabulary::TagIndex::name(), tagData(), and tagShortName().

Referenced by ept::debtags::Tag::fullname().

std::set< Tag > ept::debtags::Vocabulary::tags ( ) const
inline

Return all the tags in the vocabulary.

References ept::debtags::Vocabulary::TagIndex::size().

Referenced by TestVocabulary::_21(), ept::debtags::Facet::tags(), and tags().

std::set< Tag > ept::debtags::Vocabulary::tags ( int  facet) const
inline
std::set< Tag > ept::debtags::Vocabulary::tags ( const std::string &  facetName) const
inline
std::set< Tag > ept::debtags::Vocabulary::tags ( const Facet facet) const
inline
template<typename IDS >
std::set<Tag> ept::debtags::Vocabulary::tagsByID ( const IDS &  ids) const
inline
std::string ept::debtags::Vocabulary::tagShortName ( int  id) const

Get the tag name given the tag id.

References ept::debtags::Vocabulary::TagIndex::name(), and tindex.

Referenced by ept::debtags::Tag::name(), and tagName().

time_t ept::debtags::Vocabulary::timestamp ( ) const
inline

Get the timestamp of when the index was last updated.

References m_timestamp.

Member Data Documentation

std::map<std::string, std::string> ept::debtags::Vocabulary::emptyData
protected

Referenced by facetData(), and tagData().

FacetIndex ept::debtags::Vocabulary::findex
protected

Referenced by facetData(), facetIndex(), and Vocabulary().

std::vector< std::map<std::string, std::string> > ept::debtags::Vocabulary::m_facetData
mutableprotected

Referenced by facetData().

std::vector< std::map<std::string, std::string> > ept::debtags::Vocabulary::m_tagData
mutableprotected

Referenced by tagData().

time_t ept::debtags::Vocabulary::m_timestamp
protected

Referenced by timestamp(), and Vocabulary().

tagcoll::diskindex::MasterMMap ept::debtags::Vocabulary::mastermmap
protected

Referenced by Vocabulary().

TagIndex ept::debtags::Vocabulary::tindex
protected
const char* ept::debtags::Vocabulary::voc_buf
protected
int ept::debtags::Vocabulary::voc_fd
protected

Referenced by Vocabulary(), and ~Vocabulary().

std::string ept::debtags::Vocabulary::voc_fname
protected

Referenced by parseVocBuf(), and Vocabulary().

size_t ept::debtags::Vocabulary::voc_size
protected

Referenced by Vocabulary(), and ~Vocabulary().


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