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
 
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 18 of file MapOfVectors.h.

Member Typedef Documentation

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

Definition at line 67 of file MapOfVectors.h.

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

Definition at line 27 of file MapOfVectors.h.

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

Definition at line 31 of file MapOfVectors.h.

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

Definition at line 29 of file MapOfVectors.h.

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

Definition at line 25 of file MapOfVectors.h.

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

Definition at line 30 of file MapOfVectors.h.

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

Definition at line 26 of file MapOfVectors.h.

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

Definition at line 35 of file MapOfVectors.h.

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

Definition at line 33 of file MapOfVectors.h.

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

Definition at line 20 of file MapOfVectors.h.

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

Definition at line 23 of file MapOfVectors.h.

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

Definition at line 21 of file MapOfVectors.h.

Constructor & Destructor Documentation

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

Definition at line 71 of file MapOfVectors.h.

71 : m_offsets(1, 0) {}
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:139
template<typename K, typename T>
edm::MapOfVectors< K, T >::MapOfVectors ( TheMap const &  it)
inline

Definition at line 73 of file MapOfVectors.h.

73  {
74  m_keys.reserve(it.size());
75  m_offsets.reserve(it.size() + 1);
76  m_offsets.push_back(0);
77  size_type tot = 0;
78  for (typename TheMap::const_iterator p = it.begin(); p != it.end(); ++p)
79  tot += (*p).second.size();
80  m_data.reserve(tot);
81  for (typename TheMap::const_iterator p = it.begin(); p != it.end(); ++p)
82  loadNext((*p).first, (*p).second);
83  }
unsigned int size_type
Definition: MapOfVectors.h:23
std::vector< T > m_data
Definition: MapOfVectors.h:140
void loadNext(K const &k, std::vector< T > const &v)
Definition: MapOfVectors.h:85
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:139
std::vector< K > m_keys
Definition: MapOfVectors.h:138

Member Function Documentation

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

Definition at line 118 of file MapOfVectors.h.

118 { return const_iterator(m_keys.begin(), m_offsets.begin(), m_data); }
std::vector< T > m_data
Definition: MapOfVectors.h:140
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:139
std::vector< K > m_keys
Definition: MapOfVectors.h:138
template<typename K, typename T>
bool edm::MapOfVectors< K, T >::empty ( ) const
inline

Definition at line 94 of file MapOfVectors.h.

Referenced by Vispa.Gui.VispaWidget.TextField::setAutosizeFont(), and Vispa.Gui.VispaWidget.TextField::setAutotruncate().

94 { return m_keys.empty(); }
std::vector< K > m_keys
Definition: MapOfVectors.h:138
template<typename K, typename T>
range edm::MapOfVectors< K, T >::emptyRange ( ) const
inline

Definition at line 69 of file MapOfVectors.h.

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

69 { return range(m_data.end(), m_data.end()); }
std::vector< T > m_data
Definition: MapOfVectors.h:140
boost::iterator_range< data_iterator > range
Definition: MapOfVectors.h:33
template<typename K, typename T>
const_iterator edm::MapOfVectors< K, T >::end ( void  ) const
inline

Definition at line 120 of file MapOfVectors.h.

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

120 { return const_iterator(m_keys.end(), m_offsets.begin() + m_keys.size(), m_data); }
std::vector< T > m_data
Definition: MapOfVectors.h:140
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:139
std::vector< K > m_keys
Definition: MapOfVectors.h:138
template<typename K, typename T>
range edm::MapOfVectors< K, T >::find ( K const &  k) const
inline

Definition at line 108 of file MapOfVectors.h.

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

108  {
109  key_iterator p = findKey(k);
110  if (p == m_keys.end())
111  return emptyRange();
112  size_type loc = p - m_keys.begin();
113  data_iterator b = m_data.begin() + m_offsets[loc];
114  data_iterator e = m_data.begin() + m_offsets[loc + 1];
115  return range(b, e);
116  }
Keys::const_iterator key_iterator
Definition: MapOfVectors.h:29
unsigned int size_type
Definition: MapOfVectors.h:23
std::vector< T > m_data
Definition: MapOfVectors.h:140
key_iterator findKey(K const &k) const
Definition: MapOfVectors.h:96
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:139
std::vector< K > m_keys
Definition: MapOfVectors.h:138
range emptyRange() const
Definition: MapOfVectors.h:69
Data::const_iterator data_iterator
Definition: MapOfVectors.h:31
double b
Definition: hdecay.h:118
boost::iterator_range< data_iterator > range
Definition: MapOfVectors.h:33
template<typename K, typename T>
key_iterator edm::MapOfVectors< K, T >::findKey ( K const &  k) const
inline

Definition at line 96 of file MapOfVectors.h.

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

96  {
97  std::pair<key_iterator, key_iterator> p = std::equal_range(m_keys.begin(), m_keys.end(), k);
98  return (p.first != p.second) ? p.first : m_keys.end();
99  }
std::vector< K > m_keys
Definition: MapOfVectors.h:138
template<typename K, typename T>
void edm::MapOfVectors< K, T >::loadNext ( K const &  k,
std::vector< T > const &  v 
)
inline
template<typename K, typename T>
size_type edm::MapOfVectors< K, T >::offset ( K const &  k) const
inline

Definition at line 101 of file MapOfVectors.h.

101  {
102  key_iterator p = findKey(k);
103  if (p == m_keys.end())
104  return m_data.size();
105  return m_offsets[p - m_keys.begin()];
106  }
Keys::const_iterator key_iterator
Definition: MapOfVectors.h:29
std::vector< T > m_data
Definition: MapOfVectors.h:140
key_iterator findKey(K const &k) const
Definition: MapOfVectors.h:96
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:139
std::vector< K > m_keys
Definition: MapOfVectors.h:138
template<typename K, typename T>
MapOfVectors& edm::MapOfVectors< K, T >::operator= ( MapOfVectors< K, T > const &  rhs)
inline

Definition at line 128 of file MapOfVectors.h.

128  {
129  MapOfVectors temp(rhs);
130  this->swap(temp);
131  return *this;
132  }
void swap(MapOfVectors &other)
Definition: MapOfVectors.h:122
template<typename K, typename T>
size_type edm::MapOfVectors< K, T >::size ( void  ) const
inline

Definition at line 92 of file MapOfVectors.h.

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

92 { return m_keys.size(); }
std::vector< K > m_keys
Definition: MapOfVectors.h:138
template<typename K, typename T>
void edm::MapOfVectors< K, T >::swap ( MapOfVectors< K, T > &  other)
inline

Definition at line 122 of file MapOfVectors.h.

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

122  {
123  m_keys.swap(other.m_keys);
124  m_offsets.swap(other.m_offsets);
125  m_data.swap(other.m_data);
126  }
std::vector< T > m_data
Definition: MapOfVectors.h:140
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:139
std::vector< K > m_keys
Definition: MapOfVectors.h:138

Friends And Related Function Documentation

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

Definition at line 136 of file MapOfVectors.h.

Member Data Documentation

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