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

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

Definition at line 28 of file MapOfVectors.h.

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

Definition at line 32 of file MapOfVectors.h.

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

Definition at line 30 of file MapOfVectors.h.

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

Definition at line 26 of file MapOfVectors.h.

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

Definition at line 31 of file MapOfVectors.h.

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

Definition at line 27 of file MapOfVectors.h.

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

Definition at line 36 of file MapOfVectors.h.

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

Definition at line 34 of file MapOfVectors.h.

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

Definition at line 21 of file MapOfVectors.h.

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

Definition at line 24 of file MapOfVectors.h.

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

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

Definition at line 84 of file MapOfVectors.h.

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

Definition at line 86 of file MapOfVectors.h.

86  {
87  m_keys.reserve(it.size());
88  m_offsets.reserve(it.size()+1);
89  m_offsets.push_back(0);
90  size_type tot=0;
91  for(typename TheMap::const_iterator p=it.begin(); p!=it.end();++p)
92  tot += (*p).second.size();
93  m_data.reserve(tot);
94  for(typename TheMap::const_iterator p=it.begin(); p!=it.end();++p)
95  loadNext((*p).first,(*p).second);
96 
97  }
unsigned int size_type
Definition: MapOfVectors.h:24
std::vector< T > m_data
Definition: MapOfVectors.h:157
void loadNext(K const &k, std::vector< T > const &v)
Definition: MapOfVectors.h:99
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:156
std::vector< K > m_keys
Definition: MapOfVectors.h:155

Member Function Documentation

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

Definition at line 131 of file MapOfVectors.h.

131  {
132  return const_iterator(m_keys.begin(),m_offsets.begin(),m_data);
133  }
std::vector< T > m_data
Definition: MapOfVectors.h:157
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:156
std::vector< K > m_keys
Definition: MapOfVectors.h:155
template<typename K, typename T>
bool edm::MapOfVectors< K, T >::empty ( ) const
inline

Definition at line 108 of file MapOfVectors.h.

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

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

Definition at line 82 of file MapOfVectors.h.

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

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

Definition at line 135 of file MapOfVectors.h.

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

135  {
136  return const_iterator(m_keys.end(),m_offsets.begin()+m_keys.size(),m_data);
137  }
std::vector< T > m_data
Definition: MapOfVectors.h:157
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:156
std::vector< K > m_keys
Definition: MapOfVectors.h:155
template<typename K, typename T>
range edm::MapOfVectors< K, T >::find ( K const &  k) const
inline

Definition at line 122 of file MapOfVectors.h.

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

122  {
123  key_iterator p = findKey(k);
124  if (p==m_keys.end()) return emptyRange();
125  size_type loc = p-m_keys.begin();
126  data_iterator b = m_data.begin()+m_offsets[loc];
127  data_iterator e = m_data.begin()+m_offsets[loc+1];
128  return range(b,e);
129  }
Keys::const_iterator key_iterator
Definition: MapOfVectors.h:30
unsigned int size_type
Definition: MapOfVectors.h:24
std::vector< T > m_data
Definition: MapOfVectors.h:157
key_iterator findKey(K const &k) const
Definition: MapOfVectors.h:110
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:156
std::vector< K > m_keys
Definition: MapOfVectors.h:155
int k[5][pyjets_maxn]
range emptyRange() const
Definition: MapOfVectors.h:82
Data::const_iterator data_iterator
Definition: MapOfVectors.h:32
double b
Definition: hdecay.h:120
boost::iterator_range< data_iterator > range
Definition: MapOfVectors.h:34
template<typename K, typename T>
key_iterator edm::MapOfVectors< K, T >::findKey ( K const &  k) const
inline

Definition at line 110 of file MapOfVectors.h.

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

110  {
111  std::pair<key_iterator,key_iterator> p =
112  std::equal_range(m_keys.begin(), m_keys.end(), k);
113  return (p.first!=p.second) ? p.first : m_keys.end();
114  }
std::vector< K > m_keys
Definition: MapOfVectors.h:155
int k[5][pyjets_maxn]
template<typename K, typename T>
void edm::MapOfVectors< K, T >::loadNext ( K const &  k,
std::vector< T > const &  v 
)
inline

Definition at line 99 of file MapOfVectors.h.

Referenced by SiStripConfigDb::clearAnalysisDescriptions(), SiStripConfigDb::clearDcuDetIds(), SiStripConfigDb::clearDeviceDescriptions(), SiStripConfigDb::clearFedConnections(), SiStripConfigDb::clearFedDescriptions(), and edm::MapOfVectors< std::string, AnalysisDescription * >::MapOfVectors().

99  {
100  m_keys.push_back(k);
101  m_data.resize(m_offsets.back()+v.size());
102  std::copy(v.begin(),v.end(),m_data.begin()+m_offsets.back());
103  m_offsets.push_back(m_data.size());
104  }
std::vector< T > m_data
Definition: MapOfVectors.h:157
def copy(args, dbName)
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:156
std::vector< K > m_keys
Definition: MapOfVectors.h:155
int k[5][pyjets_maxn]
template<typename K, typename T>
size_type edm::MapOfVectors< K, T >::offset ( K const &  k) const
inline

Definition at line 116 of file MapOfVectors.h.

116  {
117  key_iterator p = findKey(k);
118  if (p==m_keys.end()) return m_data.size();
119  return m_offsets[p-m_keys.begin()];
120  }
Keys::const_iterator key_iterator
Definition: MapOfVectors.h:30
std::vector< T > m_data
Definition: MapOfVectors.h:157
key_iterator findKey(K const &k) const
Definition: MapOfVectors.h:110
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:156
std::vector< K > m_keys
Definition: MapOfVectors.h:155
int k[5][pyjets_maxn]
template<typename K, typename T>
MapOfVectors& edm::MapOfVectors< K, T >::operator= ( MapOfVectors< K, T > const &  rhs)
inline

Definition at line 145 of file MapOfVectors.h.

145  {
146  MapOfVectors temp(rhs);
147  this->swap(temp);
148  return *this;
149  }
void swap(MapOfVectors &other)
Definition: MapOfVectors.h:139
template<typename K, typename T>
size_type edm::MapOfVectors< K, T >::size ( void  ) const
inline

Definition at line 106 of file MapOfVectors.h.

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

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

Definition at line 139 of file MapOfVectors.h.

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

139  {
140  m_keys.swap(other.m_keys);
141  m_offsets.swap(other.m_offsets);
142  m_data.swap(other.m_data);
143  }
std::vector< T > m_data
Definition: MapOfVectors.h:157
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:156
std::vector< K > m_keys
Definition: MapOfVectors.h:155

Friends And Related Function Documentation

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

Definition at line 153 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