CMS 3D CMS Logo

DDName.h
Go to the documentation of this file.
1 #ifndef DETECTOR_DESCRIPTION_CORE_DDNAME_H
2 #define DETECTOR_DESCRIPTION_CORE_DDNAME_H
3 
4 #include <iosfwd>
5 #include <string>
6 #include <utility>
7 #include <tbb/concurrent_vector.h>
8 #include <tbb/concurrent_unordered_map.h>
9 
10 class DDCurrentNamespace;
11 
13 
15 class DDName {
16 public:
17  using id_type = int;
18  using Registry = tbb::concurrent_unordered_map<std::pair<std::string, std::string>, id_type>;
19  using IdToName = tbb::concurrent_vector<Registry::const_iterator>;
20 
22  DDName(const std::string& name, const std::string& ns);
23 
25  DDName(const std::string& name);
26  DDName(const char* name);
27  DDName(const char* name, const char* ns);
28 
29  explicit DDName();
30 
32  const std::string& name() const;
33 
35  const std::string& ns() const;
36 
40  const std::string fullname() const { return ns() + ":" + name(); }
41 
42  id_type id() const { return id_; }
43 
44  bool operator<(const DDName& rhs) const { return id_ < rhs.id_; }
45  bool operator==(const DDName& rhs) const { return id_ == rhs.id_; }
46 
47 private:
49 
50  static Registry::const_iterator registerName(const std::pair<std::string, std::string>& s);
51 };
52 
53 std::ostream& operator<<(std::ostream& os, const DDName& n);
54 
55 #endif
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDCurrentNamespace
Definition: DDCurrentNamespace.h:6
DDName::id
id_type id() const
Definition: DDName.h:42
operator<<
std::ostream & operator<<(std::ostream &os, const DDName &n)
Definition: DDName.cc:11
DDName::operator<
bool operator<(const DDName &rhs) const
Definition: DDName.h:44
alignCSCRings.s
s
Definition: alignCSCRings.py:92
DDName::id_type
int id_type
Definition: DDName.h:17
DDName::DDName
DDName()
Definition: DDName.cc:39
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDName::id_
id_type id_
Definition: DDName.h:48
DDName::operator==
bool operator==(const DDName &rhs) const
Definition: DDName.h:45
createfilelist.int
int
Definition: createfilelist.py:10
DDName::name
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
DDName::Registry
tbb::concurrent_unordered_map< std::pair< std::string, std::string >, id_type > Registry
Definition: DDName.h:18
DDName::registerName
static Registry::const_iterator registerName(const std::pair< std::string, std::string > &s)
Definition: DDName.cc:67
DDName::ns
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:52
DDName::fullname
const std::string fullname() const
Definition: DDName.h:40
DDName::IdToName
tbb::concurrent_vector< Registry::const_iterator > IdToName
Definition: DDName.h:19