CMS 3D CMS Logo

edm::MapOfVectors< K, T > Class Template Reference

#include <DataFormats/Common/interface/MapOfVectors.h>

List of all members.

Public Types

typedef Iter const_iterator
typedef std::vector< T > Data
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, T > self
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 (TheMap const &it)
 MapOfVectors ()
size_type offset (K const &k) const
MapOfVectorsoperator= (MapOfVectors const &rhs)
size_type size () const
void swap (MapOfVectors &other)

Private Attributes

std::vector< T > m_data
std::vector< K > m_keys
std::vector< size_typem_offsets

Classes

class  Iter


Detailed Description

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

Definition at line 17 of file MapOfVectors.h.


Member Typedef Documentation

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

Definition at line 78 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 83 of file MapOfVectors.h.

00083 :  m_offsets(1,0) {}

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

Definition at line 85 of file MapOfVectors.h.

References edm::MapOfVectors< K, T >::loadNext(), edm::MapOfVectors< K, T >::m_data, edm::MapOfVectors< K, T >::m_keys, edm::MapOfVectors< K, T >::m_offsets, and p.

00085                                     {
00086       m_keys.reserve(it.size());
00087       m_offsets.reserve(it.size()+1);
00088       m_offsets.push_back(0);
00089       size_type tot=0;
00090       for(typename TheMap::const_iterator p=it.begin(); p!=it.end();++p)
00091         tot += (*p).second.size();
00092       m_data.reserve(tot);
00093       for(typename TheMap::const_iterator p=it.begin(); p!=it.end();++p)
00094         loadNext((*p).first,(*p).second);
00095 
00096     }


Member Function Documentation

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

Definition at line 130 of file MapOfVectors.h.

References edm::MapOfVectors< K, T >::m_data, edm::MapOfVectors< K, T >::m_keys, and edm::MapOfVectors< K, T >::m_offsets.

Referenced by SiStripConfigDb::printDcuDetIds(), SiStripConfigDb::printDeviceDescriptions(), SiStripConfigDb::printFedConnections(), and SiStripConfigDb::printFedDescriptions().

00130                                  {
00131       return const_iterator(m_keys.begin(),m_offsets.begin(),m_data);
00132     }

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

Definition at line 107 of file MapOfVectors.h.

References edm::MapOfVectors< K, T >::m_keys.

Referenced by SiStripConfigDb::clearDcuDetIds(), SiStripConfigDb::clearDeviceDescriptions(), SiStripConfigDb::clearFedConnections(), SiStripConfigDb::clearFedDescriptions(), SiStripConfigDb::getDcuDetIds(), SiStripConfigDb::getDeviceDescriptions(), SiStripConfigDb::getFedConnections(), SiStripConfigDb::getFedDescriptions(), SiStripConfigDb::uploadDeviceDescriptions(), SiStripConfigDb::uploadFedConnections(), and SiStripConfigDb::uploadFedDescriptions().

00107 { return m_keys.empty();}

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

Definition at line 81 of file MapOfVectors.h.

References edm::MapOfVectors< K, T >::m_data.

Referenced by SiStripConfigDb::addDeviceDescriptions(), SiStripConfigDb::addFedConnections(), SiStripConfigDb::addFedDescriptions(), SiStripConfigDb::clearDcuDetIds(), SiStripConfigDb::clearDeviceDescriptions(), SiStripConfigDb::clearFedConnections(), SiStripConfigDb::clearFedDescriptions(), edm::MapOfVectors< K, T >::find(), SiStripConfigDb::getDcuDetIds(), SiStripConfigDb::getDeviceDescriptions(), SiStripConfigDb::getFedConnections(), SiStripConfigDb::getFedDescriptions(), SiStripConfigDb::uploadDeviceDescriptions(), SiStripConfigDb::uploadFedConnections(), and SiStripConfigDb::uploadFedDescriptions().

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

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

Definition at line 134 of file MapOfVectors.h.

References edm::MapOfVectors< K, T >::m_data, edm::MapOfVectors< K, T >::m_keys, and edm::MapOfVectors< K, T >::m_offsets.

Referenced by SiStripConfigDb::printDcuDetIds(), SiStripConfigDb::printDeviceDescriptions(), SiStripConfigDb::printFedConnections(), and SiStripConfigDb::printFedDescriptions().

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

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

Definition at line 121 of file MapOfVectors.h.

References b, e, edm::MapOfVectors< K, T >::emptyRange(), edm::MapOfVectors< K, T >::findKey(), muonGeometry::loc, edm::MapOfVectors< K, T >::m_data, edm::MapOfVectors< K, T >::m_keys, edm::MapOfVectors< K, T >::m_offsets, and p.

Referenced by SiStripConfigDb::addDeviceDescriptions(), SiStripConfigDb::addFedConnections(), SiStripConfigDb::addFedDescriptions(), SiStripConfigDb::clearDcuDetIds(), SiStripConfigDb::clearDeviceDescriptions(), SiStripConfigDb::clearFedConnections(), SiStripConfigDb::clearFedDescriptions(), SiStripConfigDb::getDcuDetIds(), SiStripConfigDb::getDeviceDescriptions(), SiStripConfigDb::getFedConnections(), SiStripConfigDb::getFedDescriptions(), SiStripConfigDb::uploadDeviceDescriptions(), SiStripConfigDb::uploadFedConnections(), and SiStripConfigDb::uploadFedDescriptions().

