CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
edm::ProducerBase Class Reference

#include <ProducerBase.h>

Inheritance diagram for edm::ProducerBase:
edm::ProductRegistryHelper edm::EDFilter edm::EDProducer edm::global::EDFilterBase edm::global::EDProducerBase edm::limited::EDFilterBase edm::limited::EDProducerBase edm::one::EDFilterBase edm::one::EDProducerBase edm::PuttableSourceBase edm::stream::EDFilterBase edm::stream::EDProducerBase

Public Types

using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 

Public Member Functions

void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 

Private Member Functions

template<typename P >
void commit_ (P &iPrincipal)
 
template<typename P , typename I >
void commit_ (P &iPrincipal, I *iID)
 
- Private Member Functions inherited from edm::ProductRegistryHelper
virtual bool hasAbilityToProduceInLumis () const
 
virtual bool hasAbilityToProduceInRuns () const
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
 ProductRegistryHelper ()
 
std::vector< bool > const & recordProvenanceList () const
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
virtual ~ProductRegistryHelper () noexcept(false)
 

Private Attributes

std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
 
std::array< std::vector< edm::ProductResolverIndex >, edm::NumBranchTypesputIndicies_
 
std::vector< edm::ProductResolverIndexputTokenToResolverIndex_
 

Friends

class EDFilter
 
class EDProducer
 
class global::EDFilterBase
 
class global::EDProducerBase
 
class limited::EDFilterBase
 
class limited::EDProducerBase
 
class one::EDFilterBase
 
class one::EDProducerBase
 
class PuttableSourceBase
 
template<typename T >
class stream::ProducingModuleAdaptorBase
 

Additional Inherited Members

- Private Types inherited from edm::ProductRegistryHelper
typedef std::vector< TypeLabelItemTypeLabelList
 
- Static Private Member Functions inherited from edm::ProductRegistryHelper
static void addToRegistry (TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, ProductRegistryHelper *iProd, bool iIsListener=false)
 

Detailed Description

Definition at line 64 of file ProducerBase.h.

Member Typedef Documentation

using edm::ProducerBase::ModuleToResolverIndicies = std::unordered_multimap<std::string, std::tuple<edm::TypeID const*, const char*, edm::ProductResolverIndex>>

Definition at line 84 of file ProducerBase.h.

Definition at line 66 of file ProducerBase.h.

Constructor & Destructor Documentation

edm::ProducerBase::ProducerBase ( )

Definition at line 15 of file ProducerBase.cc.

std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
Definition: ProducerBase.h:120
edm::ProducerBase::~ProducerBase ( )
overridenoexcept

Definition at line 16 of file ProducerBase.cc.

16 {}

Member Function Documentation

void edm::ProducerBase::callWhenNewProductsRegistered ( std::function< void(BranchDescription const &)> const &  func)
inline
template<typename P >
void edm::ProducerBase::commit_ ( P iPrincipal)
inlineprivate

Definition at line 111 of file ProducerBase.h.

