CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
edm::ProductRegistryHelper Class Reference

#include <ProductRegistryHelper.h>

Inheritance diagram for edm::ProductRegistryHelper:
edm::InputSource edm::ProducerBase DQMRootSource dqmservices::DQMProtobufReader edm::PoolSource edm::ProducerSourceBase edm::RawInputSource edm::EDFilter edm::EDProducer edm::global::EDFilterBase edm::global::EDProducerBase edm::one::EDFilterBase edm::one::EDProducerBase edm::stream::EDFilterBase edm::stream::EDProducerBase

Classes

struct  TypeLabelItem
 

Public Types

typedef std::list< TypeLabelItemTypeLabelList
 

Public Member Functions

template<class ProductType >
TypeLabelItem const & produces ()
 declare what type of product will make and with which optional label More...
 
template<class ProductType >
TypeLabelItem const & produces (std::string const &instanceName)
 
template<typename ProductType , BranchType B>
TypeLabelItem const & produces ()
 
template<typename ProductType , BranchType B>
TypeLabelItem const & produces (std::string const &instanceName)
 
template<typename ProductType , Transition B>
TypeLabelItem const & produces ()
 
template<typename ProductType , Transition B>
TypeLabelItem const & produces (std::string const &instanceName)
 
TypeLabelItem const & produces (const TypeID &id, std::string const &instanceName=std::string())
 
template<BranchType B>
TypeLabelItem const & produces (const TypeID &id, std::string const &instanceName=std::string())
 
template<Transition B>
TypeLabelItem const & produces (const TypeID &id, std::string const &instanceName=std::string())
 
 ProductRegistryHelper ()
 
TypeLabelListtypeLabelList ()
 used by the fwk to register the list of products of this module More...
 
 ~ProductRegistryHelper ()
 

Static Public Member Functions

static void addToRegistry (TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, bool iIsListener=false)
 

Private Attributes

TypeLabelList typeLabelList_
 

Detailed Description

Definition at line 19 of file ProductRegistryHelper.h.

Member Typedef Documentation

Definition at line 38 of file ProductRegistryHelper.h.

Constructor & Destructor Documentation

edm::ProductRegistryHelper::ProductRegistryHelper ( )
inline

Definition at line 22 of file ProductRegistryHelper.h.

References ~ProductRegistryHelper().

edm::ProductRegistryHelper::~ProductRegistryHelper ( )

Definition at line 15 of file ProductRegistryHelper.cc.

Referenced by ProductRegistryHelper().

15 { }

Member Function Documentation

void edm::ProductRegistryHelper::addToRegistry ( TypeLabelList::const_iterator const &  iBegin,
TypeLabelList::const_iterator const &  iEnd,
ModuleDescription const &  iDesc,
ProductRegistry iReg,
bool  iIsListener = false 
)
static

Definition at line 22 of file ProductRegistryHelper.cc.

References edm::ProductRegistry::addProduct(), edm::checkClassDictionaries(), edm::checkDictionary(), edm::checkDictionaryOfWrappedType(), edm::convertToBranchType(), edm::BranchDescription::insertBranchAlias(), edm::isEndTransition(), edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), AlCaHLTBitMon_ParallelJobs::p, edm::ModuleDescription::parameterSetID(), edm::ModuleDescription::processName(), AlCaHLTBitMon_QueryRunRegistry::string, and edm::throwMissingDictionariesException().

Referenced by edm::ProducerBase::registerProducts(), edm::InputSource::registerProducts(), and edm::ProducerBase::registrationCallback().