00121                                    {
00122       key_iterator p = findKey(k);
00123       if (p==m_keys.end()) return emptyRange();
00124       size_type loc = p-m_keys.begin();
00125       data_iterator b = m_data.begin()+m_offsets[loc];
00126       data_iterator e = m_data.begin()+m_offsets[loc+1];
00127       return range(b,e);
00128     }

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

Definition at line 109 of file MapOfVectors.h.

References edm::MapOfVectors< K, T >::m_keys, and p.

Referenced by edm::MapOfVectors< K, T >::find(), and edm::MapOfVectors< K, T >::offset().

00109                                             {
00110       std::pair<key_iterator,key_iterator> p =
00111         std::equal_range(m_keys.begin(), m_keys.end(), k);
00112       return (p.first!=p.second) ? p.first : m_keys.end();
00113     }

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

Definition at line 98 of file MapOfVectors.h.

References edmNew::copy(), edm::MapOfVectors< K, T >::m_data, edm::MapOfVectors< K, T >::m_keys, and edm::MapOfVectors< K, T >::m_offsets.

Referenced by SiStripConfigDb::addDeviceDescriptions(), SiStripConfigDb::addFedConnections(), SiStripConfigDb::addFedDescriptions(), SiStripConfigDb::clearDcuDetIds(), SiStripConfigDb::clearDeviceDescriptions(), SiStripConfigDb::clearFedConnections(), SiStripConfigDb::clearFedDescriptions(), SiStripConfigDb::getDcuDetIds(), SiStripConfigDb::getDeviceDescriptions(), SiStripConfigDb::getFedConnections(), SiStripConfigDb::getFedDescriptions(), and edm::MapOfVectors< K, T >::MapOfVectors().

00098                                                        {
00099       m_keys.push_back(k);
00100       m_data.resize(m_offsets.back()+v.size());
00101       std::copy(v.begin(),v.end(),m_data.begin()+m_offsets.back());
00102       m_offsets.push_back(m_data.size());
00103     }

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

Definition at line 115 of file MapOfVectors.h.

References edm::MapOfVectors< K, T >::findKey(), edm::MapOfVectors< K, T >::m_data, edm::MapOfVectors< K, T >::m_keys, edm::MapOfVectors< K, T >::m_offsets, and p.

00115                                         {
00116       key_iterator p = findKey(k);
00117       if (p==m_keys.end()) return m_data.size();
00118       return m_offsets[p-m_keys.begin()];
00119     }

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

Definition at line 144 of file MapOfVectors.h.

References edm::MapOfVectors< K, T >::swap(), and pyDBSRunClass::temp.

00144                                                      {
00145       MapOfVectors temp(rhs);
00146       this->swap(temp);
00147       return *this;
00148     }

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

Definition at line 105 of file MapOfVectors.h.

References edm::MapOfVectors< K, T >::m_keys.

Referenced by SiStripConfigDb::addDeviceDescriptions(), SiStripConfigDb::addFedConnections(), SiStripConfigDb::addFedDescriptions(), SiStripConfigDb::getDcuDetIds(), SiStripConfigDb::getDeviceDescriptions(), SiStripConfigDb::getFedConnections(), SiStripConfigDb::getFedDescriptions(), SiStripConfigDb::printDcuDetIds(), SiStripConfigDb::printDeviceDescriptions(), SiStripConfigDb::printFedConnections(), and SiStripConfigDb::printFedDescriptions().

00105 { return m_keys.size();}

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

Definition at line 138 of file MapOfVectors.h.

References edm::MapOfVectors< K, T >::m_data, edm::MapOfVectors< K, T >::m_keys, and edm::MapOfVectors< K, T >::m_offsets.

Referenced by edm::MapOfVectors< K, T >::operator=(), and edm::swap().

00138                                    {
00139       m_keys.swap(other.m_keys);
00140       m_offsets.swap(other.m_offsets);
00141       m_data.swap(other.m_data);
00142     }


Member Data Documentation

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

Definition at line 153 of file MapOfVectors.h.

Referenced by edm::MapOfVectors< K, T >::begin(), edm::MapOfVectors< K, T >::emptyRange(), edm::MapOfVectors< K, T >::end(), edm::MapOfVectors< K, T >::find(), edm::MapOfVectors< K, T >::loadNext(), edm::MapOfVectors< K, T >::MapOfVectors(), edm::MapOfVectors< K, T >::offset(), and edm::MapOfVectors< K, T >::swap().

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

Definition at line 151 of file MapOfVectors.h.

Referenced by edm::MapOfVectors< K, T >::begin(), edm::MapOfVectors< K, T >::empty(), edm::MapOfVectors< K, T >::end(), edm::MapOfVectors< K, T >::find(), edm::MapOfVectors< K, T >::findKey(), edm::MapOfVectors< K, T >::loadNext(), edm::MapOfVectors< K, T >::MapOfVectors(), edm::MapOfVectors< K, T >::offset(), edm::MapOfVectors< K, T >::size(), and edm::MapOfVectors< K, T >::swap().

template<typename K, typename T>
std::vector<size_type> edm::MapOfVectors< K, T >::m_offsets [private]

Definition at line 152 of file MapOfVectors.h.

Referenced by edm::MapOfVectors< K, T >::begin(), edm::MapOfVectors< K, T >::end(), edm::MapOfVectors< K, T >::find(), edm::MapOfVectors< K, T >::loadNext(), edm::MapOfVectors< K, T >::MapOfVectors(), edm::MapOfVectors< K, T >::offset(), and edm::MapOfVectors< K, T >::swap().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:41:47 2009 for CMSSW by  doxygen 1.5.4