File indexing completed on 2025-08-06 08:17:37
0001 #include "EventplaneinfoMapv1.h"
0002
0003 #include "Eventplaneinfo.h"
0004 #include "EventplaneinfoMap.h"
0005
0006 #include <iterator> // for reverse_iterator
0007 #include <utility> // for pair, make_pair
0008
0009 EventplaneinfoMapv1::~EventplaneinfoMapv1()
0010 {
0011 EventplaneinfoMapv1::clear();
0012 }
0013
0014 void EventplaneinfoMapv1::identify(std::ostream& os) const
0015 {
0016 os << "EventplaneinfoMapv1: size = " << _map.size() << std::endl;
0017 for (const auto& m : _map)
0018 {
0019 m.second->identify(os);
0020 }
0021 return;
0022 }
0023
0024 void EventplaneinfoMapv1::clear()
0025 {
0026 for (const auto& iter : _map)
0027 {
0028 delete iter.second;
0029 }
0030 _map.clear();
0031 return;
0032 }
0033
0034 const Eventplaneinfo* EventplaneinfoMapv1::get(unsigned int id) const
0035 {
0036 ConstIter iter = _map.find(id);
0037 if (iter == _map.end())
0038 {
0039 return nullptr;
0040 }
0041 return iter->second;
0042 }
0043
0044 Eventplaneinfo* EventplaneinfoMapv1::get(unsigned int id)
0045 {
0046 Iter iter = _map.find(id);
0047 if (iter == _map.end())
0048 {
0049 return nullptr;
0050 }
0051 return iter->second;
0052 }
0053
0054 Eventplaneinfo* EventplaneinfoMapv1::insert(Eventplaneinfo* clus, const EventplaneinfoMap::EPTYPE id)
0055 {
0056 auto [iter, inserted] = _map.insert(std::make_pair(id, clus));
0057 if (!inserted)
0058 {
0059 delete iter->second;
0060 iter->second = clus;
0061 }
0062 return iter->second;
0063 }
0064