26  {
27 
28  std::vector<std::string> missingDictionaries;
29  std::vector<std::string> producedTypes;
30 
31  for(TypeLabelList::const_iterator p = iBegin; p != iEnd; ++p) {
32 
33  if (!checkDictionary(missingDictionaries, p->typeID_)) {
34  checkDictionaryOfWrappedType(missingDictionaries, p->typeID_);
35  producedTypes.emplace_back(p->typeID_.className());
36  continue;
37  }
38 
39  TypeWithDict type(p->typeID_.typeInfo());
40  BranchDescription pdesc(convertToBranchType(p->transition_),
41  iDesc.moduleLabel(),
42  iDesc.processName(),
43  p->typeID_.userClassName(),
44  p->typeID_.friendlyClassName(),
45  p->productInstanceName_,
46  iDesc.moduleName(),
47  iDesc.parameterSetID(),
48  type,
49  true,
50  isEndTransition(p->transition_));
51 
52  if (pdesc.transient()) {
53  if (!checkDictionary(missingDictionaries, pdesc.wrappedName(), pdesc.wrappedType())) {
54  // It is should be impossible to get here, because the only way to
55  // make it transient is in the line that causes the wrapped dictionary
56  // to be created. Just to be safe I leave this check here ...
57  producedTypes.emplace_back(pdesc.className());
58  continue;
59  }
60  } else {
61  // also check constituents of wrapped types if it is not transient
62  if (!checkClassDictionaries(missingDictionaries, pdesc.wrappedName(), pdesc.wrappedType())) {
63  producedTypes.emplace_back(pdesc.className());
64  continue;
65  }
66  }
67  if (!p->branchAlias_.empty()) pdesc.insertBranchAlias(p->branchAlias_);
68  iReg.addProduct(pdesc, iIsListener);
69  }
70 
71  if (!missingDictionaries.empty()) {
72  std::string context("Calling ProductRegistryHelper::addToRegistry, checking dictionaries for produced types");
73  throwMissingDictionariesException(missingDictionaries, context, producedTypes);
74  }
75  }
type
Definition: HCALResponse.h:21
void throwMissingDictionariesException(std::vector< std::string > &missingDictionaries, std::string const &context)
constexpr bool isEndTransition(Transition iValue)
Definition: Transition.h:31
bool checkDictionary(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
bool checkClassDictionaries(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
bool checkDictionaryOfWrappedType(std::vector< std::string > &missingDictionaries, TypeID const &unwrappedTypeID)
constexpr BranchType convertToBranchType(Transition iValue)
Definition: Transition.h:21
template<class ProductType >
TypeLabelItem const& edm::ProductRegistryHelper::produces ( )
inline

declare what type of product will make and with which optional label

the statement

produces<ProductType>("optlabel");

should be added to the producer ctor for every product

Definition at line 59 of file ProductRegistryHelper.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by GEDPhotonProducer::GEDPhotonProducer(), GoodSeedProducer::GoodSeedProducer(), edm::InputSource::luminosityBlockAuxiliary(), MuonProducer::MuonProducer(), hitTripletEDProducerT::ImplSeedingHitSets::produces(), hitTripletEDProducerT::ImplIntermediateHitTriplets::produces(), VariableNTupler::registerleaves(), and StringBasedNTupler::registerleaves().

59  {
60  return produces<ProductType, InEvent>(std::string());
61  }
template<class ProductType >
TypeLabelItem const& edm::ProductRegistryHelper::produces ( std::string const &  instanceName)
inline

Definition at line 64 of file ProductRegistryHelper.h.

References MuonErrorMatrixAdjuster_cfi::instanceName.

64  {
65  return produces<ProductType, InEvent>(instanceName);
66  }
template<typename ProductType , BranchType B>
TypeLabelItem const& edm::ProductRegistryHelper::produces ( )
inline

Definition at line 69 of file ProductRegistryHelper.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

69  {
70  return produces<ProductType, B>(std::string());
71  }
template<typename ProductType , BranchType B>
TypeLabelItem const& edm::ProductRegistryHelper::produces ( std::string const &  instanceName)
inline

Definition at line 74 of file ProductRegistryHelper.h.

References MuonErrorMatrixAdjuster_cfi::instanceName.

74  {
75  TypeID tid(typeid(ProductType));
76  return produces<B>(tid,instanceName);
77  }
template<typename ProductType , Transition B>
TypeLabelItem const& edm::ProductRegistryHelper::produces ( )
inline

Definition at line 80 of file ProductRegistryHelper.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

80  {
81  return produces<ProductType, B>(std::string());
82  }
template<typename ProductType , Transition B>
TypeLabelItem const& edm::ProductRegistryHelper::produces ( std::string const &  instanceName)
inline

Definition at line 85 of file ProductRegistryHelper.h.

References MuonErrorMatrixAdjuster_cfi::instanceName.

85  {
86  TypeID tid(typeid(ProductType));
87  return produces<B>(tid,instanceName);
88  }
TypeLabelItem const& edm::ProductRegistryHelper::produces ( const TypeID id,
std::string const &  instanceName = std::string() 
)
inline

Definition at line 91 of file ProductRegistryHelper.h.

References hcalTTPDigis_cfi::id, and MuonErrorMatrixAdjuster_cfi::instanceName.

91  {
92  return produces<Transition::Event>(id,instanceName);
93  }
template<BranchType B>
TypeLabelItem const& edm::ProductRegistryHelper::produces ( const TypeID id,
std::string const &  instanceName = std::string() 
)
inline

Definition at line 96 of file ProductRegistryHelper.h.

References TtFullHadDaughter::B, edm::convertToTransition(), MuonErrorMatrixAdjuster_cfi::instanceName, and typeLabelList_.

96  {
98  return *typeLabelList_.rbegin();
99  }
static const std::string B
constexpr Transition convertToTransition(BranchType iValue)
Definition: Transition.h:26
template<Transition B>
TypeLabelItem const& edm::ProductRegistryHelper::produces ( const TypeID id,
std::string const &  instanceName = std::string() 
)
inline

Definition at line 101 of file ProductRegistryHelper.h.

References TtFullHadDaughter::B, MuonErrorMatrixAdjuster_cfi::instanceName, and typeLabelList_.

101  {
102  typeLabelList_.emplace_back(B, id, instanceName);
103  return *typeLabelList_.rbegin();
104  }
static const std::string B
ProductRegistryHelper::TypeLabelList & edm::ProductRegistryHelper::typeLabelList ( )

used by the fwk to register the list of products of this module

Definition at line 17 of file ProductRegistryHelper.cc.

References typeLabelList_.

Referenced by edm::InputSource::luminosityBlockAuxiliary(), edm::ProducerBase::registerProducts(), edm::InputSource::registerProducts(), and edm::ProducerBase::registrationCallback().

17  {
18  return typeLabelList_;
19  }

Member Data Documentation

TypeLabelList edm::ProductRegistryHelper::typeLabelList_
private

Definition at line 107 of file ProductRegistryHelper.h.

Referenced by produces(), and typeLabelList().