CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/DataFormats/Common/src/WrapperOwningHolder.cc

Go to the documentation of this file.
00001 #include "DataFormats/Common/interface/WrapperOwningHolder.h"
00002 
00003 namespace edm {
00004   WrapperOwningHolder::EDProductDeleter::EDProductDeleter(WrapperInterfaceBase const* interface) : interface_(interface) {}
00005   void WrapperOwningHolder::EDProductDeleter::operator()(void const* wrapper) const {
00006     if(wrapper != 0) {
00007       interface_->deleteProduct(wrapper);
00008     }
00009   }
00010 
00011   WrapperOwningHolder::WrapperOwningHolder() : WrapperHolder(), wrapperOwner_() {}
00012 
00013   WrapperOwningHolder::WrapperOwningHolder(boost::shared_ptr<void const> wrapper, WrapperInterfaceBase const* interface) :
00014       WrapperHolder(wrapper.get(), interface), wrapperOwner_(wrapper) {
00015   }
00016 
00017   WrapperOwningHolder::WrapperOwningHolder(void const* wrapper, WrapperInterfaceBase const* interface) :
00018       WrapperHolder(wrapper, interface),
00019       wrapperOwner_(makeWrapper(wrapper, interface)) {
00020   }
00021 
00022   boost::shared_ptr<void const>
00023   WrapperOwningHolder::makeWrapper(void const* wrapper, WrapperInterfaceBase const* interface) {
00024      return(boost::shared_ptr<void const>(wrapper, EDProductDeleter(interface)));
00025   }
00026 
00027 }