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 ----------------------------------------------------------------------*/ 00010 00011 #include "FWCore/Framework/interface/ProductRegistryHelper.h" 00012 #include "boost/bind.hpp" 00013 #include "boost/function.hpp" 00014 namespace edm { 00015 class BranchDescription; 00016 class ModuleDescription; 00017 class ProductRegistry; 00018 class ProducerBase : private ProductRegistryHelper { 00019 public: 00020 typedef ProductRegistryHelper::TypeLabelList TypeLabelList; 00021 ProducerBase (); 00022 virtual ~ProducerBase(); 00023 00025 boost::function<void(const BranchDescription&)> registrationCallback() const; 00026 00027 void registerProducts(ProducerBase*, 00028 ProductRegistry*, 00029 ModuleDescription const&); 00030 00031 using ProductRegistryHelper::produces; 00032 using ProductRegistryHelper::typeLabelList; 00033 00034 protected: 00035 template<class TProducer, class TMethod> 00036 void callWhenNewProductsRegistered(TProducer* iProd, TMethod iMethod) { 00037 callWhenNewProductsRegistered_ = boost::bind(iMethod,iProd,_1); 00038 } 00039 00040 private: 00041 boost::function<void(const BranchDescription&)> callWhenNewProductsRegistered_; 00042 }; 00043 00044 00045 } 00046 00047 #endif