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 <string>
7 
11 
12 class DDMap;
13 
15 std::ostream & operator<<(std::ostream & o, const DDMap & cons);
16 
19 
21 class DDMap : public DDBase<DDName, dd_map_type* >
22 {
23 public:
26 
29 
31  DDMap();
32 
34  DDMap(const DDName & name);
35 
37  DDMap(const DDName & name, 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 };
58 #endif // DD_DDMap_h
Definition: DDBase.h:10
const DDI::rep_traits< DDName, dd_map_type * >::reference rep() const
Definition: DDBase.h:84
const DDName & name() const
Definition: DDBase.h:78
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:55
ReadMapType< double > dd_map_type
simply a std::map<std::string,double> supporting an addional operator[] const
Definition: DDMap.h:18
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:21
Definition: value.py:1
dd_map_type value_type
the type of the managed object
Definition: DDMap.h:25
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
const dd_map_type & values() const
the stored values
Definition: DDMap.h:43
dd_map_type::size_type size_t
size type for the size of the stored values
Definition: DDMap.h:28
const double & operator[](const std::string &name) const
returns the value on position pos; does not check boundaries!
Definition: DDMap.h:46
DDMap()
an uninitialized constant; one can assign an initialized constant to make it valid ...
Definition: DDMap.cc:7