All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
ana::SpectrumLoaderBase::IDMap< T, U > Struct Template Reference

Helper class for SpectrumLoaderBase. More...

#include <SpectrumLoaderBase.h>

Public Types

typedef std::vector< std::pair
< T, U > >::iterator 
it_t
 

Public Member Functions

U & operator[] (const T &key)
 
it_t begin ()
 
it_t end ()
 
template<class V >
void Erase (const V &v)
 
void RemoveLoader (SpectrumLoaderBase *l)
 
void Clear ()
 
size_t TotalSize ()
 
void GetSpectra (std::vector< Spectrum * > &ss)
 
void GetReweightableSpectra (std::vector< ReweightableSpectrum * > &ss)
 

Protected Attributes

std::vector< std::pair< T, U > > fElems
 

Detailed Description

template<class T, class U>
struct ana::SpectrumLoaderBase::IDMap< T, U >

Helper class for SpectrumLoaderBase.

Functions like std::map<T, U> except it should be faster to iterate through the elements (while slower to fill) and it knows to compare Ts via their ID() function. Various methods that forward through to the SpectList at the end of the chain.

Definition at line 157 of file SpectrumLoaderBase.h.

Member Typedef Documentation

template<class T, class U>
typedef std::vector<std::pair<T, U> >::iterator ana::SpectrumLoaderBase::IDMap< T, U >::it_t

Definition at line 162 of file SpectrumLoaderBase.h.

Member Function Documentation

template<class T, class U>
it_t ana::SpectrumLoaderBase::IDMap< T, U >::begin ( )
inline

Definition at line 163 of file SpectrumLoaderBase.h.

163 {return fElems.begin();}
std::vector< std::pair< T, U > > fElems
template<class T , class U >
void ana::SpectrumLoaderBase::IDMap< T, U >::Clear ( )

Definition at line 91 of file SpectrumLoaderBase.cxx.

92  {
93  fElems.clear();
94  }
std::vector< std::pair< T, U > > fElems
template<class T, class U>
it_t ana::SpectrumLoaderBase::IDMap< T, U >::end ( void  )
inline

Definition at line 164 of file SpectrumLoaderBase.h.

164 {return fElems.end();}
std::vector< std::pair< T, U > > fElems
template<class T , class U >
template<class V >
void ana::SpectrumLoaderBase::IDMap< T, U >::Erase ( const V v)

Definition at line 78 of file SpectrumLoaderBase.cxx.

79  {
80  for(auto& it: fElems) it.second.Erase(v);
81  }
std::vector< std::pair< T, U > > fElems
template<class T , class U >
void ana::SpectrumLoaderBase::IDMap< T, U >::GetReweightableSpectra ( std::vector< ReweightableSpectrum * > &  ss)

Definition at line 114 of file SpectrumLoaderBase.cxx.

115  {
116  for(auto& it: fElems) it.second.GetReweightableSpectra(ss);
117  }
std::vector< std::pair< T, U > > fElems
template<class T , class U >
void ana::SpectrumLoaderBase::IDMap< T, U >::GetSpectra ( std::vector< Spectrum * > &  ss)

Definition at line 107 of file SpectrumLoaderBase.cxx.

108  {
109  for(auto& it: fElems) it.second.GetSpectra(ss);
110  }
std::vector< std::pair< T, U > > fElems
template<class T, class U >
U & ana::SpectrumLoaderBase::IDMap< T, U >::operator[] ( const T &  key)

Definition at line 68 of file SpectrumLoaderBase.cxx.

69  {
70  for(auto& it: fElems){
71  if(it.first.ID() == key.ID()) return it.second;
72  }
73  fElems.push_back(std::make_pair(key, U()));
74  return fElems.back().second;
75  }
std::vector< std::pair< T, U > > fElems
template<class T , class U >
void ana::SpectrumLoaderBase::IDMap< T, U >::RemoveLoader ( SpectrumLoaderBase l)

Definition at line 85 of file SpectrumLoaderBase.cxx.

86  {
87  for(auto& it: fElems) it.second.RemoveLoader(l);
88  }
std::vector< std::pair< T, U > > fElems
template<class T , class U >
size_t ana::SpectrumLoaderBase::IDMap< T, U >::TotalSize ( )

Definition at line 98 of file SpectrumLoaderBase.cxx.

99  {
100  size_t ret = 0;
101  for(auto& it: fElems) ret += it.second.TotalSize();
102  return ret;
103  }
std::vector< std::pair< T, U > > fElems

Member Data Documentation

template<class T, class U>
std::vector<std::pair<T, U> > ana::SpectrumLoaderBase::IDMap< T, U >::fElems
protected

Definition at line 173 of file SpectrumLoaderBase.h.


The documentation for this struct was generated from the following files: