CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Attributes | Friends
edm::MapOfVectors< K, T > Class Template Reference

#include <MapOfVectors.h>

Classes

class  Iter
 

Public Types

typedef Iter const_iterator
 
typedef std::vector< TData
 
typedef Data::const_iterator data_iterator
 
typedef Keys::const_iterator key_iterator
 
typedef std::vector< K > Keys
 
typedef Offsets::const_iterator offset_iterator
 
typedef std::vector< size_typeOffsets
 
typedef std::pair< K, rangePair
 
typedef boost::iterator_range< data_iteratorrange
 
typedef MapOfVectors< K, Tself
 
typedef unsigned int size_type
 
typedef std::map< K, std::vector< T > > TheMap
 

Public Member Functions

const_iterator begin () const
 The iterator returned can not safely be used across threads. More...
 
bool empty () const
 
range emptyRange () const
 
const_iterator end () const
 
range find (K const &k) const
 
key_iterator findKey (K const &k) const
 
void loadNext (K const &k, std::vector< T > const &v)
 
 MapOfVectors ()
 
 MapOfVectors (TheMap const &it)
 
size_type offset (K const &k) const
 
MapOfVectorsoperator= (MapOfVectors const &rhs)
 
size_type size () const
 
void swap (MapOfVectors &other)
 

Private Attributes

std::vector< Tm_data
 
std::vector< K > m_keys
 
std::vector< size_typem_offsets
 

Friends

class ::TestMapOfVectors
 

Detailed Description

template<typename K, typename T>
class edm::MapOfVectors< K, T >

Definition at line 19 of file MapOfVectors.h.

Member Typedef Documentation

◆ const_iterator

template<typename K, typename T>
typedef Iter edm::MapOfVectors< K, T >::const_iterator

Definition at line 69 of file MapOfVectors.h.

◆ Data

template<typename K, typename T>
typedef std::vector<T> edm::MapOfVectors< K, T >::Data

Definition at line 28 of file MapOfVectors.h.

◆ data_iterator

template<typename K, typename T>
typedef Data::const_iterator edm::MapOfVectors< K, T >::data_iterator

Definition at line 32 of file MapOfVectors.h.

◆ key_iterator

template<typename K, typename T>
typedef Keys::const_iterator edm::MapOfVectors< K, T >::key_iterator

Definition at line 30 of file MapOfVectors.h.

◆ Keys

template<typename K, typename T>
typedef std::vector<K> edm::MapOfVectors< K, T >::Keys

Definition at line 26 of file MapOfVectors.h.

◆ offset_iterator

template<typename K, typename T>
typedef Offsets::const_iterator edm::MapOfVectors< K, T >::offset_iterator

Definition at line 31 of file MapOfVectors.h.

◆ Offsets

template<typename K, typename T>
typedef std::vector<size_type> edm::MapOfVectors< K, T >::Offsets

Definition at line 27 of file MapOfVectors.h.

◆ Pair

template<typename K, typename T>
typedef std::pair<K, range> edm::MapOfVectors< K, T >::Pair

Definition at line 36 of file MapOfVectors.h.

◆ range

template<typename K, typename T>
typedef boost::iterator_range<data_iterator> edm::MapOfVectors< K, T >::range

Definition at line 34 of file MapOfVectors.h.

◆ self

template<typename K, typename T>
typedef MapOfVectors<K, T> edm::MapOfVectors< K, T >::self

Definition at line 21 of file MapOfVectors.h.

◆ size_type

template<typename K, typename T>
typedef unsigned int edm::MapOfVectors< K, T >::size_type

Definition at line 24 of file MapOfVectors.h.

◆ TheMap

template<typename K, typename T>
typedef std::map<K, std::vector<T> > edm::MapOfVectors< K, T >::TheMap

Definition at line 22 of file MapOfVectors.h.

Constructor & Destructor Documentation

◆ MapOfVectors() [1/2]

template<typename K, typename T>
edm::MapOfVectors< K, T >::MapOfVectors ( )
inline

Definition at line 73 of file MapOfVectors.h.

73 : m_offsets(1, 0) {}

◆ MapOfVectors() [2/2]

template<typename K, typename T>
edm::MapOfVectors< K, T >::MapOfVectors ( TheMap const &  it)
inline

Definition at line 75 of file MapOfVectors.h.

75  {
76  m_keys.reserve(it.size());
77  m_offsets.reserve(it.size() + 1);
78  m_offsets.push_back(0);
79  size_type tot = 0;
80  for (typename TheMap::const_iterator p = it.begin(); p != it.end(); ++p)
81  tot += (*p).second.size();
82  m_data.reserve(tot);
83  for (typename TheMap::const_iterator p = it.begin(); p != it.end(); ++p)
84  loadNext((*p).first, (*p).second);
85  }

Member Function Documentation

◆ begin()

template<typename K, typename T>
const_iterator edm::MapOfVectors< K, T >::begin ( void  ) const
inline

The iterator returned can not safely be used across threads.

Definition at line 121 of file MapOfVectors.h.

121 { return const_iterator(m_keys.begin(), m_offsets.begin(), m_data); }

◆ empty()

template<typename K, typename T>
bool edm::MapOfVectors< K, T >::empty ( ) const
inline

Definition at line 96 of file MapOfVectors.h.

96 { return m_keys.empty(); }

◆ emptyRange()

