23 void throwProducesWithoutAbility(
const char* transitionName,
std::string const& productTypeName) {
25 <<
"Module declares it can produce a product of type \'" << productTypeName <<
"\'\nin a " << transitionName
26 <<
", but does not have the ability to produce in " << transitionName <<
"s.\n" 27 <<
"You must add a template parameter of type " << transitionName <<
"Producer\n" 28 <<
"or " << transitionName <<
"Producer to the EDProducer or EDFilter base class\n" 29 <<
"of the module. Or you could remove the call to the function \'produces\'\n" 30 <<
"(Note legacy modules are not ever allowed to produce in Runs or Lumis)\n";
35 TypeLabelList::const_iterator
const& iEnd,
40 std::vector<std::string> missingDictionaries;
41 std::vector<std::string> producedTypes;
42 std::set<std::tuple<BranchType, std::type_index, std::string>> registeredProducts;
44 for (TypeLabelList::const_iterator
p = iBegin;
p != iEnd; ++
p) {
46 throwProducesWithoutAbility(
"BeginRun",
p->typeID_.userClassName());
48 throwProducesWithoutAbility(
"EndRun",
p->typeID_.userClassName());
50 throwProducesWithoutAbility(
"BeginLuminosityBlock",
p->typeID_.userClassName());
52 throwProducesWithoutAbility(
"EndLuminosityBlock",
p->typeID_.userClassName());
55 throwProducesWithoutAbility(
"BeginProcessBlock",
p->typeID_.userClassName());
57 throwProducesWithoutAbility(
"EndProcessBlock",
p->typeID_.userClassName());
61 producedTypes.emplace_back(
p->typeID_.className());
66 std::tuple<BranchType, std::type_index, std::string>
entry{
67 branchType,
p->typeID_.typeInfo(),
p->productInstanceName_};
68 if (registeredProducts.end() != registeredProducts.find(
entry)) {
73 registeredProducts.insert(
entry);
81 p->typeID_.userClassName(),
82 p->typeID_.friendlyClassName(),
83 p->productInstanceName_,
90 if (
p->branchAlias_.empty()) {
92 <<
"Branch alias type has been set to SwitchAlias, but the alias content is empty.\n" 93 <<
"Please report this error to the FWCore developers";
95 pdesc.setSwitchAliasModuleLabel(
p->branchAlias_);
99 if (pdesc.transient()) {
100 if (!
checkDictionary(missingDictionaries, pdesc.wrappedName(), pdesc.wrappedType())) {
104 producedTypes.emplace_back(pdesc.className());
110 producedTypes.emplace_back(pdesc.className());
114 if (!
p->branchAlias_.empty())
115 pdesc.insertBranchAlias(
p->branchAlias_);
119 if (!missingDictionaries.empty()) {
120 std::string context(
"Calling ProductRegistryHelper::addToRegistry, checking dictionaries for produced types");
void throwMissingDictionariesException(std::vector< std::string > &missingDictionaries, std::string const &context)
TypeLabelList typeLabelList_
virtual ~ProductRegistryHelper() noexcept(false)
std::string const & moduleName() const
static void addToRegistry(TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, ProductRegistryHelper *iProd, bool iIsListener=false)
virtual bool hasAbilityToProduceInEndRuns() const
constexpr bool isEndTransition(Transition iValue)
virtual bool hasAbilityToProduceInBeginLumis() const
ParameterSetID const & parameterSetID() const
std::vector< TypeLabelItem > TypeLabelList
bool checkDictionary(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
virtual bool hasAbilityToProduceInEndProcessBlocks() const
bool checkClassDictionaries(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
TypeLabelList const & typeLabelList() const
used by the fwk to register the list of products of this module
std::string const & processName() const
virtual bool hasAbilityToProduceInBeginProcessBlocks() const
virtual bool hasAbilityToProduceInBeginRuns() const
bool checkDictionaryOfWrappedType(std::vector< std::string > &missingDictionaries, TypeID const &unwrappedTypeID)
virtual bool hasAbilityToProduceInEndLumis() const
std::string const & moduleLabel() const
void addProduct(BranchDescription const &productdesc, bool iFromListener=false)
void setIsMergeable(BranchDescription &)
constexpr BranchType convertToBranchType(Transition iValue)