CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
DataKey(const TypeTag &iType, const IdTags &iId, DoNotCopyMemory)
Definition: DataKey.h:38
static TypeTag makeTypeTag()
Definition: DataKey.h:61
DataKey(const DataKey &iRHS)
Definition: DataKey.h:40
DataKey(const TypeTag &iType, const IdTags &iId)
Definition: DataKey.h:36
bool operator<(const DataKey &iRHS) const
Definition: DataKey.cc:111
void swap(DataKey &a, DataKey &b)
Definition: DataKey.h:85
DataKey & operator=(const DataKey &)
Definition: DataKey.cc:32
bool operator==(const DataKey &iRHS) const
Definition: DataKey.cc:109
friend void swap(DataKey &, DataKey &)
Definition: DataKey.h:85
double b
Definition: hdecay.h:118
const TypeTag & type() const
Definition: DataKey.h:52
DataKey(DataKey &&iRHS)
Definition: DataKey.h:42
double a
Definition: hdecay.h:119
const NameTag & name() const
Definition: DataKey.h:53
bool operator!=(const DataKey &iRHS) const
Definition: DataKey.h:56