template<typename K, typename T>
range edm::MapOfVectors< K, T >::emptyRange ( ) const
inline

Definition at line 71 of file MapOfVectors.h.

71 { return range(m_data.end(), m_data.end()); }

Referenced by edm::MapOfVectors< std::string, AnalysisDescription * >::find().

◆ end()

template<typename K, typename T>
const_iterator edm::MapOfVectors< K, T >::end ( void  ) const
inline

Definition at line 123 of file MapOfVectors.h.

123 { return const_iterator(m_keys.end(), m_offsets.begin() + m_keys.size(), m_data); }

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

◆ find()

template<typename K, typename T>
range edm::MapOfVectors< K, T >::find ( K const &  k) const
inline

Definition at line 110 of file MapOfVectors.h.

110  {
111  key_iterator p = findKey(k);
112  if (p == m_keys.end())
113  return emptyRange();
114  size_type loc = p - m_keys.begin();
115  data_iterator b = m_data.begin() + m_offsets[loc];
116  data_iterator e = m_data.begin() + m_offsets[loc + 1];
117  return range(b, e);
118  }

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

◆ findKey()

template<typename K, typename T>
key_iterator edm::MapOfVectors< K, T >::findKey ( K const &  k) const
inline

Definition at line 98 of file MapOfVectors.h.

98  {
99  std::pair<key_iterator, key_iterator> p = std::equal_range(m_keys.begin(), m_keys.end(), k);
100  return (p.first != p.second) ? p.first : m_keys.end();
101  }

Referenced by edm::MapOfVectors< std::string, AnalysisDescription * >::find(), and edm::MapOfVectors< std::string, AnalysisDescription * >::offset().

◆ loadNext()

template<typename K, typename T>
void edm::MapOfVectors< K, T >::loadNext ( K const &  k,
std::vector< T > const &  v 
)
inline

◆ offset()

template<typename K, typename T>
size_type edm::MapOfVectors< K, T >::offset ( K const &  k) const
inline

Definition at line 103 of file MapOfVectors.h.

103  {
104  key_iterator p = findKey(k);
105  if (p == m_keys.end())
106  return m_data.size();
107  return m_offsets[p - m_keys.begin()];
108  }

◆ operator=()

template<typename K, typename T>
MapOfVectors& edm::MapOfVectors< K, T >::operator= ( MapOfVectors< K, T > const &  rhs)
inline

Definition at line 131 of file MapOfVectors.h.

131  {
132  MapOfVectors temp(rhs);
133  this->swap(temp);
134  return *this;
135  }

◆ size()

template<typename K, typename T>
size_type edm::MapOfVectors< K, T >::size ( void  ) const
inline

Definition at line 94 of file MapOfVectors.h.

94 { return m_keys.size(); }

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

◆ swap()

template<typename K, typename T>
void edm::MapOfVectors< K, T >::swap ( MapOfVectors< K, T > &  other)
inline

Definition at line 125 of file MapOfVectors.h.

125  {
126  m_keys.swap(other.m_keys);
127  m_offsets.swap(other.m_offsets);
128  m_data.swap(other.m_data);
129  }

Referenced by edm::MapOfVectors< std::string, AnalysisDescription * >::operator=(), and edm::swap().

Friends And Related Function Documentation

◆ ::TestMapOfVectors

template<typename K, typename T>
friend class ::TestMapOfVectors
friend

Definition at line 139 of file MapOfVectors.h.

Member Data Documentation

◆ m_data

template<typename K, typename T>
std::vector<T> edm::MapOfVectors< K, T >::m_data
private

◆ m_keys

template<typename K, typename T>
std::vector<K> edm::MapOfVectors< K, T >::m_keys
private

◆ m_offsets

template<typename K, typename T>
std::vector<size_type> edm::MapOfVectors< K, T >::m_offsets
private
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::MapOfVectors::MapOfVectors
MapOfVectors()
Definition: MapOfVectors.h:73
edm::MapOfVectors::findKey
key_iterator findKey(K const &k) const
Definition: MapOfVectors.h:98
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::MapOfVectors::size_type
unsigned int size_type
Definition: MapOfVectors.h:24
edm::MapOfVectors::emptyRange
range emptyRange() const
Definition: MapOfVectors.h:71
edm::MapOfVectors::loadNext
void loadNext(K const &k, std::vector< T > const &v)
Definition: MapOfVectors.h:87
trackingPlots.other
other
Definition: trackingPlots.py:1465
dqmdumpme.k
k
Definition: dqmdumpme.py:60
b
double b
Definition: hdecay.h:118
edm::MapOfVectors::key_iterator
Keys::const_iterator key_iterator
Definition: MapOfVectors.h:30
edm::MapOfVectors::range
boost::iterator_range< data_iterator > range
Definition: MapOfVectors.h:34
edm::MapOfVectors::m_offsets
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:142
edm::MapOfVectors::swap
void swap(MapOfVectors &other)
Definition: MapOfVectors.h:125
edm::MapOfVectors::data_iterator
Data::const_iterator data_iterator
Definition: MapOfVectors.h:32
edm::MapOfVectors::const_iterator
Iter const_iterator
Definition: MapOfVectors.h:69
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::MapOfVectors::m_data
std::vector< T > m_data
Definition: MapOfVectors.h:143
edm::MapOfVectors::m_keys
std::vector< K > m_keys
Definition: MapOfVectors.h:141