CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
cond::SmallWORMDict Class Reference

#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 ()
 
 SmallWORMDict (std::vector< std::string > const &idict)
 
 ~SmallWORMDict ()
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

std::vector< char > m_data
 
std::vector< unsigned int > m_index
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 
struct IterHelp
 
int test::SmallWORMDict::test ()
 

Detailed Description

A small WORM Dictionary of small words optimized to do a single allocation

Definition at line 25 of file SmallWORMDict.h.

Member Typedef Documentation

typedef boost::transform_iterator<IterHelp, boost::counting_iterator<int> > cond::SmallWORMDict::const_iterator

Definition at line 64 of file SmallWORMDict.h.

Constructor & Destructor Documentation

cond::SmallWORMDict::SmallWORMDict ( )

Definition at line 9 of file SmallWORMDict.cc.

9 {}
cond::SmallWORMDict::~SmallWORMDict ( )

Definition at line 10 of file SmallWORMDict.cc.

10 {}
cond::SmallWORMDict::SmallWORMDict ( std::vector< std::string > const &  idict)
explicit

Definition at line 12 of file SmallWORMDict.cc.

References a, and b.

13  : m_data(std::accumulate(idict.begin(), idict.end(), 0, [](int a, std::string b) { return a + b.size(); })),
std::vector< char > m_data
Definition: SmallWORMDict.h:94
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119

Member Function Documentation

const_iterator cond::SmallWORMDict::begin ( void  ) const
inline

Definition at line 66 of file SmallWORMDict.h.

References IterHelp.

Referenced by find().

66  {
67  return boost::make_transform_iterator(boost::counting_iterator<int>(0), IterHelp(*this));
68  }
friend struct IterHelp
Definition: SmallWORMDict.h:62
const_iterator cond::SmallWORMDict::end ( void  ) const
inline

Definition at line 70 of file SmallWORMDict.h.

References IterHelp, and size().

Referenced by Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), and find().

70  {
71  return boost::make_transform_iterator(boost::counting_iterator<int>(size()), IterHelp(*this));
72  }
friend struct IterHelp
Definition: SmallWORMDict.h:62
size_t size() const
SmallWORMDict::const_iterator cond::SmallWORMDict::find ( std::string const &  s) const

Definition at line 41 of file SmallWORMDict.cc.

References begin(), end(), and cuda_std::lower_bound().

Referenced by BeautifulSoup.Tag::__getattr__(), BeautifulSoup.Tag::firstText(), and index().

41  {
42  Frame sp(&s[0], s.size(), 0);
43  return std::lower_bound(begin(), end(), sp, LessFrame());
44  }
const_iterator end() const
Definition: SmallWORMDict.h:70
SOAFrame< float > Frame
const_iterator begin() const
Definition: SmallWORMDict.h:66
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
SmallWORMDict::const_iterator cond::SmallWORMDict::find ( char const *  s) const

Definition at line 46 of file SmallWORMDict.cc.

References begin(), end(), and cuda_std::lower_bound().

Referenced by BeautifulSoup.Tag::__getattr__(), and BeautifulSoup.Tag::firstText().

46  {
47  Frame sp(s, ::strlen(s), 0);
48  return std::lower_bound(begin(), end(), sp, LessFrame());
49  }
const_iterator end() const
Definition: SmallWORMDict.h:70
SOAFrame< float > Frame
const_iterator begin() const
Definition: SmallWORMDict.h:66
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
size_t cond::SmallWORMDict::index ( std::string const &  s) const

Definition at line 37 of file SmallWORMDict.cc.

References find().

Referenced by BeautifulSoup.PageElement::_invert().

37 { return (*find(s)).ind; }
const_iterator find(std::string const &s) const
size_t cond::SmallWORMDict::index ( char const *  s) const

Definition at line 39 of file SmallWORMDict.cc.

References find().

Referenced by BeautifulSoup.PageElement::_invert().

39 { return (*find(s)).ind; }
const_iterator find(std::string const &s) const
Frame cond::SmallWORMDict::operator[] ( int  i) const
inline

Definition at line 74 of file SmallWORMDict.h.

References mps_fire::i, isotrackApplyRegressor::k, m_data, and m_index.

74  {
75  int k = (0 == i) ? 0 : m_index[i - 1];
76  return Frame(&m_data[k], m_index[i] - k, i);
77  }
SOAFrame< float > Frame
std::vector< unsigned int > m_index
Definition: SmallWORMDict.h:95
std::vector< char > m_data
Definition: SmallWORMDict.h:94
template<class Archive >
void cond::SmallWORMDict::serialize ( Archive &  ar,
const unsigned int  version 
)
private
size_t cond::SmallWORMDict::size ( void  ) const

Definition at line 51 of file SmallWORMDict.cc.

References m_index.

Referenced by ntupleDataFormat._Collection::__iter__(), ntupleDataFormat._Collection::__len__(), and end().

51 { return m_index.size(); }
std::vector< unsigned int > m_index
Definition: SmallWORMDict.h:95

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 97 of file SmallWORMDict.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 97 of file SmallWORMDict.h.

friend struct IterHelp
friend

Definition at line 62 of file SmallWORMDict.h.

Referenced by begin(), and end().

int test::SmallWORMDict::test ( )
friend

Member Data Documentation

std::vector<char> cond::SmallWORMDict::m_data
private

Definition at line 94 of file SmallWORMDict.h.

Referenced by cond::SmallWORMDict::IterHelp::operator()(), and operator[]().

std::vector<unsigned int> cond::SmallWORMDict::m_index
private

Definition at line 95 of file SmallWORMDict.h.

Referenced by cond::SmallWORMDict::IterHelp::operator()(), operator[](), and size().