CMS 3D CMS Logo

ProductResolverIndexHelper.cc
Go to the documentation of this file.
1 
9 
10 #include <TClass.h>
11 
12 #include <cassert>
13 #include <iostream>
14 #include <limits>
15 
16 namespace edm {
17 
18  namespace productholderindexhelper {
20  static int const vtcOffset =
21  TClass::GetClass("edm::WrapperBase")->GetBaseClassOffset(TClass::GetClass("edm::ViewTypeChecker"));
22  static TClass const* const wbClass = TClass::GetClass("edm::WrapperBase");
23  static std::string const refVector("edm::RefVector<");
24  static std::string const refToBaseVector("edm::RefToBaseVector<");
25  static std::string const ptrVector("edm::PtrVector<");
26  static std::string const vectorPtr("std::vector<edm::Ptr<");
27  static std::string const vectorUniquePtr("std::vector<std::unique_ptr<");
28  static std::string const associationMap("edm::AssociationMap<");
29  static std::string const newDetSetVector("edmNew::DetSetVector<");
30  static size_t const rvsize = refVector.size();
31  static size_t const rtbvsize = refToBaseVector.size();
32  static size_t const pvsize = ptrVector.size();
33  static size_t const vpsize = vectorPtr.size();
34  static size_t const vupsize = vectorUniquePtr.size();
35  static size_t const amsize = associationMap.size();
36  static size_t const ndsize = newDetSetVector.size();
37  bool mayBeRefVector = (className.substr(0, rvsize) == refVector) ||
38  (className.substr(0, rtbvsize) == refToBaseVector) ||
39  (className.substr(0, pvsize) == ptrVector) || (className.substr(0, vpsize) == vectorPtr) ||
40  (className.substr(0, vupsize) == vectorUniquePtr);
41  // AssociationMap and edmNew::DetSetVector do not support View and
42  // this function is used to get a contained type that can be accessed
43  // using a View. So return the void type in these cases.
44  // In practice, they were the only types causing a problem, but any
45  // type with a typedef named value_type that does not support
46  // View might also cause problems and might need to be added here in
47  // the future.
48  if (className.substr(0, amsize) == associationMap || className.substr(0, ndsize) == newDetSetVector) {
49  return TypeID(typeid(void));
50  }
51  TClass* cl = TClass::GetClass(wrappedTypeID.className().c_str());
52  if (cl == nullptr) {
53  return TypeID(typeid(void));
54  }
55  void* p = cl->New();
56  int offset = cl->GetBaseClassOffset(wbClass) + vtcOffset;
57  std::unique_ptr<ViewTypeChecker> checker = getAnyPtr<ViewTypeChecker>(p, offset);
58  if (mayBeRefVector) {
59  std::type_info const& ti = checker->memberTypeInfo();
60  if (ti != typeid(void)) {
61  return TypeID(ti);
62  }
63  }
64  return TypeID(checker->valueTypeInfo());
65  }
66 
67  TypeID getContainedType(TypeID const& typeID) {
68  const std::string& className = typeID.className();
70  TypeID const wrappedTypeID = TypeID(wrappedType.typeInfo());
71  return getContainedTypeFromWrapper(wrappedTypeID, className);
72  }
73  } // namespace productholderindexhelper
74 
76  : nextIndexValue_(0),
77  beginElements_(0),
78  items_(new std::set<ProductResolverIndexHelper::Item>),
79  processItems_(new std::set<std::string>) {}
80 
82  TypeID const& typeID,
83  char const* moduleLabel,
84  char const* instance,
85  char const* process) const {
86  unsigned int iToIndexAndNames = indexToIndexAndNames(kindOfType, typeID, moduleLabel, instance, process);
87 
88  if (iToIndexAndNames == std::numeric_limits<unsigned int>::max()) {
90  }
91  return indexAndNames_[iToIndexAndNames].index();
92  }
93 
95  unsigned int startInIndexAndNames,
96  unsigned int numberOfMatches)
97  : productResolverIndexHelper_(productResolverIndexHelper),
98  startInIndexAndNames_(startInIndexAndNames),
99  numberOfMatches_(numberOfMatches) {
100  if (numberOfMatches != 0 &&
103  << "ProductResolverIndexHelper::Matches::Matches - Arguments exceed vector bounds.\n";
104  }
105  }
106 
108  if (i >= numberOfMatches_) {
109  throw Exception(errors::LogicError) << "ProductResolverIndexHelper::Matches::index - Argument is out of range.\n";
110  }
111  return productResolverIndexHelper_->indexAndNames_[startInIndexAndNames_ + i].index();
112  }
113 
115  if (i >= numberOfMatches_) {
117  << "ProductResolverIndexHelper::Matches::isFullyResolved - Argument is out of range.\n";
118  }
119  return (productResolverIndexHelper_->indexAndNames_[startInIndexAndNames_ + i].startInProcessNames() != 0U);
120  }
121 
122  char const* ProductResolverIndexHelper::Matches::processName(unsigned int i) const {
123  if (i >= numberOfMatches_) {
125  << "ProductResolverIndexHelper::Matches::processName - Argument is out of range.\n";
126  }
127  unsigned int startInProcessNames =
128  productResolverIndexHelper_->indexAndNames_[startInIndexAndNames_ + i].startInProcessNames();
129  return &productResolverIndexHelper_->processNames_[startInProcessNames];
130  }
131 
133  if (i >= numberOfMatches_) {
135  << "ProductResolverIndexHelper::Matches::productInstanceName - Argument is out of range.\n";
136  }
137  unsigned int start =
138  productResolverIndexHelper_->indexAndNames_[startInIndexAndNames_ + i].startInBigNamesContainer();
139  auto moduleLabelSize = strlen(&productResolverIndexHelper_->bigNamesContainer_[start]);
140  return &productResolverIndexHelper_->bigNamesContainer_[start + moduleLabelSize + 1];
141  }
142 
143  char const* ProductResolverIndexHelper::Matches::moduleLabel(unsigned int i) const {
144  if (i >= numberOfMatches_) {
146  << "ProductResolverIndexHelper::Matches::moduleLabel - Argument is out of range.\n";
147  }
148  unsigned int start =
149  productResolverIndexHelper_->indexAndNames_[startInIndexAndNames_ + i].startInBigNamesContainer();
150  return &productResolverIndexHelper_->bigNamesContainer_[start];
151  }
152 
154  TypeID const& typeID,
155  char const* moduleLabel,
156  char const* instance) const {
157  unsigned int startInIndexAndNames = indexToIndexAndNames(kindOfType, typeID, moduleLabel, instance, nullptr);
158  unsigned int numberOfMatches = 1;
159 
160  if (startInIndexAndNames == std::numeric_limits<unsigned int>::max()) {
161  numberOfMatches = 0;
162  } else {
163  auto vSize = indexAndNames_.size();
164  for (unsigned int j = startInIndexAndNames + 1U; j < vSize && (indexAndNames_[j].startInProcessNames() != 0U);
165  ++j) {
166  ++numberOfMatches;
167  }
168  }
169  return Matches(this, startInIndexAndNames, numberOfMatches);
170  }
171 
173  TypeID const& typeID) const {
174  unsigned int startInIndexAndNames = std::numeric_limits<unsigned int>::max();
175  unsigned int numberOfMatches = 0;
176 
177  // Look for the type and check to see if it found it
178  unsigned iType = indexToType(kindOfType, typeID);
180  // Get the range of entries with a matching TypeID
181  Range const& range = ranges_[iType];
182 
183  startInIndexAndNames = range.begin();
184  numberOfMatches = range.end() - range.begin();
185  }
186  return Matches(this, startInIndexAndNames, numberOfMatches);
187  }
188 
190  char const* moduleLabel,
191  char const* instance,
192  char const* process,
193  TypeID const& containedTypeID,
194  std::vector<TypeWithDict>* baseTypesOfContainedType) {
195  if (!items_) {
197  << "ProductResolverIndexHelper::insert - Attempt to insert more elements after frozen.\n";
198  }
199 
200  if (process == nullptr || *process == '\0') {
201  throw Exception(errors::LogicError) << "ProductResolverIndexHelper::insert - Empty process.\n";
202  }
203 
204  // Throw if this has already been inserted
206  std::set<Item>::iterator iter = items_->find(item);
207  if (iter != items_->end()) {
209  << "ProductResolverIndexHelper::insert - Attempt to insert duplicate entry.\n";
210  }
211 
212  // Put in an entry for the product
213  item.setIndex(nextIndexValue_);
214  unsigned int savedProductIndex = nextIndexValue_;
215  ++nextIndexValue_;
216  items_->insert(item);
217 
218  // Put in an entry for the product with an empty process name
219  // if it is not already there
220  item.clearProcess();
221  iter = items_->find(item);
222  if (iter == items_->end()) {
223  item.setIndex(nextIndexValue_);
224  ++nextIndexValue_;
225  items_->insert(item);
226  }
227 
228  // Now put in entries for a contained class if this is a
229  // recognized container.
230  if (containedTypeID != TypeID(typeid(void)) && containedTypeID != TypeID()) {
231  TypeWithDict containedType(containedTypeID.typeInfo());
232 
233  Item containedItem(ELEMENT_TYPE, containedTypeID, moduleLabel, instance, process, savedProductIndex);
234  iter = items_->find(containedItem);
235  if (iter != items_->end()) {
236  containedItem.setIndex(ProductResolverIndexAmbiguous);
237  items_->erase(iter);
238  }
239  items_->insert(containedItem);
240 
241  containedItem.clearProcess();
242  iter = items_->find(containedItem);
243  if (iter == items_->end()) {
244  containedItem.setIndex(nextIndexValue_);
245  ++nextIndexValue_;
246  items_->insert(containedItem);
247  }
248 
249  // Repeat this for all public base classes of the contained type
250  if (baseTypesOfContainedType) {
251  for (TypeWithDict const& baseType : *baseTypesOfContainedType) {
252  TypeID baseTypeID(baseType.typeInfo());
253  Item baseItem(ELEMENT_TYPE, baseTypeID, moduleLabel, instance, process, savedProductIndex);
254  iter = items_->find(baseItem);
255  if (iter != items_->end()) {
256  baseItem.setIndex(ProductResolverIndexAmbiguous);
257  items_->erase(iter);
258  }
259  items_->insert(baseItem);
260 
261  baseItem.clearProcess();
262  iter = items_->find(baseItem);
263  if (iter == items_->end()) {
264  baseItem.setIndex(nextIndexValue_);
265  ++nextIndexValue_;
266  items_->insert(baseItem);
267  }
268  }
269  }
270  }
271  return savedProductIndex;
272  }
273 
275  char const* moduleLabel,
276  char const* instance,
277  char const* process) {
278  TypeID containedTypeID = productholderindexhelper::getContainedType(typeID);
279  bool hasContainedType = (containedTypeID != TypeID(typeid(void)) && containedTypeID != TypeID());
280  std::vector<TypeWithDict> baseTypes;
281  std::vector<TypeWithDict>* baseTypesOfContainedType = &baseTypes;
282  if (hasContainedType) {
283  std::vector<std::string> missingDictionaries;
284  public_base_classes(missingDictionaries, containedTypeID, baseTypes);
285  }
286  return insert(typeID, moduleLabel, instance, process, containedTypeID, baseTypesOfContainedType);
287  }
288 
290  if (!items_)
291  return;
292 
293  // Make a first pass and count things so we
294  // can reserve memory in the vectors. Also
295  // fill processItems_ on the first pass.
296  bool iFirstThisType = true;
297  bool beginElementsWasSet = false;
298  TypeID previousTypeID;
299  KindOfType previousKindOfType = PRODUCT_TYPE;
300  std::string previousModuleLabel;
301  std::string previousInstance;
302  unsigned int iCountTypes = 0;
303  unsigned int iCountCharacters = 0;
304  for (auto const& item : *items_) {
305  if (iFirstThisType || item.typeID() != previousTypeID || item.kindOfType() != previousKindOfType) {
306  ++iCountTypes;
307  iFirstThisType = true;
308 
309  if (!beginElementsWasSet) {
310  if (item.kindOfType() == ELEMENT_TYPE) {
311  beginElementsWasSet = true;
312  } else {
313  beginElements_ = iCountTypes;
314  }
315  }
316  }
317 
318  processItems_->insert(item.process());
319 
320  if (iFirstThisType || item.moduleLabel() != previousModuleLabel || item.instance() != previousInstance) {
321  iCountCharacters += item.moduleLabel().size();
322  iCountCharacters += item.instance().size();
323  iCountCharacters += 2;
324  }
325 
326  iFirstThisType = false;
327  previousTypeID = item.typeID();
328  previousKindOfType = item.kindOfType();
329  previousModuleLabel = item.moduleLabel();
330  previousInstance = item.instance();
331  }
332 
333  // Size and fill the process name vector
334  unsigned int processNamesSize = 0;
335  for (auto const& processItem : *processItems_) {
336  processNamesSize += processItem.size();
337  ++processNamesSize;
338  }
339  processNames_.reserve(processNamesSize);
340  for (auto const& processItem : *processItems_) {
341  for (auto const& c : processItem) {
342  processNames_.push_back(c);
343  }
344  processNames_.push_back('\0');
345  lookupProcessNames_.push_back(processItem);
346  }
347 
348  // Reserve memory in the vectors
349  sortedTypeIDs_.reserve(iCountTypes);
350  ranges_.reserve(iCountTypes);
351  indexAndNames_.reserve(items_->size());
352  bigNamesContainer_.reserve(iCountCharacters);
353 
354  // Second pass. Really fill the vectors this time.
355  bool iFirstType = true;
356  iFirstThisType = true;
357  previousTypeID = TypeID();
358  unsigned int iCount = 0;
359  unsigned int iBeginning = 0;
360  iCountCharacters = 0;
361  unsigned int previousCharacterCount = 0;
362  if (!items_->empty()) {
363  for (auto const& item : *items_) {
364  if (iFirstThisType || item.typeID() != previousTypeID || item.kindOfType() != previousKindOfType) {
365  iFirstThisType = true;
366  sortedTypeIDs_.push_back(item.typeID());
367  if (iFirstType) {
368  iFirstType = false;
369  } else {
370  ranges_.push_back(Range(iBeginning, iCount));
371  }
372  iBeginning = iCount;
373  }
374  ++iCount;
375 
376  if (iFirstThisType || item.moduleLabel() != previousModuleLabel || item.instance() != previousInstance) {
377  unsigned int labelSize = item.moduleLabel().size();
378  for (unsigned int j = 0; j < labelSize; ++j) {
379  bigNamesContainer_.push_back(item.moduleLabel()[j]);
380  }
381  bigNamesContainer_.push_back('\0');
382 
383  unsigned int instanceSize = item.instance().size();
384  for (unsigned int j = 0; j < instanceSize; ++j) {
385  bigNamesContainer_.push_back(item.instance()[j]);
386  }
387  bigNamesContainer_.push_back('\0');
388 
389  previousCharacterCount = iCountCharacters;
390 
391  iCountCharacters += labelSize;
392  iCountCharacters += instanceSize;
393  iCountCharacters += 2;
394  }
395 
396  unsigned int processStart = processIndex(item.process().c_str());
397  if (processStart == std::numeric_limits<unsigned int>::max()) {
399  << "ProductResolverIndexHelper::setFrozen - Process not found in processNames_.\n";
400  }
401  indexAndNames_.emplace_back(item.index(), previousCharacterCount, processStart);
402 
403  iFirstThisType = false;
404  previousTypeID = item.typeID();
405  previousKindOfType = item.kindOfType();
406  previousModuleLabel = item.moduleLabel();
407  previousInstance = item.instance();
408  }
409  ranges_.push_back(Range(iBeginning, iCount));
410  }
411 
412  // Some sanity checks to protect against out of bounds vector accesses
413  // These should only fail if there is a bug. If profiling ever shows
414  // them to be expensive one might delete them.
415  sanityCheck();
416 
417  // Cleanup, do not need the temporary containers anymore
418  // propagate_const<T> has no reset() function
419  items_ = nullptr;
420  processItems_ = nullptr;
421  }
422 
423  std::vector<std::string> const& ProductResolverIndexHelper::lookupProcessNames() const {
424  if (items_) {
426  << "ProductResolverIndexHelper::lookupProcessNames - Attempt to access names before frozen.\n";
427  }
428  return lookupProcessNames_;
429  }
430 
432  TypeID const& typeID,
433  char const* moduleLabel,
434  char const* instance,
435  char const* process) const {
436  // Look for the type and check to see if it found it
437  unsigned iType = indexToType(kindOfType, typeID);
439  unsigned startProcess = 0;
440  if (process) {
441  startProcess = processIndex(process);
442  if (startProcess == std::numeric_limits<unsigned int>::max()) {
444  }
445  }
446 
448  unsigned int begin = range.begin();
449  unsigned int end = range.end();
450 
451  while (begin < end) {
452  unsigned int midpoint = begin + ((end - begin) / 2);
453  char const* namePtr = &bigNamesContainer_[indexAndNames_[midpoint].startInBigNamesContainer()];
454 
455  // Compare the module label
456  char const* label = moduleLabel;
457  while (*namePtr && (*namePtr == *label)) {
458  ++namePtr;
459  ++label;
460  }
461  if (*namePtr == *label) { // true only if both are at the '\0' at the end of the C string
462  ++namePtr; // move to the next C string
463 
464  // Compare the instance name
465  char const* instanceName = instance;
466  while (*namePtr && (*namePtr == *instanceName)) {
467  ++namePtr;
468  ++instanceName;
469  }
470  if (*namePtr == *instanceName) {
471  // Compare the process name
472  if (startProcess == indexAndNames_[midpoint].startInProcessNames()) {
473  return midpoint;
474  } else {
475  if (indexAndNames_[midpoint].startInProcessNames() > startProcess) {
476  while (true) {
477  --midpoint;
478  if (indexAndNames_[midpoint].startInProcessNames() == startProcess) {
479  return midpoint;
480  }
481  if (indexAndNames_[midpoint].startInProcessNames() == 0)
482  break;
483  }
484  } else {
485  while (true) {
486  ++midpoint;
487  if (midpoint == indexAndNames_.size())
488  break;
489  if (indexAndNames_[midpoint].startInProcessNames() == 0)
490  break;
491  if (indexAndNames_[midpoint].startInProcessNames() == startProcess) {
492  return midpoint;
493  }
494  }
495  }
496  break;
497  }
498  } else if (*namePtr < *instanceName) {
499  if (begin == midpoint)
500  break;
501  begin = midpoint;
502  } else {
503  end = midpoint;
504  }
505  } else if (*namePtr < *label) {
506  if (begin == midpoint)
507  break;
508  begin = midpoint;
509  } else {
510  end = midpoint;
511  }
512  } // end while (begin < end)
513  }
515  }
516 
517  unsigned int ProductResolverIndexHelper::indexToType(KindOfType kindOfType, TypeID const& typeID) const {
518  unsigned int beginType = 0;
519  unsigned int endType = beginElements_;
520  if (kindOfType == ELEMENT_TYPE) {
521  beginType = beginElements_;
522  endType = sortedTypeIDs_.size();
523  }
524 
525  while (beginType < endType) {
526  unsigned int midpointType = beginType + ((endType - beginType) / 2);
527  if (sortedTypeIDs_[midpointType] == typeID) {
528  return midpointType; // Found it
529  } else if (sortedTypeIDs_[midpointType] < typeID) {
530  if (beginType == midpointType)
531  break;
532  beginType = midpointType;
533  } else {
534  endType = midpointType;
535  }
536  }
537  return std::numeric_limits<unsigned int>::max(); // Failed to find it
538  }
539 
540  unsigned int ProductResolverIndexHelper::processIndex(char const* process) const {
541  char const* ptr = &processNames_[0];
542  char const* begin = ptr;
543  while (true) {
544  char const* p = process;
545  char const* beginName = ptr;
546  while (*ptr && (*ptr == *p)) {
547  ++ptr;
548  ++p;
549  }
550  if (*ptr == *p) {
551  return beginName - begin;
552  }
553  while (*ptr) {
554  ++ptr;
555  }
556  ++ptr;
557  if (static_cast<unsigned>(ptr - begin) >= processNames_.size()) {
559  }
560  }
561  return 0;
562  }
563 
565  const std::string& iProcessName) const {
567  for (unsigned int i = 0; i < beginElements_; ++i) {
568  auto const& range = ranges_[i];
569  for (unsigned int j = range.begin(); j < range.end(); ++j) {
570  auto const& indexAndNames = indexAndNames_[j];
571  if (0 == strcmp(&processNames_[indexAndNames.startInProcessNames()], iProcessName.c_str())) {
572  //The first null terminated string is the module label
573  auto pModLabel = &bigNamesContainer_[indexAndNames.startInBigNamesContainer()];
574  auto l = strlen(pModLabel);
575  auto pInstance = pModLabel + l + 1;
576  result.emplace(pModLabel, std::make_tuple(&sortedTypeIDs_[i], pInstance, indexAndNames.index()));
577  }
578  }
579  }
580  return result;
581  }
582 
584  bool sanityChecksPass = true;
585  if (sortedTypeIDs_.size() != ranges_.size())
586  sanityChecksPass = false;
587 
588  unsigned int previousEnd = 0;
589  for (auto const& range : ranges_) {
590  if (range.begin() != previousEnd)
591  sanityChecksPass = false;
592  if (range.begin() >= range.end())
593  sanityChecksPass = false;
594  previousEnd = range.end();
595  }
596  if (previousEnd != indexAndNames_.size())
597  sanityChecksPass = false;
598 
599  unsigned maxStart = 0;
600  unsigned maxStartProcess = 0;
601  for (auto const& indexAndName : indexAndNames_) {
602  if (indexAndName.index() >= nextIndexValue_ && indexAndName.index() != ProductResolverIndexAmbiguous)
603  sanityChecksPass = false;
604 
605  if (indexAndName.startInBigNamesContainer() >= bigNamesContainer_.size())
606  sanityChecksPass = false;
607  if (indexAndName.startInProcessNames() >= processNames_.size())
608  sanityChecksPass = false;
609 
610  if (indexAndName.startInBigNamesContainer() > maxStart)
611  maxStart = indexAndName.startInBigNamesContainer();
612  if (indexAndName.startInProcessNames() > maxStartProcess)
613  maxStartProcess = indexAndName.startInProcessNames();
614  }
615 
616  if (!indexAndNames_.empty()) {
617  if (bigNamesContainer_.back() != '\0')
618  sanityChecksPass = false;
619  if (processNames_.back() != '\0')
620  sanityChecksPass = false;
621  if (maxStart >= bigNamesContainer_.size())
622  sanityChecksPass = false;
623  unsigned int countZeroes = 0;
624  for (unsigned j = maxStart; j < bigNamesContainer_.size(); ++j) {
625  if (bigNamesContainer_[j] == '\0') {
626  ++countZeroes;
627  }
628  }
629  if (countZeroes != 2)
630  sanityChecksPass = false;
631  if (maxStartProcess >= processNames_.size())
632  sanityChecksPass = false;
633  countZeroes = 0;
634  for (unsigned j = maxStartProcess; j < processNames_.size(); ++j) {
635  if (processNames_[j] == '\0') {
636  ++countZeroes;
637  }
638  }
639  if (countZeroes != 1)
640  sanityChecksPass = false;
641  }
642 
643  if (!sanityChecksPass) {
644  throw Exception(errors::LogicError) << "ProductResolverIndexHelper::setFrozen - Detected illegal state.\n";
645  }
646  }
647 
649  TypeID const& typeID,
650  std::string const& moduleLabel,
651  std::string const& instance,
652  std::string const& process,
654  : kindOfType_(kindOfType),
655  typeID_(typeID),
656  moduleLabel_(moduleLabel),
657  instance_(instance),
658  process_(process),
659  index_(index) {}
660 
662  if (kindOfType_ < right.kindOfType_)
663  return true;
664  if (kindOfType_ > right.kindOfType_)
665  return false;
666  if (typeID_ < right.typeID_)
667  return true;
668  if (typeID_ > right.typeID_)
669  return false;
670  if (moduleLabel_ < right.moduleLabel_)
671  return true;
672  if (moduleLabel_ > right.moduleLabel_)
673  return false;
674  if (instance_ < right.instance_)
675  return true;
676  if (instance_ > right.instance_)
677  return false;
678  return process_ < right.process_;
679  }
680 
681  void ProductResolverIndexHelper::print(std::ostream& os) const {
682  os << "\n******* Dump ProductResolverIndexHelper *************************\n";
683 
684  os << "\nnextIndexValue_ = " << nextIndexValue_ << "\n";
685  os << "beginElements_ = " << beginElements_ << "\n";
686 
687  os << "\n******* sortedTypeIDs_ \n";
688  for (auto const& i : sortedTypeIDs_) {
689  os << i << "\n";
690  }
691  os << "******* ranges_ \n";
692  for (auto const& i : ranges_) {
693  os << i.begin() << " " << i.end() << "\n";
694  }
695  os << "******* indexAndNames_ \n";
696  for (auto const& i : indexAndNames_) {
697  os << i.index() << " " << i.startInBigNamesContainer() << " ";
698  char const* ptr = &bigNamesContainer_[i.startInBigNamesContainer()];
699  while (*ptr) {
700  os << *ptr;
701  ++ptr;
702  }
703  ++ptr;
704  os << " ";
705  while (*ptr) {
706  os << *ptr;
707  ++ptr;
708  }
709  os << " " << i.startInProcessNames() << " ";
710  ptr = &processNames_[i.startInProcessNames()];
711  while (*ptr) {
712  os << *ptr;
713  ++ptr;
714  }
715  os << "\n";
716  }
717  os << "******* bigNamesContainer_ \n";
718  for (auto i : bigNamesContainer_) {
719  if (i == '\0')
720  os << '\\' << '0';
721  else
722  os << i;
723  }
724  if (!bigNamesContainer_.empty())
725  os << "\n";
726  os << "******* processNames_ \n";
727  for (auto i : processNames_) {
728  if (i == '\0')
729  os << '\\' << '0';
730  else
731  os << i;
732  }
733  if (!processNames_.empty())
734  os << "\n";
735  if (items_) {
736  os << "******* items_ \n";
737  for (auto const& item : *items_) {
738  std::cout << item.kindOfType() << " " << item.moduleLabel() << " " << item.instance() << " " << item.process()
739  << " " << item.index() << " " << item.typeID() << "\n";
740  }
741  }
742  if (processItems_) {
743  os << "******* processItems_ \n";
744  for (auto const& item : *processItems_) {
745  os << item << "\n";
746  }
747  }
748  os << "sortedTypeIDs_.size() = " << sortedTypeIDs_.size() << "\n";
749  os << "indexAndNames_.size() = " << indexAndNames_.size() << "\n";
750  os << "bigNamesContainer_.size() = " << bigNamesContainer_.size() << "\n";
751  os << "processNames_.size() = " << processNames_.size() << "\n";
752  os << "\n";
753  }
754 } // namespace edm
edm::ProductResolverIndexHelper::indexAndNames_
std::vector< IndexAndNames > indexAndNames_
Definition: ProductResolverIndexHelper.h:291
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
edm::ProductResolverIndexHelper::items_
edm::propagate_const< std::unique_ptr< std::set< Item > > > items_
Definition: ProductResolverIndexHelper.h:342
edm::TypeWithDict::byName
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:74
ProductResolverIndexHelper.h
edm::ProductResolverIndex
unsigned int ProductResolverIndex
Definition: ProductResolverIndex.h:8
mps_fire.i
i
Definition: mps_fire.py:428
start
Definition: start.py:1
edm::ProductResolverIndexHelper::Matches::productResolverIndexHelper_
ProductResolverIndexHelper const * productResolverIndexHelper_
Definition: ProductResolverIndexHelper.h:141
edm::productholderindexhelper::getContainedType
TypeID getContainedType(TypeID const &typeID)
Definition: ProductResolverIndexHelper.cc:67
edm::ProductResolverIndexHelper::Matches::Matches
Matches(ProductResolverIndexHelper const *productResolverIndexHelper, unsigned int startInIndexAndNames, unsigned int numberOfMatches)
Definition: ProductResolverIndexHelper.cc:94
edm::ProductResolverIndexHelper::Item::Item
Item(KindOfType kindOfType, TypeID const &typeID, std::string const &moduleLabel, std::string const &instance, std::string const &process, ProductResolverIndex index)
Definition: ProductResolverIndexHelper.cc:648
edm::PRODUCT_TYPE
Definition: ProductKindOfType.h:5
edm::ProductResolverIndexHelper::Item::operator<
bool operator<(Item const &right) const
Definition: ProductResolverIndexHelper.cc:661
Range
PixelRecoRange< float > Range
Definition: PixelTripletHLTGenerator.cc:31
edm::errors::LogicError
Definition: EDMException.h:37
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::ProductResolverIndexHelper::Matches::productInstanceName
char const * productInstanceName(unsigned int i) const
Definition: ProductResolverIndexHelper.cc:132
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::TypeID::typeInfo
constexpr const std::type_info & typeInfo() const
Definition: TypeIDBase.h:50
edm::ProductResolverIndexHelper::Range
Definition: ProductResolverIndexHelper.h:199
edm::ProductResolverIndexHelper::index
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=nullptr) const
Definition: ProductResolverIndexHelper.cc:81
edm::ProductResolverIndexHelper::ModulesToIndiciesMap
std::unordered_multimap< std::string, std::tuple< TypeID const *, const char *, ProductResolverIndex > > ModulesToIndiciesMap
Definition: ProductResolverIndexHelper.h:124
TypeWithDict.h
edm::ProductResolverIndexHelper::relatedIndexes
Matches relatedIndexes(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance) const
Definition: ProductResolverIndexHelper.cc:153
edm::ProductResolverIndexHelper
Definition: ProductResolverIndexHelper.h:89
edm::ProductResolverIndexHelper::Matches
Definition: ProductResolverIndexHelper.h:127
edm::ProductResolverIndexHelper::indexToIndexAndNames
unsigned int indexToIndexAndNames(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process) const
Definition: ProductResolverIndexHelper.cc:431
edm::productholderindexhelper::getContainedTypeFromWrapper
TypeID getContainedTypeFromWrapper(TypeID const &wrappedtypeID, std::string const &className)
Definition: ProductResolverIndexHelper.cc:19
edm::ProductResolverIndexHelper::bigNamesContainer_
std::vector< char > bigNamesContainer_
Definition: ProductResolverIndexHelper.h:303
edm::ProductResolverIndexHelper::sortedTypeIDs_
std::vector< TypeID > sortedTypeIDs_
Definition: ProductResolverIndexHelper.h:272
EDMException.h
GetRecoTauVFromDQM_MC_cff.cl
cl
Definition: GetRecoTauVFromDQM_MC_cff.py:38
edm::ProductResolverIndexHelper::lookupProcessNames
std::vector< std::string > const & lookupProcessNames() const
Definition: ProductResolverIndexHelper.cc:423
ViewTypeChecker.h
edm::ProductResolverIndexHelper::Matches::startInIndexAndNames_
unsigned int startInIndexAndNames_
Definition: ProductResolverIndexHelper.h:142
edm::ProductResolverIndexHelper::lookupProcessNames_
std::vector< std::string > lookupProcessNames_
Definition: ProductResolverIndexHelper.h:308
edm::ProductResolverIndexHelper::Matches::index
ProductResolverIndex index(unsigned int i) const
Definition: ProductResolverIndexHelper.cc:107
mps_fire.end
end
Definition: mps_fire.py:242
edm::ProductResolverIndexHelper::setFrozen
void setFrozen()
Definition: ProductResolverIndexHelper.cc:289
edm::ProductResolverIndexHelper::beginElements_
unsigned int beginElements_
Definition: ProductResolverIndexHelper.h:265
getAnyPtr.h
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ProductResolverIndexHelper::Item::typeID_
TypeID typeID_
Definition: ProductResolverIndexHelper.h:335
edm::TypeWithDict
Definition: TypeWithDict.h:38
edm::ProductResolverIndexHelper::processNames_
std::vector< char > processNames_
Definition: ProductResolverIndexHelper.h:304
edm::ProductResolverIndexHelper::Matches::numberOfMatches_
unsigned int numberOfMatches_
Definition: ProductResolverIndexHelper.h:143
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
edm::TypeWithDict::typeInfo
std::type_info const & typeInfo() const
Definition: TypeWithDict.cc:357
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
edm::ProductResolverIndexHelper::Matches::isFullyResolved
bool isFullyResolved(unsigned int i) const
Definition: ProductResolverIndexHelper.cc:114
edm::ProductResolverIndexInvalid
Definition: ProductResolverIndex.h:16
edm::ProductResolverIndexHelper::indiciesForModulesInProcess
ModulesToIndiciesMap indiciesForModulesInProcess(const std::string &iProcessName) const
Definition: ProductResolverIndexHelper.cc:564
edm::ProductResolverIndexHelper::Item::moduleLabel_
std::string moduleLabel_
Definition: ProductResolverIndexHelper.h:336
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
edm::wrappedClassName
std::string wrappedClassName(std::string const &iFullName)
Definition: WrappedClassName.cc:4
edm::ProductResolverIndexHelper::indexToType
unsigned int indexToType(KindOfType kindOfType, TypeID const &typeID) const
Definition: ProductResolverIndexHelper.cc:517
edm::ProductResolverIndexHelper::Item
Definition: ProductResolverIndexHelper.h:313
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
edm::ProductResolverIndexAmbiguous
Definition: ProductResolverIndex.h:18
edm::TypeID::className
std::string const & className() const
Definition: TypeID.cc:40
WrappedClassName.h
edm::TypeID
Definition: TypeID.h:22
std
Definition: JetResolutionObject.h:76
edm::KindOfType
KindOfType
Definition: ProductKindOfType.h:5
edm::ProductResolverIndexHelper::Item::instance_
std::string instance_
Definition: ProductResolverIndexHelper.h:337
edm::public_base_classes
bool public_base_classes(std::vector< std::string > &missingDictionaries, TypeID const &typeID, std::vector< TypeWithDict > &baseTypes)
Definition: DictionaryTools.cc:319
edm::ProductResolverIndexHelper::processItems_
edm::propagate_const< std::unique_ptr< std::set< std::string > > > processItems_
Definition: ProductResolverIndexHelper.h:344
edm::ELEMENT_TYPE
Definition: ProductKindOfType.h:5
Exception
Definition: hltDiff.cc:245
edm::ProductResolverIndexHelper::insert
ProductResolverIndex insert(TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process, TypeID const &containedTypeID, std::vector< TypeWithDict > *baseTypesOfContainedType)
Definition: ProductResolverIndexHelper.cc:189
className
std::string className(const T &t)
Definition: ClassName.h:31
edm::ProductResolverIndexHelper::indexAndNames
std::vector< IndexAndNames > const & indexAndNames() const
Definition: ProductResolverIndexHelper.h:227
edm::ProductResolverIndexHelper::Item::process_
std::string process_
Definition: ProductResolverIndexHelper.h:338
mps_fire.result
result
Definition: mps_fire.py:311
edm::ProductResolverIndexHelper::Matches::processName
char const * processName(unsigned int i) const
Definition: ProductResolverIndexHelper.cc:122
edm::ProductResolverIndexHelper::processIndex
unsigned int processIndex(char const *process) const
Definition: ProductResolverIndexHelper.cc:540
command_line.start
start
Definition: command_line.py:167
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
edm::ProductResolverIndexHelper::ProductResolverIndexHelper
ProductResolverIndexHelper()
Definition: ProductResolverIndexHelper.cc:75
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
DictionaryTools.h
edm::ProductResolverIndexHelper::ranges_
std::vector< Range > ranges_
Definition: ProductResolverIndexHelper.h:279
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
edm::ProductResolverIndexHelper::sanityCheck
void sanityCheck() const
Definition: ProductResolverIndexHelper.cc:583
MuonErrorMatrixAdjuster_cfi.instanceName
instanceName
Definition: MuonErrorMatrixAdjuster_cfi.py:16
edm::ProductResolverIndexHelper::Matches::moduleLabel
char const * moduleLabel(unsigned int i) const
Definition: ProductResolverIndexHelper.cc:143
edm::ProductResolverIndexHelper::print
void print(std::ostream &os) const
Definition: ProductResolverIndexHelper.cc:681
edm::ProductResolverIndexHelper::nextIndexValue_
ProductResolverIndex nextIndexValue_
Definition: ProductResolverIndexHelper.h:260
label
const char * label
Definition: PFTauDecayModeTools.cc:11
edm::ProductResolverIndexHelper::Item::kindOfType_
KindOfType kindOfType_
Definition: ProductResolverIndexHelper.h:334
edm::ProductResolverIndexHelper::Matches::numberOfMatches
unsigned int numberOfMatches() const
Definition: ProductResolverIndexHelper.h:134