CMS 3D CMS Logo

DataKey.h
Go to the documentation of this file.
1 #ifndef Framework_DataKey_h
2 #define Framework_DataKey_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class : DataKey
7 //
16 //
17 // Author: Chris Jones
18 // Created: Thu Mar 31 14:31:03 EST 2005
19 //
20 
21 // system include files
22 
23 // user include files
26 
27 // forward declarations
28 namespace edm::eventsetup {
29  class DataKey {
30  friend void swap(DataKey&, DataKey&);
31 
32  public:
34 
35  DataKey();
36  DataKey(const TypeTag& iType, const IdTags& iId) : type_(iType), name_(iId), ownMemory_() { makeCopyOfMemory(); }
37 
38  DataKey(const TypeTag& iType, const IdTags& iId, DoNotCopyMemory) : type_(iType), name_(iId), ownMemory_(false) {}
39 
40  DataKey(const DataKey& iRHS) : type_(iRHS.type_), name_(iRHS.name_), ownMemory_() { makeCopyOfMemory(); }
41 
42  DataKey(DataKey&& iRHS) : type_(iRHS.type_), name_(iRHS.name_), ownMemory_(iRHS.ownMemory_) {
43  iRHS.ownMemory_ = false;
44  }
45 
46  DataKey& operator=(const DataKey&);
48 
50 
51  // ---------- const member functions ---------------------
52  const TypeTag& type() const { return type_; }
53  const NameTag& name() const { return name_; }
54 
55  bool operator==(const DataKey& iRHS) const;
56  inline bool operator!=(const DataKey& iRHS) const { return not(*this == iRHS); }
57  bool operator<(const DataKey& iRHS) const;
58 
59  // ---------- static member functions --------------------
60  template <class T>
61  static TypeTag makeTypeTag() {
62  return heterocontainer::HCTypeTag::make<T>();
63  }
64 
65  // ---------- member functions ---------------------------
66 
67  private:
68  void makeCopyOfMemory();
69  void releaseMemory() {
70  if (ownMemory_) {
71  deleteMemory();
72  ownMemory_ = false;
73  }
74  }
75  void deleteMemory();
76  void swap(DataKey&);
77 
78  // ---------- member data --------------------------------
81  bool ownMemory_{false};
82  };
83 
84  // Free swap function
85  inline void swap(DataKey& a, DataKey& b) { a.swap(b); }
86 } // namespace edm::eventsetup
87 #endif
funct::false
false
Definition: Factorize.h:34
edm::eventsetup::DataKey::makeCopyOfMemory
void makeCopyOfMemory()
Definition: DataKey.cc:80
edm::eventsetup::DataKey::name_
NameTag name_
Definition: DataKey.h:80
edm::eventsetup::DataKey::type_
TypeTag type_
Definition: DataKey.h:79
DataKeyTags.h
edm::eventsetup::DataKey
Definition: DataKey.h:29
edm::eventsetup::DataKey::operator==
bool operator==(const DataKey &iRHS) const
Definition: DataKey.cc:109
edm::eventsetup::DataKey::DataKey
DataKey()
edm::eventsetup::DataKey::DataKey
DataKey(DataKey &&iRHS)
Definition: DataKey.h:42
edm::eventsetup::DataKey::swap
friend void swap(DataKey &, DataKey &)
Definition: DataKey.h:85
edm::eventsetup::DataKey::deleteMemory
void deleteMemory()
Definition: DataKey.cc:100
edm::eventsetup::DataKey::operator=
DataKey & operator=(const DataKey &)
Definition: DataKey.cc:32
edm::eventsetup::DataKey::operator!=
bool operator!=(const DataKey &iRHS) const
Definition: DataKey.h:56
edm::eventsetup::DataKey::name
const NameTag & name() const
Definition: DataKey.h:53
edm::eventsetup::DataKey::operator<
bool operator<(const DataKey &iRHS) const
Definition: DataKey.cc:111
edm::eventsetup::DataKey::ownMemory_
bool ownMemory_
Definition: DataKey.h:81
edm::eventsetup::DataKey::DataKey
DataKey(const TypeTag &iType, const IdTags &iId)
Definition: DataKey.h:36
edm::eventsetup::DataKey::releaseMemory
void releaseMemory()
Definition: DataKey.h:69
b
double b
Definition: hdecay.h:118
edm::eventsetup::DataKey::~DataKey
~DataKey()
Definition: DataKey.h:49
edm::eventsetup::DataKey::makeTypeTag
static TypeTag makeTypeTag()
Definition: DataKey.h:61
edm::eventsetup::DataKey::DoNotCopyMemory
DoNotCopyMemory
Definition: DataKey.h:33
a
double a
Definition: hdecay.h:119
edm::eventsetup::DataKey::DataKey
DataKey(const TypeTag &iType, const IdTags &iId, DoNotCopyMemory)
Definition: DataKey.h:38
edm::eventsetup::heterocontainer::HCTypeTag
Definition: HCTypeTag.h:38
edm::eventsetup::DataKey::DataKey
DataKey(const DataKey &iRHS)
Definition: DataKey.h:40
edm::eventsetup::swap
void swap(DataKey &a, DataKey &b)
Definition: DataKey.h:85
edm::eventsetup::NameTag
Definition: DataKeyTags.h:45
edm::eventsetup::DataKey::kDoNotCopyMemory
Definition: DataKey.h:33
edm::eventsetup
Definition: ES_DDDetector.cc:16
edm::eventsetup::DataKey::type
const TypeTag & type() const
Definition: DataKey.h:52
HCTypeTag.h