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.

References StorableDoubleMap< T >::clear().

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

◆ clear()

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

Definition at line 50 of file StorableDoubleMap.h.

References mps_fire::end.

Referenced by StorableDoubleMap< T >::~StorableDoubleMap().

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 }

◆ empty()

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

Definition at line 26 of file StorableDoubleMap.h.

References StorableDoubleMap< T >::data_.

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.

References validateAlignments::category, and Skims_PA_cff::name.

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

Definition at line 70 of file StorableDoubleMap.h.

References validateAlignments::category, and Skims_PA_cff::name.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), submitPVValidationJobs.BetterConfigParser::__updateDict(), util.rrapi.RRApi::columns(), rrapi.RRApi::columns(), rrapi.RRApi::count(), util.rrapi.RRApi::count(), rrapi.RRApi::data(), util.rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), submitPVValidationJobs.BetterConfigParser::getResultingSection(), util.rrapi.RRApi::report(), rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), util.rrapi.RRApi::tags(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().

70  {
71  typename DataMap::const_iterator dit = data_.find(category);
72  if (dit == data_.end())
73  throw cms::Exception("In StorableDoubleMap::get: unknown category");
74  typename PtrMap::const_iterator pit = dit->second.find(name);
75  if (pit == dit->second.end())
76  throw cms::Exception("In StorableDoubleMap::get: unknown name");
77  return pit->second;
78 }

◆ operator!=()

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

Definition at line 34 of file StorableDoubleMap.h.

References alignCSCRings::r.

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.

References mps_fire::end, and alignCSCRings::r.

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.

References StorableDoubleMap< T >::data_.

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