79 if (iTag.
label().empty()) {
97 const size_t labelSize = iTag.
label().size();
98 const size_t productInstanceSize = iTag.
instance().size();
100 unsigned short delta1 = labelSize + 1;
101 unsigned short delta2 = labelSize + 2 + productInstanceSize;
107 const size_t additionalSize = skipCurrentProcess ? labelSize + productInstanceSize + 3
108 : labelSize + productInstanceSize + iTag.
process().size() + 3;
126 if (!skipCurrentProcess) {
138 bool iPrefetchMayGet) {
145 ++itInfo, ++itKind, ++itLabels) {
146 if (itInfo->m_branchType == iBranchType) {
147 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
154 itInfo->m_index.skipCurrentProcess());
174 for (
unsigned int j = 0;
j !=
matches.numberOfMatches(); ++
j) {
190 if (iPrefetchMayGet) {
196 unsigned int index = 0;
198 auto indexInRecord = iPI.
indexInRecord(it->m_record, it->m_key);
200 const char* componentName = &(
m_tokenLabels[it->m_startOfComponentName]);
201 if (*componentName) {
202 auto component = iPI.
component(it->m_record, it->m_key);
203 if (component->label_.empty()) {
204 if (component->type_ != componentName) {
207 }
else if (component->label_ != componentName) {
214 int negIndex = -1 * (
index + 1);
216 for (
auto& itemIndex :
items) {
217 if (itemIndex.value() == negIndex) {
218 itemIndex = indexInRecord;
236 unsigned int startOfComponentName = 0;
237 if (not iTag.
module().empty()) {
254 return ESTokenIndex{static_cast<ESTokenIndex::Value_t>(indexForToken)};
262 TypeID const& iType)
const {
285 unsigned int count = 0;
289 ++it, ++itAlwaysGet) {
290 if (iBranch == it->m_branchType) {
299 oIndices.reserve(oIndices.size() +
count);
303 ++it, ++itAlwaysGet) {
304 if (iBranch == it->m_branchType) {
307 oIndices.push_back(it->m_index);
317 unsigned int count = 0;
321 ++it, ++itAlwaysGet) {
322 if (iBranch == it->m_branchType) {
324 if (not*itAlwaysGet) {
331 oIndices.reserve(oIndices.size() +
count);
335 ++it, ++itAlwaysGet) {
336 if (iBranch == it->m_branchType) {
338 if (not*itAlwaysGet) {
339 oIndices.push_back(it->m_index);
357 bool skipCurrentProcess,
360 if (it->m_index.productResolverIndex() == iIndex and it->m_index.skipCurrentProcess() == skipCurrentProcess and
361 it->m_branchType == iBranch) {
372 it->m_branchType == iBranch) {
381 <<
"' but the consumes call was for type '"
383 <<
"'.\n Please modify either the consumes or get call so the types match.";
387 <<
"A get using a EDGetToken was done in " <<
BranchTypeToString(iBranch) <<
" but the consumes call was for "
389 <<
".\n Please modify the consumes call to use the correct branch type.";
395 <<
"' was made using an uninitialized token.\n Please check that the variable is "
396 "being initialized from a 'consumes' call.";
399 <<
"A get using a EDGetToken with the C++ type '" << iType.
className() <<
"' was made using a token with a value "
401 <<
" which is beyond the range used by this module.\n Please check that the variable is being initialized from a "
402 "'consumes' call from this module.\n You can not share EDGetToken values between modules.";
406 throw cms::Exception(
"LogicError") <<
"A module declared it consumes a product after its constructor.\n"
407 <<
"This must be done in the contructor\n"
408 <<
"The product type was: " << typeToGet.
type() <<
"\n"
413 struct CharStarComp {
414 bool operator()(
const char* iLHS,
const char* iRHS)
const {
return strcmp(iLHS, iRHS) < 0; }
419 void insertFoundModuleLabel(
const char* consumedModuleLabel,
420 std::vector<ModuleDescription const*>&
modules,
421 std::set<std::string>& alreadyFound,
422 std::map<std::string, ModuleDescription const*>
const& labelsToDesc,
426 auto it = labelsToDesc.find(consumedModuleLabel);
427 if (it != labelsToDesc.end()) {
428 if (alreadyFound.insert(consumedModuleLabel).second) {
434 std::vector<std::pair<std::string, std::string> >
const& aliasToOriginal = preg.
aliasToOriginal();
437 if (iter != aliasToOriginal.end() && iter->first == consumedModuleLabel) {
438 std::string const& originalModuleLabel = iter->second;
439 auto iter2 = labelsToDesc.find(originalModuleLabel);
440 if (iter2 != labelsToDesc.end()) {
441 if (alreadyFound.insert(originalModuleLabel).second) {
442 modules.push_back(iter2->second);
450 if (
std::string(consumedModuleLabel) !=
"source") {
452 <<
"Couldn't find ModuleDescription for the consumed module label: " <<
std::string(consumedModuleLabel)
460 std::map<std::string, ModuleDescription const*>
const& labelsToDesc,
464 std::set<std::string> alreadyFound;
469 ++itInfo, ++itKind, ++itLabels) {
470 if (itInfo->m_branchType ==
InEvent and (not itInfo->m_index.skipCurrentProcess())) {
471 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
472 const char* consumedModuleLabel = &(
m_tokenLabels[labelStart]);
473 const char* consumedProcessName = consumedModuleLabel + itLabels->m_deltaToProcessName;
475 if (*consumedModuleLabel !=
'\0') {
476 if (*consumedProcessName !=
'\0') {
478 iHelper.
index(*itKind,
481 consumedModuleLabel + itLabels->m_deltaToProductInstance,
483 insertFoundModuleLabel(consumedModuleLabel,
modules, alreadyFound, labelsToDesc, preg);
487 *itKind, itInfo->m_type, consumedModuleLabel, consumedModuleLabel + itLabels->m_deltaToProductInstance);
488 for (
unsigned int j = 0;
j <
matches.numberOfMatches(); ++
j) {
490 insertFoundModuleLabel(consumedModuleLabel,
modules, alreadyFound, labelsToDesc, preg);
497 for (
unsigned int j = 0;
j <
matches.numberOfMatches(); ++
j) {
499 insertFoundModuleLabel(
matches.moduleLabel(
j),
modules, alreadyFound, labelsToDesc, preg);
513 std::vector<char> newTokenLabels;
519 newProcessName = &
m_tokenLabels[iter->m_startOfModuleLabel + iter->m_deltaToProcessName];
523 newSize += (iter->m_deltaToProcessName + newProcessName.size() + 1);
525 newTokenLabels.reserve(newSize);
527 unsigned int newStartOfModuleLabel = 0;
529 unsigned int startOfModuleLabel = iter->m_startOfModuleLabel;
530 unsigned short deltaToProcessName = iter->m_deltaToProcessName;
532 iter->m_startOfModuleLabel = newStartOfModuleLabel;
534 newProcessName = &
m_tokenLabels[startOfModuleLabel + deltaToProcessName];
539 newStartOfModuleLabel += (deltaToProcessName + newProcessName.size() + 1);
542 newTokenLabels.insert(newTokenLabels.end(),
544 m_tokenLabels.begin() + (startOfModuleLabel + deltaToProcessName));
546 newTokenLabels.insert(newTokenLabels.end(), newProcessName.begin(), newProcessName.end());
547 newTokenLabels.push_back(
'\0');
558 std::set<edm::TypeID> alreadySeenTypes;
560 std::vector<ConsumesInfo>
result;
565 ++itInfo, ++itKind, ++itLabels, ++itAlways) {
566 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
567 const char* consumedModuleLabel = &(
m_tokenLabels[labelStart]);
568 const char* consumedInstance = consumedModuleLabel + itLabels->m_deltaToProductInstance;
569 const char* consumedProcessName = consumedModuleLabel + itLabels->m_deltaToProcessName;
572 if (*consumedModuleLabel ==
'\0') {
573 if (!alreadySeenTypes.insert(itInfo->m_type).second) {
579 result.emplace_back(itInfo->m_type,
583 itInfo->m_branchType,
586 itInfo->m_index.skipCurrentProcess());