CMS 3D CMS Logo

AssociationMapHelpers.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_AssociationMapKeyVal_h
2 #define DataFormats_Common_AssociationMapKeyVal_h
3 /*
4  *
5  * helper classes for AssociationMap
6  *
7  * \author Luca Lista, INFN
8  *
9  *
10  */
13 
14 #include <utility>
15 
16 namespace edm {
17 
18  class EDProductGetter;
19 
20  namespace helpers {
21  template <typename K, typename V>
22  struct KeyVal {
23  typedef K key_type;
24  typedef V value_type;
25  KeyVal() : key(), val() {}
26  KeyVal(const K& k, const V& v) : key(k), val(v) {}
27  template <typename K_, typename V_>
28  KeyVal(K_&& k, V_&& v) : key(std::forward<K_>(k)), val(std::forward<V_>(v)) {}
29 
30  KeyVal(EDProductGetter const* getter) : key(ProductID(), getter), val(ProductID(), getter) {}
31 
32  K key;
33  V val;
34  };
35 
36  template <typename K>
37  struct Key {
38  typedef K key_type;
39  Key() {}
40  Key(const K& k) : key(k) {}
41  template <typename K_>
42  Key(K_&& k) : key(std::forward<K_>(k)) {}
43 
44  Key(EDProductGetter const* getter) : key(ProductID(), getter) {}
45 
46  K key;
47  };
48 
50  template <typename RP, typename R>
51  void checkRef(const RP& rp, const R& r) {
52  if (rp.id() != r.id()) {
54  }
55  }
56  } // namespace helpers
57 } // namespace edm
58 
59 #endif
edm::errors::InvalidReference
Definition: EDMException.h:39
edm::helpers::Key::Key
Key(EDProductGetter const *getter)
Definition: AssociationMapHelpers.h:44
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::helpers::Key::Key
Key(const K &k)
Definition: AssociationMapHelpers.h:40
edm::helpers::KeyVal
Definition: AssociationMapHelpers.h:22
edm::helpers::Key::key_type
K key_type
Definition: AssociationMapHelpers.h:38
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::helpers::Key
Definition: AssociationMapHelpers.h:37
EDMException.h
edm::EDProductGetter
Definition: EDProductGetter.h:41
edm::helpers::KeyVal::KeyVal
KeyVal(K_ &&k, V_ &&v)
Definition: AssociationMapHelpers.h:28
edm::helpers::checkRef
void checkRef(const RP &rp, const R &r)
throw if r hasn't the same id as rp
Definition: AssociationMapHelpers.h:51
ProductID.h
edm::helpers::Key::Key
Key(K_ &&k)
Definition: AssociationMapHelpers.h:42
dqmdumpme.k
k
Definition: dqmdumpme.py:60
edm::helpers::KeyVal::val
V val
Definition: AssociationMapHelpers.h:33
EDProductGetter
helpers
Definition: makeCompositeCandidate.h:8
edm::helpers::Key::Key
Key()
Definition: AssociationMapHelpers.h:39
cms::cuda::V
uint32_t const T *__restrict__ const uint32_t *__restrict__ int32_t int Histo::index_type cudaStream_t V
Definition: HistoContainer.h:51
edm::helpers::KeyVal::key
K key
Definition: AssociationMapHelpers.h:32
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::helpers::KeyVal::key_type
K key_type
Definition: AssociationMapHelpers.h:23
std
Definition: JetResolutionObject.h:76
edm::helpers::KeyVal::value_type
V value_type
Definition: AssociationMapHelpers.h:24
edm::Exception::throwThis
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:83
edm::helpers::KeyVal::KeyVal
KeyVal()
Definition: AssociationMapHelpers.h:25
dttmaxenums::R
Definition: DTTMax.h:29
edm::helpers::KeyVal::KeyVal
KeyVal(EDProductGetter const *getter)
Definition: AssociationMapHelpers.h:30
edm::ProductID
Definition: ProductID.h:27
edm::helpers::KeyVal::KeyVal
KeyVal(const K &k, const V &v)
Definition: AssociationMapHelpers.h:26
edm::helpers::Key::key
K key
Definition: AssociationMapHelpers.h:46