CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
PtrMap
DataMap
 
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

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

Definition at line 38 of file StorableDoubleMap.h.

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

Definition at line 37 of file StorableDoubleMap.h.

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

Definition at line 15 of file StorableDoubleMap.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file StorableDoubleMap.h.

17 { clear(); }

Member Function Documentation

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.

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

19  {
20  delete data_[category][name];
21  data_[category][name] = ptr.release();
22  }
static const char category[]
template<typename T >
void StorableDoubleMap< T >::clear ( void  )

Definition at line 50 of file StorableDoubleMap.h.

References dataset::end.

Referenced by BeautifulSoup.Tag::setString(), and StorableDoubleMap< AbsOOTPileupCorrection >::~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 }
string end
Definition: dataset.py:937
template<typename T>
bool StorableDoubleMap< T >::empty ( ) const
inline

Definition at line 26 of file StorableDoubleMap.h.

26 { return data_.empty(); }
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 }
static const char category[]
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.

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 }
static const char category[]
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); }
template<typename T >
bool StorableDoubleMap< T >::operator== ( const StorableDoubleMap< T > &  r) const

Definition at line 81 of file StorableDoubleMap.h.

References StorableDoubleMap< T >::data_, and dataset::end.

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 }
string end
Definition: dataset.py:937
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

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

Definition at line 41 of file StorableDoubleMap.h.

Member Data Documentation

template<typename T>
DataMap StorableDoubleMap< T >::data_
private