00001 #ifndef DataFormats_Common_WrapperOwningHolder_h 00002 #define DataFormats_Common_WrapperOwningHolder_h 00003 00004 /*---------------------------------------------------------------------- 00005 00006 ----------------------------------------------------------------------*/ 00007 00008 #include "DataFormats/Common/interface/WrapperHolder.h" 00009 00010 #include "boost/shared_ptr.hpp" 00011 00012 namespace edm { 00013 class WrapperOwningHolder : private WrapperHolder { 00014 public: 00015 struct EDProductDeleter { 00016 explicit EDProductDeleter(WrapperInterfaceBase const* interface); 00017 void operator()(void const* wrapper) const; 00018 WrapperInterfaceBase const* interface_; 00019 }; 00020 00021 WrapperOwningHolder(); 00022 00023 WrapperOwningHolder(void const* wrapper, WrapperInterfaceBase const* interface); 00024 00025 WrapperOwningHolder(boost::shared_ptr<void const> wrapper, WrapperInterfaceBase const* interface); 00026 00027 boost::shared_ptr<void const> makeWrapper(void const* wrapper, WrapperInterfaceBase const* interface); 00028 00029 using WrapperHolder::dynamicTypeInfo; 00030 using WrapperHolder::fillPtrVector; 00031 using WrapperHolder::fillView; 00032 using WrapperHolder::hasIsProductEqual; 00033 using WrapperHolder::interface; 00034 using WrapperHolder::isMergeable; 00035 using WrapperHolder::isPresent; 00036 using WrapperHolder::isProductEqual; 00037 using WrapperHolder::isValid; 00038 using WrapperHolder::mergeProduct; 00039 using WrapperHolder::setPtr; 00040 using WrapperHolder::wrappedTypeInfo; 00041 using WrapperHolder::wrapper; 00042 00043 boost::shared_ptr<void const> product() const { 00044 return wrapperOwner_; 00045 } 00046 00047 void reset() { 00048 WrapperHolder::reset(); 00049 wrapperOwner_.reset(); 00050 } 00051 00052 private: 00053 boost::shared_ptr<void const> wrapperOwner_; 00054 }; 00055 00056 } 00057 #endif