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 {
24 public:
27 
29  using size_t = dd_map_type::size_type;
30 
32  DDMap();
33 
35  DDMap(const DDName & name);
36 
38  DDMap(const DDName & name, std::unique_ptr<dd_map_type> value);
39 
41  size_t size() const { return rep().size(); }
42 
44  const dd_map_type & values() const { return rep(); }
45 
47  const double & operator[](const std::string & name) const {
48  const dd_map_type & r(rep());
49  return r[name];
50  }
51 
53  value_type::const_iterator mapBegin() const { return rep().begin(); }
54 
56  value_type::const_iterator mapEnd() const { return rep().end(); }
57 
58 };
59 #endif // DD_DDMap_h
Definition: DDBase.h:10
std::ostream & operator<<(std::ostream &o, const DDMap &cons)
output operator for printing ...
Definition: DDMap.cc:19
value_type::const_iterator mapEnd() const
read-only iterator poining one place after the stored values
Definition: DDMap.h:56
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
uint16_t size_type
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
Definition: DDMap.h:22
const DDI::rep_traits< DDName, std::unique_ptr< dd_map_type > >::reference rep() const
Definition: DDBase.h:80
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
value_type::const_iterator mapBegin() const
read-only iterator pointing to the begin of the stored values
Definition: DDMap.h:53
size_t size() const
the size of the array of values
Definition: DDMap.h:41
const dd_map_type & values() const
the stored values
Definition: DDMap.h:44
const double & operator[](const std::string &name) const
returns the value on position pos; does not check boundaries!
Definition: DDMap.h:47
DDMap()
an uninitialized constant; one can assign an initialized constant to make it valid ...
Definition: DDMap.cc:5