1 #ifndef CondFormats_HcalObjects_StorableDoubleMap_h 2 #define CondFormats_HcalObjects_StorableDoubleMap_h 8 #include "boost/serialization/map.hpp" 35 typedef std::map<std::string, T*>
PtrMap;
36 typedef std::map<std::string, PtrMap>
DataMap;
39 friend class boost::serialization::access;
41 template <
class Archive>
49 const typename DataMap::iterator
end =
data_.end();
50 for (
typename DataMap::iterator dit =
data_.begin(); dit !=
end; ++dit) {
51 const typename PtrMap::iterator pend = dit->second.end();
52 for (
typename PtrMap::iterator pit = dit->second.begin(); pit != pend; ++pit)
60 typename DataMap::const_iterator dit =
data_.find(category);
61 if (dit ==
data_.end())
64 return !(dit->second.find(name) == dit->second.end());
69 typename DataMap::const_iterator dit =
data_.find(category);
70 if (dit ==
data_.end())
71 throw cms::Exception(
"In StorableDoubleMap::get: unknown category");
72 typename PtrMap::const_iterator pit = dit->second.find(name);
73 if (pit == dit->second.end())
82 typename DataMap::const_iterator dit =
data_.begin();
83 const typename DataMap::const_iterator
end =
data_.end();
84 typename DataMap::const_iterator rit = r.
data_.begin();
85 for (; dit !=
end; ++dit, ++rit) {
86 if (dit->first != rit->first)
88 if (dit->second.size() != rit->second.size())
90 typename PtrMap::const_iterator pit = dit->second.begin();
91 const typename PtrMap::const_iterator pend = dit->second.end();
92 typename PtrMap::const_iterator rpit = rit->second.begin();
93 for (; pit != pend; ++pit, ++rpit) {
94 if (pit->first != rpit->first)
96 if (*(pit->second) != *(rpit->second))
103 #endif // CondFormats_HcalObjects_StorableDoubleMap_h
void serialize(Archive &ar, unsigned)
bool operator==(const StorableDoubleMap &r) const
void add(const std::string &name, const std::string &category, std::unique_ptr< T > ptr)
bool exists(const std::string &name, const std::string &category) const
bool operator!=(const StorableDoubleMap &r) const
std::map< std::string, T * > PtrMap
const T * get(const std::string &name, const std::string &category) const
std::map< std::string, PtrMap > DataMap