Go to the documentation of this file.00001 #ifndef DataFormats_Common_RefItemGet_h
00002 #define DataFormats_Common_RefItemGet_h
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "DataFormats/Common/interface/RefCore.h"
00012 #include "DataFormats/Common/interface/RefCoreGet.h"
00013
00014 namespace edm {
00015
00016 namespace refitem {
00017 template< typename C, typename T, typename F, typename KEY>
00018 struct GetPtrImpl {
00019 static T const* getPtr_(RefCore const& product, KEY const& key) {
00020 C const* prod = edm::template getProduct<C>(product);
00021
00022
00023
00024
00025
00026 F func;
00027 T const* p = func(*prod, key);
00028 return p;
00029 }
00030 };
00031 }
00032
00033 template <typename C, typename T, typename F, typename KEY>
00034 inline
00035 T const* getPtr_(RefCore const& product, KEY const& key) {
00036 return refitem::GetPtrImpl<C, T, F, KEY>::getPtr_(product, key);
00037 }
00038
00039 template <typename C, typename T, typename F, typename KEY>
00040 inline
00041 T const* getPtr(RefCore const& product, KEY const& iKey) {
00042 T const* p=refitem::GetPtrImpl<C, T, F, KEY>::getPtr_(product, iKey);
00043 return p;
00044 }
00045
00046 }
00047
00048 #endif