CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RefItemGet.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_RefItemGet_h
2 #define DataFormats_Common_RefItemGet_h
3 
4 /*----------------------------------------------------------------------
5 
6 RefItemGet: Free function to get pointer to a referenced item.
7 
8 
9 ----------------------------------------------------------------------*/
12 
13 namespace edm {
14 
15  namespace refitem {
16  template< typename C, typename T, typename F, typename KEY>
17  struct GetPtrImpl {
18  static T const* getPtr_(RefCore const& product, KEY const& key) {
19  C const* prod = edm::template getProduct<C>(product);
20  /*
21  typename C::const_iterator it = prod->begin();
22  std::advance(it, item.key());
23  T const* p = it.operator->();
24  */
25  F func;
26  T const* p = func(*prod, key);
27  return p;
28  }
29  };
30  }
31 
32  template <typename C, typename T, typename F, typename KEY>
33  inline
34  T const* getPtr_(RefCore const& product, KEY const& key) {
35  return refitem::GetPtrImpl<C, T, F, KEY>::getPtr_(product, key);
36  }
37 
38  template <typename C, typename T, typename F, typename KEY>
39  inline
40  T const* getPtr(RefCore const& product, KEY const& iKey) {
41  T const* p=refitem::GetPtrImpl<C, T, F, KEY>::getPtr_(product, iKey);
42  return p;
43  }
44 
45 }
46 
47 #endif
T const * getPtr_(RefCore const &product, KEY const &key)
Definition: RefItemGet.h:34
static T const * getPtr_(RefCore const &product, KEY const &key)
Definition: RefItemGet.h:18
T const * getPtr(RefCore const &product, KEY const &iKey)
Definition: RefItemGet.h:40
list key
Definition: combine.py:13
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
long double T
def template
Definition: svgfig.py:520