CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ConvertHandle.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_ConvertHandle_h
2 #define DataFormats_Common_ConvertHandle_h
3 
7 
8 #include <typeinfo>
9 
10 namespace edm {
11 
12  namespace handleimpl {
13  void throwInvalidReference();
14  void throwConvertTypeError(std::type_info const& expected, std::type_info const& actual);
15  }
16 
17  // Convert from handle-to-void to handle-to-T
18  template<typename T>
20  Handle<T>& result) {
21  if(bh.failedToGet()) {
22  Handle<T> h(std::move(bh.whyFailedFactory()));
23  result = std::move(h);
24  return;
25  }
26  void const* basicWrapper = bh.wrapper();
27  if(basicWrapper == 0) {
29  }
30  if(!(bh.wrapper()->dynamicTypeInfo() == typeid(T))) {
31  handleimpl::throwConvertTypeError(typeid(T), bh.wrapper()->dynamicTypeInfo());
32  }
33  Wrapper<T> const* wrapper = static_cast<Wrapper<T> const*>(basicWrapper);
34 
35  Handle<T> h(wrapper->product(), bh.provenance());
36  h.swap(result);
37  }
38 }
39 
40 #endif
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
tuple result
Definition: mps_fire.py:83
void throwConvertTypeError(std::type_info const &expected, std::type_info const &actual)
def move
Definition: eostools.py:510
void convert_handle(BasicHandle &&bh, Handle< T > &result)
Definition: ConvertHandle.h:19
void throwInvalidReference()
Definition: ConvertHandle.cc:6
T const * product() const
Definition: Wrapper.h:32
string const
Definition: compareJSON.py:14
long double T
static HepMC::HEPEVT_Wrapper wrapper