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  {
31 
32  friend void swap(DataKey&, DataKey&);
33  public:
35 
36  DataKey();
37  DataKey(const TypeTag& iType,
38  const IdTags& iId) :
39  type_(iType),
40  name_(iId),
41  ownMemory_() {
43  }
44 
45  DataKey(const TypeTag& iType,
46  const IdTags& iId,
48  type_(iType),
49  name_(iId),
50  ownMemory_(false) {}
51 
52  DataKey(const DataKey& iRHS) :
53  type_(iRHS.type_),
54  name_(iRHS.name_),
55  ownMemory_() {
57  }
58 
59  DataKey& operator=(const DataKey&);
60 
62 
63  // ---------- const member functions ---------------------
64  const TypeTag& type() const { return type_; }
65  const NameTag& name() const { return name_; }
66 
67  bool operator==(const DataKey& iRHS) const;
68  bool operator<(const DataKey& iRHS) const;
69 
70  // ---------- static member functions --------------------
71  template<class T>
72  static TypeTag makeTypeTag() {
73  return heterocontainer::HCTypeTag::make<T>();
74  }
75 
76  // ---------- member functions ---------------------------
77 
78  private:
79  void makeCopyOfMemory();
80  void releaseMemory() {
81  if(ownMemory_) {
82  deleteMemory();
83  ownMemory_ = false;
84  }
85  }
86  void deleteMemory();
87  void swap(DataKey&);
88 
89  // ---------- member data --------------------------------
92  bool ownMemory_{false};
93  };
94 
95  // Free swap function
96  inline
97  void
99  {
100  a.swap(b);
101  }
102 }
103 #endif
DataKey(const TypeTag &iType, const IdTags &iId, DoNotCopyMemory)
Definition: DataKey.h:45
static TypeTag makeTypeTag()
Definition: DataKey.h:72
DataKey(const DataKey &iRHS)
Definition: DataKey.h:52
DataKey(const TypeTag &iType, const IdTags &iId)
Definition: DataKey.h:37
bool operator<(const DataKey &iRHS) const
Definition: DataKey.cc:116
DataKey & operator=(const DataKey &)
Definition: DataKey.cc:33
bool operator==(const DataKey &iRHS) const
Definition: DataKey.cc:109
friend void swap(DataKey &, DataKey &)
Definition: DataKey.h:98
double b
Definition: hdecay.h:120
const TypeTag & type() const
Definition: DataKey.h:64
double a
Definition: hdecay.h:121
const NameTag & name() const
Definition: DataKey.h:65