File indexing completed on 2024-04-06 12:05:24
0001 #ifndef DD_DDMap_h
0002 #define DD_DDMap_h
0003
0004 #include <iostream>
0005 #include <map>
0006 #include <memory>
0007 #include <string>
0008
0009 #include "DetectorDescription/Core/interface/DDReadMapType.h"
0010 #include "DetectorDescription/Core/interface/DDBase.h"
0011 #include "DetectorDescription/Core/interface/DDName.h"
0012
0013 class DDMap;
0014
0015
0016 std::ostream& operator<<(std::ostream& o, const DDMap& cons);
0017
0018
0019 using dd_map_type = ReadMapType<double>;
0020
0021
0022 class DDMap : public DDBase<DDName, std::unique_ptr<dd_map_type> > {
0023 public:
0024
0025 using value_type = dd_map_type;
0026
0027
0028 using size_t = dd_map_type::size_type;
0029
0030
0031 DDMap();
0032
0033
0034 DDMap(const DDName& name);
0035
0036
0037 DDMap(const DDName& name, std::unique_ptr<dd_map_type> value);
0038
0039
0040 size_t size() const { return rep().size(); }
0041
0042
0043 const dd_map_type& values() const { return rep(); }
0044
0045
0046 const double& operator[](const std::string& name) const {
0047 const dd_map_type& r(rep());
0048 return r[name];
0049 }
0050
0051
0052 value_type::const_iterator mapBegin() const { return rep().begin(); }
0053
0054
0055 value_type::const_iterator mapEnd() const { return rep().end(); }
0056 };
0057 #endif