CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/FWCore/Framework/interface/ProducerBase.h

Go to the documentation of this file.
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 
00013 #include <functional>
00014 
00015 namespace edm {
00016   class BranchDescription;
00017   class ModuleDescription;
00018   class ProductRegistry;
00019   
00020   class EDProducer;
00021   class EDFilter;
00022   namespace one {
00023     class EDProducerBase;
00024     class EDFilterBase;
00025   }
00026   
00027   class ProducerBase : private ProductRegistryHelper {
00028   public:
00029     typedef ProductRegistryHelper::TypeLabelList TypeLabelList;
00030     ProducerBase ();
00031     virtual ~ProducerBase();
00032  
00034     std::function<void(BranchDescription const&)> registrationCallback() const;
00035 
00036     void registerProducts(ProducerBase*,
00037                         ProductRegistry*,
00038                         ModuleDescription const&);
00039 
00040     using ProductRegistryHelper::produces;
00041     using ProductRegistryHelper::typeLabelList;
00042 
00043   protected:
00044     void callWhenNewProductsRegistered(std::function<void(BranchDescription const&)> const& func) {
00045        callWhenNewProductsRegistered_ = func;
00046     }
00047           
00048   private:
00049     friend class EDProducer;
00050     friend class EDFilter;
00051     friend class one::EDProducerBase;
00052     friend class one::EDFilterBase;
00053     
00054     template< typename P>
00055     void commit_(P& iPrincipal) {
00056       iPrincipal.commit_();
00057     }
00058 
00059     template< typename P, typename L, typename I>
00060     void commit_(P& iPrincipal, L* iList, I* iID) {
00061       iPrincipal.commit_(iList,iID);
00062     }
00063 
00064     std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
00065   };
00066 }
00067 #endif