CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
StorableDoubleMap< T > Class Template Reference

#include <StorableDoubleMap.h>

Public Types

typedef T value_type
 

Public Member Functions

void add (const std::string &name, const std::string &category, std::unique_ptr< T > ptr)
 
void clear ()
 
bool empty () const
 
bool exists (const std::string &name, const std::string &category) const
 
const Tget (const std::string &name, const std::string &category) const
 
bool operator!= (const StorableDoubleMap &r) const
 
bool operator== (const StorableDoubleMap &r) const
 
 ~StorableDoubleMap ()
 

Private Types

typedef std::map< std::string, PtrMapDataMap
 
typedef std::map< std::string, T * > PtrMap
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, unsigned)
 

Private Attributes

DataMap data_
 

Friends

class boost::serialization::access
 

Detailed Description

template<typename T>
class StorableDoubleMap< T >

Definition at line 13 of file StorableDoubleMap.h.

Member Typedef Documentation

◆ DataMap

template<typename T>
typedef std::map<std::string, PtrMap> StorableDoubleMap< T >::DataMap
private

Definition at line 38 of file StorableDoubleMap.h.

◆ PtrMap

template<typename T>
typedef std::map<std::string, T*> StorableDoubleMap< T >::PtrMap
private

Definition at line 37 of file StorableDoubleMap.h.

◆ value_type

template<typename T>
typedef T StorableDoubleMap< T >::value_type

Definition at line 15 of file StorableDoubleMap.h.

Constructor & Destructor Documentation

◆ ~StorableDoubleMap()

template<typename T>
StorableDoubleMap< T >::~StorableDoubleMap ( )
inline

Definition at line 17 of file StorableDoubleMap.h.

17 { clear(); }

Member Function Documentation

◆ add()

template<typename T>
void StorableDoubleMap< T >::add ( const std::string &  name,
const std::string &  category,
std::unique_ptr< T ptr 
)
inline

Definition at line 19 of file StorableDoubleMap.h.

19  {
20  delete data_[category][name];
21  data_[category][name] = ptr.release();
22  }

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

◆ clear()

template<typename T >
void StorableDoubleMap< T >::clear ( void  )

Definition at line 50 of file StorableDoubleMap.h.

50  {
51  const typename DataMap::iterator end = data_.end();
52  for (typename DataMap::iterator dit = data_.begin(); dit != end; ++dit) {
53  const typename PtrMap::iterator pend = dit->second.end();
54  for (typename PtrMap::iterator pit = dit->second.begin(); pit != pend; ++pit)
55  delete pit->second;
56  }
57  data_.clear();
58 }

Referenced by BeautifulSoup.Tag::setString(), and StorableDoubleMap< AbsOOTPileupCorrection >::~StorableDoubleMap().

◆ empty()

template<typename T>
bool StorableDoubleMap< T >::empty ( ) const
inline

Definition at line 26 of file StorableDoubleMap.h.

26 { return data_.empty(); }

◆ exists()

template<typename T >
bool StorableDoubleMap< T >::exists ( const std::string &  name,
const std::string &  category 
) const

Definition at line 61 of file StorableDoubleMap.h.

61  {
62  typename DataMap::const_iterator dit = data_.find(category);
63  if (dit == data_.end())
64  return false;
65  else
66  return !(dit->second.find(name) == dit->second.end());
67 }

◆ get()

template<typename T >
const T * StorableDoubleMap< T >::get ( const std::string &  name,
const std::string &  category 
) const

◆ operator!=()

template<typename T>
bool StorableDoubleMap< T >::operator!= ( const StorableDoubleMap< T > &  r) const
inline

Definition at line 34 of file StorableDoubleMap.h.

34 { return !(*this == r); }

◆ operator==()

template<typename T >
bool StorableDoubleMap< T >::operator== ( const StorableDoubleMap< T > &  r) const

Definition at line 81 of file StorableDoubleMap.h.

81  {
82  if (data_.size() != r.data_.size())
83  return false;
84  typename DataMap::const_iterator dit = data_.begin();
85  const typename DataMap::const_iterator end = data_.end();
86  typename DataMap::const_iterator rit = r.data_.begin();
87  for (; dit != end; ++dit, ++rit) {
88  if (dit->first != rit->first)
89  return false;
90  if (dit->second.size() != rit->second.size())
91  return false;
92  typename PtrMap::const_iterator pit = dit->second.begin();
93  const typename PtrMap::const_iterator pend = dit->second.end();
94  typename PtrMap::const_iterator rpit = rit->second.begin();
95  for (; pit != pend; ++pit, ++rpit) {
96  if (pit->first != rpit->first)
97  return false;
98  if (*(pit->second) != *(rpit->second))
99  return false;
100  }
101  }
102  return true;
103 }

◆ serialize()

template<typename T>
template<class Archive >
void StorableDoubleMap< T >::serialize ( Archive &  ar,
unsigned   
)
inlineprivate

Definition at line 44 of file StorableDoubleMap.h.

44  {
45  ar& data_;
46  }

Friends And Related Function Documentation

◆ boost::serialization::access

template<typename T>
friend class boost::serialization::access
friend

Definition at line 41 of file StorableDoubleMap.h.

Member Data Documentation

◆ data_

template<typename T>
DataMap StorableDoubleMap< T >::data_
private
taus_updatedMVAIds_cff.category
category
Definition: taus_updatedMVAIds_cff.py:31
StorableDoubleMap::clear
void clear()
Definition: StorableDoubleMap.h:50
StorableDoubleMap::data_
DataMap data_
Definition: StorableDoubleMap.h:39
mps_fire.end
end
Definition: mps_fire.py:242
alignCSCRings.r
r
Definition: alignCSCRings.py:93
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
cms::Exception
Definition: Exception.h:70