#include <SmallWORMDict.h>
Classes | |
struct | Frame |
struct | IterHelp |
Public Types | |
typedef boost::transform_iterator < IterHelp, boost::counting_iterator< int > > | const_iterator |
Public Member Functions | |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | find (std::string const &s) const |
const_iterator | find (char const *s) const |
size_t | index (std::string const &s) const |
size_t | index (char const *s) const |
Frame | operator[] (int i) const |
size_t | size () const |
SmallWORMDict (std::vector< std::string > const &idict) | |
SmallWORMDict () | |
~SmallWORMDict () | |
Private Attributes | |
std::vector< char > | m_data |
std::vector< unsigned int > | m_index |
Friends | |
struct | IterHelp |
A small WORM Dictionary of small words optimized to do a single allocation
Definition at line 21 of file SmallWORMDict.h.
typedef boost::transform_iterator<IterHelp,boost::counting_iterator<int> > cond::SmallWORMDict::const_iterator |
Definition at line 61 of file SmallWORMDict.h.
cond::SmallWORMDict::SmallWORMDict | ( | ) |
Definition at line 6 of file SmallWORMDict.cc.
{}
cond::SmallWORMDict::~SmallWORMDict | ( | ) |
Definition at line 7 of file SmallWORMDict.cc.
{}
cond::SmallWORMDict::SmallWORMDict | ( | std::vector< std::string > const & | idict | ) | [explicit] |
Definition at line 9 of file SmallWORMDict.cc.
References begin(), filterCSVwithJSON::copy, end(), i, j, m_data, m_index, cmsCodeRules::cppFunctionSkipper::operator, AlCaHLTBitMon_ParallelJobs::p, MultipleCompare::ref, and python::multivaluedict::sort().
: m_data(std::accumulate(idict.begin(),idict.end(),0, boost::bind(std::plus<int>(),_1,boost::bind(&std::string::size,_2)))), m_index(idict.size(),1) { // sort (use index) m_index[0]=0; std::partial_sum(m_index.begin(),m_index.end(),m_index.begin()); std::sort(m_index.begin(),m_index.end(), boost::bind(std::less<std::string>(), boost::bind<const std::string&>(&std::vector<std::string>::operator[],boost::ref(idict),_1), boost::bind<const std::string&>(&std::vector<std::string>::operator[],boost::ref(idict),_2) ) ); //copy std::vector<char>::iterator p= m_data.begin(); for (size_t j=0; j<m_index.size(); j++) { size_t i = m_index[j]; p=std::copy(idict[i].begin(),idict[i].end(),p); m_index[j]=p-m_data.begin(); } }
const_iterator cond::SmallWORMDict::begin | ( | void | ) | const [inline] |
Definition at line 64 of file SmallWORMDict.h.
References IterHelp.
Referenced by find(), and SmallWORMDict().
{ return boost::make_transform_iterator(boost::counting_iterator<int>(0), IterHelp(*this)); }
const_iterator cond::SmallWORMDict::end | ( | void | ) | const [inline] |
Definition at line 69 of file SmallWORMDict.h.
References IterHelp, and size().
Referenced by find(), and SmallWORMDict().
SmallWORMDict::const_iterator cond::SmallWORMDict::find | ( | std::string const & | s | ) | const |
SmallWORMDict::const_iterator cond::SmallWORMDict::find | ( | char const * | s | ) | const |
size_t cond::SmallWORMDict::index | ( | char const * | s | ) | const |
size_t cond::SmallWORMDict::index | ( | std::string const & | s | ) | const |
Frame cond::SmallWORMDict::operator[] | ( | int | i | ) | const [inline] |
size_t cond::SmallWORMDict::size | ( | void | ) | const |
Definition at line 62 of file SmallWORMDict.cc.
References m_index.
Referenced by end().
{ return m_index.size(); }
friend struct IterHelp [friend] |
Definition at line 59 of file SmallWORMDict.h.
std::vector<char> cond::SmallWORMDict::m_data [private] |
Definition at line 94 of file SmallWORMDict.h.
Referenced by cond::SmallWORMDict::IterHelp::operator()(), operator[](), and SmallWORMDict().
std::vector<unsigned int> cond::SmallWORMDict::m_index [private] |
Definition at line 95 of file SmallWORMDict.h.
Referenced by cond::SmallWORMDict::IterHelp::operator()(), operator[](), size(), and SmallWORMDict().