CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Attributes
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_iterator
range
 
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
 

Detailed Description

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

Definition at line 16 of file MapOfVectors.h.

Member Typedef Documentation

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

Definition at line 77 of file MapOfVectors.h.

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

Definition at line 26 of file MapOfVectors.h.

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

Definition at line 30 of file MapOfVectors.h.

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

Definition at line 28 of file MapOfVectors.h.

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

Definition at line 24 of file MapOfVectors.h.

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

Definition at line 29 of file MapOfVectors.h.

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

Definition at line 25 of file MapOfVectors.h.

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

Definition at line 34 of file MapOfVectors.h.

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

Definition at line 32 of file MapOfVectors.h.

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

Definition at line 19 of file MapOfVectors.h.

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

Definition at line 22 of file MapOfVectors.h.

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

Definition at line 20 of file MapOfVectors.h.

Constructor & Destructor Documentation

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

Definition at line 82 of file MapOfVectors.h.

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

Definition at line 84 of file MapOfVectors.h.

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

Member Function Documentation

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

Definition at line 129 of file MapOfVectors.h.

129  {
130  return const_iterator(m_keys.begin(),m_offsets.begin(),m_data);
131  }
std::vector< T > m_data
Definition: MapOfVectors.h:152
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:151
std::vector< K > m_keys
Definition: MapOfVectors.h:150
template<typename K, typename T>
bool edm::MapOfVectors< K, T >::empty ( ) const
inline

Definition at line 106 of file MapOfVectors.h.

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

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

Definition at line 80 of file MapOfVectors.h.

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

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

Definition at line 133 of file MapOfVectors.h.

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

133  {
134  return const_iterator(m_keys.end(),m_offsets.begin()+m_keys.size(),m_data);
135  }
std::vector< T > m_data
Definition: MapOfVectors.h:152
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:151
std::vector< K > m_keys
Definition: MapOfVectors.h:150
template<typename K, typename T>
range edm::MapOfVectors< K, T >::find ( K const &  k) const
inline

Definition at line 120 of file MapOfVectors.h.

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

120  {
121  key_iterator p = findKey(k);
122  if (p==m_keys.end()) return emptyRange();
123  size_type loc = p-m_keys.begin();
124  data_iterator b = m_data.begin()+m_offsets[loc];
125  data_iterator e = m_data.begin()+m_offsets[loc+1];
126  return range(b,e);
127  }
Keys::const_iterator key_iterator
Definition: MapOfVectors.h:28
unsigned int size_type
Definition: MapOfVectors.h:22
std::vector< T > m_data
Definition: MapOfVectors.h:152
key_iterator findKey(K const &k) const
Definition: MapOfVectors.h:108
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:151
std::vector< K > m_keys
Definition: MapOfVectors.h:150
int k[5][pyjets_maxn]
range emptyRange() const
Definition: MapOfVectors.h:80
Data::const_iterator data_iterator
Definition: MapOfVectors.h:30
double b
Definition: hdecay.h:120
boost::iterator_range< data_iterator > range
Definition: MapOfVectors.h:32
template<typename K, typename T>
key_iterator edm::MapOfVectors< K, T >::findKey ( K const &  k) const
inline

Definition at line 108 of file MapOfVectors.h.

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

108  {
109  std::pair<key_iterator,key_iterator> p =
110  std::equal_range(m_keys.begin(), m_keys.end(), k);
111  return (p.first!=p.second) ? p.first : m_keys.end();
112  }
std::vector< K > m_keys
Definition: MapOfVectors.h:150
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
template<typename K, typename T>
size_type edm::MapOfVectors< K, T >::offset ( K const &  k) const
inline

Definition at line 114 of file MapOfVectors.h.

114  {
115  key_iterator p = findKey(k);
116  if (p==m_keys.end()) return m_data.size();
117  return m_offsets[p-m_keys.begin()];
118  }
Keys::const_iterator key_iterator
Definition: MapOfVectors.h:28
std::vector< T > m_data
Definition: MapOfVectors.h:152
key_iterator findKey(K const &k) const
Definition: MapOfVectors.h:108
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:151
std::vector< K > m_keys
Definition: MapOfVectors.h:150
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 143 of file MapOfVectors.h.

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

Definition at line 104 of file MapOfVectors.h.

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

Definition at line 137 of file MapOfVectors.h.

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

137  {
138  m_keys.swap(other.m_keys);
139  m_offsets.swap(other.m_offsets);
140  m_data.swap(other.m_data);
141  }
std::vector< T > m_data
Definition: MapOfVectors.h:152
std::vector< size_type > m_offsets
Definition: MapOfVectors.h:151
std::vector< K > m_keys
Definition: MapOfVectors.h:150

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