Referenced by edm::PuttableSourceBase::doBeginLumi(), edm::EDProducer::doBeginLuminosityBlock(), edm::EDFilter::doBeginLuminosityBlock(), edm::one::EDProducerBase::doBeginLuminosityBlock(), edm::one::EDFilterBase::doBeginLuminosityBlock(), edm::limited::EDProducerBase::doBeginLuminosityBlock(), edm::global::EDProducerBase::doBeginLuminosityBlock(), edm::limited::EDFilterBase::doBeginLuminosityBlock(), edm::global::EDFilterBase::doBeginLuminosityBlock(), edm::PuttableSourceBase::doBeginRun(), edm::EDProducer::doBeginRun(), edm::EDFilter::doBeginRun(), edm::one::EDProducerBase::doBeginRun(), edm::one::EDFilterBase::doBeginRun(), edm::limited::EDProducerBase::doBeginRun(), edm::global::EDProducerBase::doBeginRun(), edm::limited::EDFilterBase::doBeginRun(), edm::global::EDFilterBase::doBeginRun(), edm::EDProducer::doEndLuminosityBlock(), edm::EDFilter::doEndLuminosityBlock(), edm::one::EDProducerBase::doEndLuminosityBlock(), edm::one::EDFilterBase::doEndLuminosityBlock(), edm::limited::EDProducerBase::doEndLuminosityBlock(), edm::global::EDProducerBase::doEndLuminosityBlock(), edm::limited::EDFilterBase::doEndLuminosityBlock(), edm::global::EDFilterBase::doEndLuminosityBlock(), edm::EDProducer::doEndRun(), edm::EDFilter::doEndRun(), edm::one::EDProducerBase::doEndRun(), edm::one::EDFilterBase::doEndRun(), edm::limited::EDProducerBase::doEndRun(), edm::global::EDProducerBase::doEndRun(), edm::limited::EDFilterBase::doEndRun(), edm::global::EDFilterBase::doEndRun(), edm::EDProducer::doEvent(), edm::EDFilter::doEvent(), edm::global::EDFilterBase::doEvent(), edm::one::EDFilterBase::doEvent(), edm::one::EDProducerBase::doEvent(), edm::global::EDProducerBase::doEvent(), edm::limited::EDFilterBase::doEvent(), and edm::limited::EDProducerBase::doEvent().

111  {
112  iPrincipal.commit_(putIndicies_[producerbasehelper::PrincipalTraits<P>::kBranchType]);
113  }
std::array< std::vector< edm::ProductResolverIndex >, edm::NumBranchTypes > putIndicies_
Definition: ProducerBase.h:121
template<typename P , typename I >
void edm::ProducerBase::commit_ ( P iPrincipal,
I *  iID 
)
inlineprivate

Definition at line 116 of file ProducerBase.h.

116  {
117  iPrincipal.commit_(putIndicies_[producerbasehelper::PrincipalTraits<P>::kBranchType], iID);
118  }
std::array< std::vector< edm::ProductResolverIndex >, edm::NumBranchTypes > putIndicies_
Definition: ProducerBase.h:121
std::vector<edm::ProductResolverIndex> const& edm::ProducerBase::indiciesForPutProducts ( BranchType  iBranchType) const
inline

Definition at line 89 of file ProducerBase.h.

Referenced by edm::WorkerT< T >::updateLookup().

89  {
90  return putIndicies_[iBranchType];
91  }
std::array< std::vector< edm::ProductResolverIndex >, edm::NumBranchTypes > putIndicies_
Definition: ProducerBase.h:121
std::vector<edm::ProductResolverIndex> const& edm::ProducerBase::putTokenIndexToProductResolverIndex ( ) const
inline
void edm::ProducerBase::registerProducts ( ProducerBase producer,
ProductRegistry iReg,
ModuleDescription const &  md 
)

Definition at line 56 of file ProducerBase.cc.

References edm::ProductRegistryHelper::addToRegistry(), edm::ProductRegistry::callForEachBranch(), relativeConstraints::empty, registrationCallback(), and edm::ProductRegistryHelper::typeLabelList().

56  {
58  return;
59  }
60  //If we have a callback, first tell the callback about all the entries already in the
61  // product registry, then add any items this producer wants to add to the registry
62  // and only after that do we register the callback. This is done so the callback does not
63  // get called for items registered by this producer (avoids circular reference problems)
64  bool isListener = false;
65  if (registrationCallback()) {
66  isListener = true;
67  iReg->callForEachBranch(registrationCallback());
68  }
69  TypeLabelList const& plist = typeLabelList();
70 
71  ProductRegistryHelper::addToRegistry(plist.begin(), plist.end(), md, *(iReg), this, isListener);
72  if (registrationCallback()) {
74  regService->watchProductAdditions(CallbackWrapper(producer, registrationCallback(), iReg, md));
75  }
76  }
TypeLabelList const & typeLabelList() const
used by the fwk to register the list of products of this module
ProductRegistryHelper::TypeLabelList TypeLabelList
Definition: ProducerBase.h:66
static void addToRegistry(TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, ProductRegistryHelper *iProd, bool iIsListener=false)
std::function< void(BranchDescription const &)> registrationCallback() const
used by the fwk to register list of products
Definition: ProducerBase.cc:18
std::function< void(BranchDescription const &)> edm::ProducerBase::registrationCallback ( ) const

