1 #ifndef CondFormats_HcalObjects_StorableDoubleMap_h 2 #define CondFormats_HcalObjects_StorableDoubleMap_h 6 #include "boost/serialization/map.hpp" 37 typedef std::map<std::string, T*>
PtrMap;
38 typedef std::map<std::string, PtrMap>
DataMap;
41 friend class boost::serialization::access;
43 template <
class Archive>
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)
62 typename DataMap::const_iterator dit = data_.find(
category);
63 if (dit == data_.end())
66 return !(dit->second.find(
name) == dit->second.end());
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())
82 if (data_.size() !=
r.data_.size())
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)
90 if (dit->second.size() != rit->second.size())
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)
98 if (*(pit->second) != *(rpit->second))
105 #endif // CondFormats_HcalObjects_StorableDoubleMap_h
void serialize(Archive &ar, unsigned)
const T * get(const std::string &name, const std::string &category) const
void add(const std::string &name, const std::string &category, std::unique_ptr< T > ptr)
std::map< std::string, T * > PtrMap
std::map< std::string, PtrMap > DataMap
bool exists(const std::string &name, const std::string &category) const
bool operator==(const StorableDoubleMap &r) const
bool operator!=(const StorableDoubleMap &r) const