![]() |
![]() |
00001 #ifndef FWCore_Framework_ProducerBase_h 00002 #define FWCore_Framework_ProducerBase_h 00003 00004 /*---------------------------------------------------------------------- 00005 00006 EDProducer: The base class of all "modules" that will insert new 00007 EDProducts into an Event. 00008 00009 $Id: ProducerBase.h,v 1.6 2008/06/24 23:25:11 wmtan Exp $ 00010 00011 00012 ----------------------------------------------------------------------*/ 00013 00014 #include "FWCore/Framework/interface/ProductRegistryHelper.h" 00015 #include "boost/bind.hpp" 00016 #include "boost/function.hpp" 00017 #include "boost/shared_ptr.hpp" 00018 #include <string> 00019 namespace edm { 00020 class BranchDescription; 00021 class ModuleDescription; 00022 class ProductRegistry; 00023 class ProducerBase : private ProductRegistryHelper { 00024 public: 00025 typedef ProductRegistryHelper::TypeLabelList TypeLabelList; 00026 ProducerBase (); 00027 virtual ~ProducerBase(); 00028 00030 boost::function<void(const BranchDescription&)> registrationCallback() const; 00031 00032 void registerProducts(boost::shared_ptr<ProducerBase>, 00033 ProductRegistry *, 00034 ModuleDescription const&); 00035 00036 using ProductRegistryHelper::produces; 00037 using ProductRegistryHelper::typeLabelList; 00038 00039 protected: 00040 template<class TProducer, class TMethod> 00041 void callWhenNewProductsRegistered(TProducer* iProd, TMethod iMethod) { 00042 callWhenNewProductsRegistered_ = boost::bind(iMethod,iProd,_1); 00043 } 00044 00045 private: 00046 boost::function<void(const BranchDescription&)> callWhenNewProductsRegistered_; 00047 }; 00048 00049 00050 } 00051 00052 #endif