12 void checkAndInsertAlias(
std::string const& friendlyClassName,
18 ProductRegistry
const& preg,
19 std::multimap<BranchKey, BranchKey>& aliasMap,
20 std::map<BranchKey, BranchKey>& aliasKeys) {
24 if (preg.productList().find(
key) == preg.productList().end()) {
27 for (
auto const& product : preg.productList()) {
30 <<
"There are no products of type '" << friendlyClassName <<
"'\n" 31 <<
"with module label '" <<
moduleLabel <<
"' and instance name '" << productInstanceName <<
"'.\n";
36 if (
auto iter = aliasMap.find(
key); iter != aliasMap.end()) {
38 if (iter->second.moduleLabel() ==
alias) {
40 <<
"The module label alias '" <<
alias <<
"' is used for multiple products of type '" << friendlyClassName
41 <<
"' with module label '" <<
moduleLabel <<
"' and instance name '" << productInstanceName
42 <<
"'. One alias has the instance name '" << iter->first.productInstanceName()
43 <<
"' and the other has the instance name '" << instanceAlias <<
"'.";
47 std::string const& theInstanceAlias(instanceAlias == star ? productInstanceName : instanceAlias);
49 if (
auto it = preg.productList().find(aliasKey); it != preg.productList().end()) {
51 if (not it->second.isAlias()) {
53 <<
"A product of type '" << friendlyClassName <<
"'\n" 54 <<
"with module label '" <<
alias <<
"' and instance name '" << theInstanceAlias <<
"'\n" 55 <<
"already exists.\n";
59 auto iter = aliasKeys.find(aliasKey);
60 if (iter != aliasKeys.end()) {
62 if (iter->second !=
key) {
64 <<
"The module label alias '" <<
alias <<
"' and product instance alias '" << theInstanceAlias <<
"'\n" 65 <<
"are used for multiple products of type '" << friendlyClassName <<
"'\n" 66 <<
"One has module label '" <<
moduleLabel <<
"' and product instance name '" << productInstanceName
68 <<
"the other has module label '" << iter->second.moduleLabel() <<
"' and product instance name '" 69 << iter->second.productInstanceName() <<
"'.\n";
72 auto prodIter = preg.productList().find(
key);
73 if (prodIter != preg.productList().end()) {
74 if (!prodIter->second.produced()) {
76 <<
"The module label alias '" <<
alias <<
"' and product instance alias '" << theInstanceAlias <<
"'\n" 77 <<
"are used for a product of type '" << friendlyClassName <<
"'\n" 78 <<
"with module label '" <<
moduleLabel <<
"' and product instance name '" << productInstanceName
80 <<
"An EDAlias can only be used for products produced in the current process. This one is not.\n";
82 aliasMap.insert(std::make_pair(
key, aliasKey));
83 aliasKeys.insert(std::make_pair(aliasKey,
key));
91 std::unordered_set<std::string>
const& aliasModulesToProcess,
95 if (aliasNamesToProcess.empty()) {
105 std::multimap<BranchKey, BranchKey> aliasMap;
107 std::map<BranchKey, BranchKey> aliasKeys;
110 std::multimap<std::string, BranchKey> moduleLabelToBranches;
113 moduleLabelToBranches.emplace(
prod.first.moduleLabel(),
prod.first);
122 if (not aliasModulesToProcess.empty() and
123 aliasModulesToProcess.find(
moduleLabel) == aliasModulesToProcess.end()) {
134 if (friendlyClassName == star) {
135 bool processHasLabel =
false;
137 for (
auto it = moduleLabelToBranches.lower_bound(
moduleLabel);
138 it != moduleLabelToBranches.end() && it->first ==
moduleLabel;
140 processHasLabel =
true;
141 if (productInstanceName != star and productInstanceName != it->second.productInstanceName()) {
146 checkAndInsertAlias(it->second.friendlyClassName(),
148 it->second.productInstanceName(),
156 if (not
match and processHasLabel) {
162 <<
"There are no products with module label '" <<
moduleLabel <<
"' and product instance name '" 163 << productInstanceName <<
"'.\n";
165 }
else if (productInstanceName == star) {
168 for (ProductRegistry::ProductList::const_iterator it = preg.
productList().lower_bound(lowerBound);
169 it != preg.
productList().end() && it->first.friendlyClassName() == friendlyClassName &&
177 checkAndInsertAlias(friendlyClassName,
179 it->first.productInstanceName(),
193 <<
"There are no products of type '" << friendlyClassName <<
"'\n" 199 checkAndInsertAlias(friendlyClassName,
214 for (
auto const& aliasEntry : aliasMap) {
216 ProductRegistry::ProductList::const_iterator it = preg.
productList().find(aliasEntry.first);
218 preg.
addLabelAlias(it->second, aliasEntry.second.moduleLabel(), aliasEntry.second.productInstanceName());
T getParameter(std::string const &) const
ProductList const & productList() const
std::vector< ParameterSet > VParameterSet
ParameterSet const & getParameterSet(std::string const &) const
void addLabelAlias(BranchDescription const &productdesc, std::string const &labelAlias, std::string const &instanceAlias)
void processEDAliases(std::vector< std::string > const &aliasNamesToProcess, std::unordered_set< std::string > const &aliasModulesToProcess, ParameterSet const &proc_pset, std::string const &processName, ProductRegistry &preg)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)