CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:84
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t V
KeyVal(const K &k, const V &v)
Key(EDProductGetter const *getter)
void checkRef(const RP &rp, const R &r)
throw if r hasn&#39;t the same id as rp
KeyVal(EDProductGetter const *getter)