CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 // $Id: DataKey.h,v 1.7 2006/08/31 23:26:24 wmtan Exp $
20 //
21 
22 // system include files
23 
24 // user include files
27 
28 // forward declarations
29 namespace edm {
30  namespace eventsetup {
31 class DataKey
32 {
33 
34  friend void swap(DataKey&, DataKey&);
35  public:
37 
38  DataKey();
39  DataKey(const TypeTag& iType,
40  const IdTags& iId) :
41  type_(iType),
42  name_(iId),
43  ownMemory_() {
45  }
46 
47  DataKey(const TypeTag& iType,
48  const IdTags& iId,
50  type_(iType),
51  name_(iId),
52  ownMemory_(false) {}
53 
54  DataKey(const DataKey& iRHS) :
55  type_(iRHS.type_),
56  name_(iRHS.name_),
57  ownMemory_() {
59  }
60 
61  const DataKey& operator=(const DataKey&); // stop default
62 
64 
65  // ---------- const member functions ---------------------
66  const TypeTag& type() const { return type_; }
67  const NameTag& name() const { return name_; }
68 
69  bool operator==(const DataKey& iRHS) const;
70  bool operator<(const DataKey& iRHS) const;
71 
72  // ---------- static member functions --------------------
73  template<class T>
74  static TypeTag makeTypeTag() {
75  return heterocontainer::HCTypeTag::make<T>();
76  }
77 
78  // ---------- member functions ---------------------------
79 
80  private:
81  void makeCopyOfMemory();
82  void releaseMemory() {
83  if(ownMemory_) {
84  deleteMemory();
85  ownMemory_ = false;
86  }
87  }
88  void deleteMemory();
89  void swap(DataKey&);
90 
91  // ---------- member data --------------------------------
94  bool ownMemory_;
95 };
96 
97  // Free swap function
98  inline
99  void
101  {
102  a.swap(b);
103  }
104  }
105 }
106 #endif
DataKey(const TypeTag &iType, const IdTags &iId, DoNotCopyMemory)
Definition: DataKey.h:47
static TypeTag makeTypeTag()
Definition: DataKey.h:74
DataKey(const DataKey &iRHS)
Definition: DataKey.h:54
DataKey(const TypeTag &iType, const IdTags &iId)
Definition: DataKey.h:39
bool operator<(const DataKey &iRHS) const
Definition: DataKey.cc:114
void swap(DataKey &a, DataKey &b)
Definition: DataKey.h:100
const DataKey & operator=(const DataKey &)
Definition: DataKey.cc:49
bool operator==(const DataKey &iRHS) const
Definition: DataKey.cc:107
friend void swap(DataKey &, DataKey &)
Definition: DataKey.h:100
double b
Definition: hdecay.h:120
const TypeTag & type() const
Definition: DataKey.h:66
double a
Definition: hdecay.h:121
const NameTag & name() const
Definition: DataKey.h:67