CMS 3D CMS Logo

DDMap.h
Go to the documentation of this file.
1 #ifndef DD_DDMap_h
2 #define DD_DDMap_h
3 
4 #include <iostream>
5 #include <map>
6 #include <memory>
7 #include <string>
8 
12 
13 class DDMap;
14 
16 std::ostream& operator<<(std::ostream& o, const DDMap& cons);
17 
20 
22 class DDMap : public DDBase<DDName, std::unique_ptr<dd_map_type> > {
23 public:
26 
28  using size_t = dd_map_type::size_type;
29 
31  DDMap();
32 
34  DDMap(const DDName& name);
35 
37  DDMap(const DDName& name, std::unique_ptr<dd_map_type> value);
38 
40  size_t size() const { return rep().size(); }
41 
43  const dd_map_type& values() const { return rep(); }
44 
46  const double& operator[](const std::string& name) const {
47  const dd_map_type& r(rep());
48  return r[name];
49  }
50 
52  value_type::const_iterator mapBegin() const { return rep().begin(); }
53 
55  value_type::const_iterator mapEnd() const { return rep().end(); }
56 };
57 #endif // DD_DDMap_h
Definition: DDBase.h:10
const double & operator[](const std::string &name) const
returns the value on position pos; does not check boundaries!
Definition: DDMap.h:46
std::ostream & operator<<(std::ostream &o, const DDMap &cons)
output operator for printing ...
Definition: DDMap.cc:11
value_type::const_iterator mapEnd() const
read-only iterator poining one place after the stored values
Definition: DDMap.h:55
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
const DDI::rep_traits< DDName, std::unique_ptr< dd_map_type > >::reference rep() const
Definition: DDBase.h:64
uint16_t size_type
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
Definition: DDMap.h:22
Definition: value.py:1
ReadMapType< double > dd_map_type
simply a std::map<std::string,double> supporting an addional operator[] const
Definition: DDMap.h:19
const dd_map_type & values() const
the stored values
Definition: DDMap.h:43
value_type::const_iterator mapBegin() const
read-only iterator pointing to the begin of the stored values
Definition: DDMap.h:52
size_t size() const
the size of the array of values
Definition: DDMap.h:40
DDMap()
an uninitialized constant; one can assign an initialized constant to make it valid ...
Definition: DDMap.cc:5