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 $Id: RefItemGet.h,v 1.5 2011/06/29 21:32:30 chrjones Exp $
9 
10 ----------------------------------------------------------------------*/
13 
14 namespace edm {
15 
16  namespace refitem {
17  template< typename C, typename T, typename F, typename KEY>
18  struct GetPtrImpl {
19  static T const* getPtr_(RefCore const& product, KEY const& key) {
20  C const* prod = edm::template getProduct<C>(product);
21  /*
22  typename C::const_iterator it = prod->begin();
23  std::advance(it, item.key());
24  T const* p = it.operator->();
25  */
26  F func;
27  T const* p = func(*prod, key);
28  return p;
29  }
30  };
31  }
32 
33  template <typename C, typename T, typename F, typename KEY>
34  inline
35  T const* getPtr_(RefCore const& product, KEY const& key) {
36  return refitem::GetPtrImpl<C, T, F, KEY>::getPtr_(product, key);
37  }
38 
39  template <typename C, typename T, typename F, typename KEY>
40  inline
41  T const* getPtr(RefCore const& product, KEY const& iKey) {
42  T const* p=refitem::GetPtrImpl<C, T, F, KEY>::getPtr_(product, iKey);
43  return p;
44  }
45 
46 }
47 
48 #endif
T const * getPtr_(RefCore const &product, KEY const &key)
Definition: RefItemGet.h:35
static T const * getPtr_(RefCore const &product, KEY const &key)
Definition: RefItemGet.h:19
T const * getPtr(RefCore const &product, KEY const &iKey)
Definition: RefItemGet.h:41
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