used by the fwk to register list of products

Definition at line 18 of file ProducerBase.cc.

References edm::ProductRegistryHelper::addToRegistry(), callWhenNewProductsRegistered_, RecoTauPiZeroBuilderPlugins_cfi::function, and edm::ProductRegistryHelper::typeLabelList().

Referenced by registerProducts().

18  {
20  }
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
Definition: ProducerBase.h:120
void edm::ProducerBase::resolvePutIndicies ( BranchType  iBranchType,
ModuleToResolverIndicies const &  iIndicies,
std::string const &  moduleLabel 
)

Definition at line 78 of file ProducerBase.cc.

References edm::convertToBranchType(), mps_fire::i, SiStripPI::max, putIndicies_, putTokenToResolverIndex_, and edm::ProductRegistryHelper::typeLabelList().

Referenced by edm::PuttableSourceBase::beginJob(), and edm::WorkerT< T >::updateLookup().

80  {
81  auto const& plist = typeLabelList();
82  if (putTokenToResolverIndex_.size() != plist.size()) {
84  }
85  auto range = iIndicies.equal_range(moduleLabel);
86  putIndicies_[iBranchType].reserve(iIndicies.count(moduleLabel));
87  for (auto it = range.first; it != range.second; ++it) {
88  putIndicies_[iBranchType].push_back(std::get<2>(it->second));
89  unsigned int i = 0;
90  for (auto const& tl : plist) {
91  if (convertToBranchType(tl.transition_) == iBranchType and (tl.typeID_ == *std::get<0>(it->second)) and
92  (tl.productInstanceName_ == std::get<1>(it->second))) {
93  putTokenToResolverIndex_[i] = std::get<2>(it->second);
94  //NOTE: The ExternalLHEProducer puts the 'same' product in at
95  // both beginRun and endRun. Therefore we can get multiple matches.
96  // When the module is finally fixed, we can use the 'break'
97  //break;
98  }
99  ++i;
100  }
101  }
102  }
TypeLabelList const & typeLabelList() const
used by the fwk to register the list of products of this module
std::array< std::vector< edm::ProductResolverIndex >, edm::NumBranchTypes > putIndicies_
Definition: ProducerBase.h:121
std::vector< edm::ProductResolverIndex > putTokenToResolverIndex_
Definition: ProducerBase.h:122
constexpr BranchType convertToBranchType(Transition iValue)
Definition: Transition.h:15

Friends And Related Function Documentation

friend class EDFilter
friend

Definition at line 99 of file ProducerBase.h.

friend class EDProducer
friend

Definition at line 98 of file ProducerBase.h.

friend class global::EDFilterBase
friend

Definition at line 103 of file ProducerBase.h.

friend class global::EDProducerBase
friend

Definition at line 102 of file ProducerBase.h.

friend class limited::EDFilterBase
friend

Definition at line 105 of file ProducerBase.h.

friend class limited::EDProducerBase
friend

Definition at line 104 of file ProducerBase.h.

friend class one::EDFilterBase
friend

Definition at line 101 of file ProducerBase.h.

friend class one::EDProducerBase
friend

Definition at line 100 of file ProducerBase.h.

friend class PuttableSourceBase
friend

Definition at line 106 of file ProducerBase.h.

template<typename T >
friend class stream::ProducingModuleAdaptorBase
friend

Definition at line 108 of file ProducerBase.h.

Member Data Documentation

std::function<void(BranchDescription const&)> edm::ProducerBase::callWhenNewProductsRegistered_
private

Definition at line 120 of file ProducerBase.h.

Referenced by registrationCallback().

std::array<std::vector<edm::ProductResolverIndex>, edm::NumBranchTypes> edm::ProducerBase::putIndicies_
private

Definition at line 121 of file ProducerBase.h.

Referenced by resolvePutIndicies().

std::vector<edm::ProductResolverIndex> edm::ProducerBase::putTokenToResolverIndex_
private

Definition at line 122 of file ProducerBase.h.

Referenced by resolvePutIndicies().