CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ProducerBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_ProducerBase_h
2 #define FWCore_Framework_ProducerBase_h
3 
4 /*----------------------------------------------------------------------
5 
6 EDProducer: The base class of all "modules" that will insert new
7 EDProducts into an Event.
8 
9 ----------------------------------------------------------------------*/
10 
13 
14 #include <functional>
15 #include <unordered_map>
16 #include <string>
17 #include <vector>
18 #include <array>
19 
20 namespace edm {
21  class BranchDescription;
22  class ModuleDescription;
23  class ProductRegistry;
24  class Event;
25  class LuminosityBlock;
26  class Run;
27 
28  class EDProducer;
29  class EDFilter;
30  namespace one {
31  class EDProducerBase;
32  class EDFilterBase;
33  }
34  namespace global {
35  class EDProducerBase;
36  class EDFilterBase;
37  }
38  namespace stream {
39  template<typename T> class ProducingModuleAdaptorBase;
40  }
41 
42  namespace producerbasehelper{
43  template<typename P> struct PrincipalTraits;
44  template<> struct PrincipalTraits<Run> {
45  static constexpr int kBranchType = InRun;
46  };
47  template<> struct PrincipalTraits<LuminosityBlock> {
48  static constexpr int kBranchType = InLumi;
49  };
50  template<> struct PrincipalTraits<Event> {
51  static constexpr int kBranchType = InEvent;
52  };
53  }
54 
56  public:
58  ProducerBase ();
59  virtual ~ProducerBase() noexcept(false);
60 
63 
66  ModuleDescription const&);
67 
70 
73  }
74 
75  void resolvePutIndicies(BranchType iBranchType,
76  std::unordered_multimap<std::string, edm::ProductResolverIndex> const& iIndicies,
77  std::string const& moduleLabel);
78 
79  std::vector<edm::ProductResolverIndex> const& indiciesForPutProducts(BranchType iBranchType) const {
80  return putIndicies_[iBranchType];
81  }
82  private:
83  friend class EDProducer;
84  friend class EDFilter;
85  friend class one::EDProducerBase;
86  friend class one::EDFilterBase;
87  friend class global::EDProducerBase;
88  friend class global::EDFilterBase;
89  template<typename T> friend class stream::ProducingModuleAdaptorBase;
90 
91  template< typename P>
92  void commit_(P& iPrincipal) {
94  }
95 
96  template< typename P, typename L, typename I>
97  void commit_(P& iPrincipal, L* iList, I* iID) {
99  }
100 
101  std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
102  std::array<std::vector<edm::ProductResolverIndex>, edm::NumBranchTypes> putIndicies_;
103  };
104 }
105 #endif
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: ProducerBase.h:71
std::list< TypeLabelItem > TypeLabelList
Definition: vlib.h:256
ProductRegistryHelper::TypeLabelList TypeLabelList
Definition: ProducerBase.h:57
void registerProducts(ProducerBase *, ProductRegistry *, ModuleDescription const &)
Definition: ProducerBase.cc:60
#define noexcept
#define P
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
Definition: ProducerBase.h:101
std::array< std::vector< edm::ProductResolverIndex >, edm::NumBranchTypes > putIndicies_
Definition: ProducerBase.h:102
#define constexpr
BranchType
Definition: BranchType.h:11
Definition: Event.h:16
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts(BranchType iBranchType) const
Definition: ProducerBase.h:79
TypeLabelList & typeLabelList()
used by the fwk to register the list of products of this module
void resolvePutIndicies(BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
Definition: ProducerBase.cc:85
TypeLabelItem const & produces()
declare what type of product will make and with which optional label
const std::complex< double > I
Definition: I.h:8
void commit_(P &iPrincipal, L *iList, I *iID)
Definition: ProducerBase.h:97
std::function< void(BranchDescription const &)> registrationCallback() const
used by the fwk to register list of products
Definition: ProducerBase.cc:18
void commit_(P &iPrincipal)
Definition: ProducerBase.h:92
volatile std::atomic< bool > shutdown_flag false
virtual ~ProducerBase() noexcept(false)
Definition: ProducerBase.cc:16
Definition: Run.h:42