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 
74  bool typeIsViewCompatible(TypeID const& requestedViewType,
75  TypeID const& wrappedtypeID,
76  std::string const& className) {
77  auto elementType = getContainedTypeFromWrapper(wrappedtypeID, className);
78  if (elementType == TypeID(typeid(void)) or elementType == TypeID()) {
79  //the wrapped type is not a container
80  return false;
81  }
82  if (elementType == requestedViewType) {
83  return true;
84  }
85  //need to check for inheritance match
86  std::vector<std::string> missingDictionaries;
87  std::vector<TypeID> baseTypes;
88  if (!public_base_classes(missingDictionaries, elementType, baseTypes)) {
89  return false;
90  }
91  for (auto const& base : baseTypes) {
92  if (TypeID(base.typeInfo()) == requestedViewType) {
93  return true;
94  }
95  }
96  return false;
97  }
98 
99  } // namespace productholderindexhelper
100 
102  : nextIndexValue_(0),
103  beginElements_(0),
104  items_(new std::set<ProductResolverIndexHelper::Item>),
105  processItems_(new std::set<std::string>) {}
106 
108  TypeID const& typeID,
109  char const* moduleLabel,
110  char const* instance,
111  char const* process) const {
112  unsigned int iToIndexAndNames = indexToIndexAndNames(kindOfType, typeID, moduleLabel, instance, process);
113 
114  if (iToIndexAndNames == std::numeric_limits<unsigned int>::max()) {
116  }
117  return indexAndNames_[iToIndexAndNames].index();
118  }
119 
121  unsigned int startInIndexAndNames,
122  unsigned int numberOfMatches)
123  : productResolverIndexHelper_(productResolverIndexHelper),
124  startInIndexAndNames_(startInIndexAndNames),
125  numberOfMatches_(numberOfMatches) {
126  if (numberOfMatches != 0 &&
129  << "ProductResolverIndexHelper::Matches::Matches - Arguments exceed vector bounds.\n";
130  }
131  }
132 
134  if (i >= numberOfMatches_) {
135  throw Exception(errors::LogicError) << "ProductResolverIndexHelper::Matches::index - Argument is out of range.\n";
136  }
137  return productResolverIndexHelper_->indexAndNames_[startInIndexAndNames_ + i].index();
138  }
139 
140  char const* ProductResolverIndexHelper::Matches::processName(unsigned int i) const {
141  if (i >= numberOfMatches_) {
143  << "ProductResolverIndexHelper::Matches::processName - Argument is out of range.\n";
144  }
145  unsigned int startInProcessNames =
146  productResolverIndexHelper_->indexAndNames_[startInIndexAndNames_ + i].startInProcessNames();
147  return &productResolverIndexHelper_->processNames_[startInProcessNames];
148  }
149 
151  if (i >= numberOfMatches_) {
153  << "ProductResolverIndexHelper::Matches::productInstanceName - Argument is out of range.\n";
154  }
155  unsigned int start =
156  productResolverIndexHelper_->indexAndNames_[startInIndexAndNames_ + i].startInBigNamesContainer();
157  auto moduleLabelSize = strlen(&productResolverIndexHelper_->bigNamesContainer_[start]);
158  return &productResolverIndexHelper_->bigNamesContainer_[start + moduleLabelSize + 1];
159  }
160 
161  char const* ProductResolverIndexHelper::Matches::moduleLabel(unsigned int i) const {
162  if (i >= numberOfMatches_) {
164  << "ProductResolverIndexHelper::Matches::moduleLabel - Argument is out of range.\n";
165  }
166  unsigned int start =
167  productResolverIndexHelper_->indexAndNames_[startInIndexAndNames_ + i].startInBigNamesContainer();
168  return &productResolverIndexHelper_->bigNamesContainer_[start];
169  }
170 
172  TypeID const& typeID,
173  char const* moduleLabel,
174  char const* instance) const {
175  unsigned int startInIndexAndNames = indexToIndexAndNames(kindOfType, typeID, moduleLabel, instance, nullptr);
176  unsigned int numberOfMatches = 1;
177 
178  if (startInIndexAndNames == std::numeric_limits<unsigned int>::max()) {
179  numberOfMatches = 0;
180  } else {
181  auto vSize = indexAndNames_.size();
182  for (unsigned int j = startInIndexAndNames + 1U; j < vSize && (indexAndNames_[j].startInProcessNames() != 0U);
183  ++j) {
184  ++numberOfMatches;
185  }
186  }
187  return Matches(this, startInIndexAndNames, numberOfMatches);
188  }
189 
191  TypeID const& typeID) const {
192  unsigned int startInIndexAndNames = std::numeric_limits<unsigned int>::max();
193  unsigned int numberOfMatches = 0;
194 
195  // Look for the type and check to see if it found it
196  unsigned iType = indexToType(kindOfType, typeID);
198  // Get the range of entries with a matching TypeID
199  Range const& range = ranges_[iType];
200 
201  startInIndexAndNames = range.begin();
202  numberOfMatches = range.end() - range.begin();
203  }
204  return Matches(this, startInIndexAndNames, numberOfMatches);
205  }
206 
208  char const* moduleLabel,
209  char const* instance,
210  char const* process,
211  TypeID const& containedTypeID,
212  std::vector<TypeID>* baseTypesOfContainedType) {
213  if (!items_) {
215  << "ProductResolverIndexHelper::insert - Attempt to insert more elements after frozen.\n";
216  }
217 
218  if (process == nullptr || *process == '\0') {
219  throw Exception(errors::LogicError) << "ProductResolverIndexHelper::insert - Empty process.\n";
220  }
221 
222  // Throw if this has already been inserted
224  std::set<Item>::iterator iter = items_->find(item);
225  if (iter != items_->end()) {
227  << "ProductResolverIndexHelper::insert - Attempt to insert duplicate entry.\n";
228  }
229 
230  // Put in an entry for the product
231  item.setIndex(nextIndexValue_);
232  unsigned int savedProductIndex = nextIndexValue_;
233  ++nextIndexValue_;
234  items_->insert(item);
235 
236  // Put in an entry for the product with an empty process name
237  // if it is not already there
238  item.clearProcess();
239  iter = items_->find(item);
240  if (iter == items_->end()) {
241  item.setIndex(nextIndexValue_);
242  ++nextIndexValue_;
243  items_->insert(item);
244  }
245 
246  // Now put in entries for a contained class if this is a
247  // recognized container.
248  if (containedTypeID != TypeID(typeid(void)) && containedTypeID != TypeID()) {
249  TypeWithDict containedType(containedTypeID.typeInfo());
250 
251  Item containedItem(ELEMENT_TYPE, containedTypeID, moduleLabel, instance, process, savedProductIndex);
252  iter = items_->find(containedItem);
253  if (iter != items_->end()) {
254  containedItem.setIndex(ProductResolverIndexAmbiguous);
255  items_->erase(iter);
256  }
257  items_->insert(containedItem);
258 
259  containedItem.clearProcess();
260  iter = items_->find(containedItem);
261  if (iter == items_->end()) {
262  containedItem.setIndex(nextIndexValue_);
263  ++nextIndexValue_;
264  items_->insert(containedItem);
265  }
266 
267  // Repeat this for all public base classes of the contained type
268  if (baseTypesOfContainedType) {
269  for (TypeID const& baseTypeID : *baseTypesOfContainedType) {
270  Item baseItem(ELEMENT_TYPE, baseTypeID, moduleLabel, instance, process, savedProductIndex);
271  iter = items_->find(baseItem);
272  if (iter != items_->end()) {
274  items_->erase(iter);
275  }
276  items_->insert(baseItem);
277 
278  baseItem.clearProcess();
279  iter = items_->find(baseItem);
280  if (iter == items_->end()) {
281  baseItem.setIndex(nextIndexValue_);
282  ++nextIndexValue_;
283  items_->insert(baseItem);
284  }
285  }
286  }
287  }
288  return savedProductIndex;
289  }
290 
292  char const* moduleLabel,
293  char const* instance,
294  char const* process) {
295  TypeID containedTypeID = productholderindexhelper::getContainedType(typeID);
296  bool hasContainedType = (containedTypeID != TypeID(typeid(void)) && containedTypeID != TypeID());
297  std::vector<TypeID> baseTypes;
298  std::vector<TypeID>* baseTypesOfContainedType = &baseTypes;
299  if (hasContainedType) {
300  std::vector<std::string> missingDictionaries;
301  public_base_classes(missingDictionaries, containedTypeID, baseTypes);
302  }
303  return insert(typeID, moduleLabel, instance, process, containedTypeID, baseTypesOfContainedType);
304  }
305 
307  if (!items_)
308  return;
309 
310  // Make a first pass and count things so we
311  // can reserve memory in the vectors. Also
312  // fill processItems_ on the first pass.
313  bool iFirstThisType = true;
314  bool beginElementsWasSet = false;
315  TypeID previousTypeID;
316  KindOfType previousKindOfType = PRODUCT_TYPE;
317  std::string previousModuleLabel;
318  std::string previousInstance;
319  unsigned int iCountTypes = 0;
320  unsigned int iCountCharacters = 0;
321  for (auto const& item : *items_) {
322  if (iFirstThisType || item.typeID() != previousTypeID || item.kindOfType() != previousKindOfType) {
323  ++iCountTypes;
324  iFirstThisType = true;
325 
326  if (!beginElementsWasSet) {
327  if (item.kindOfType() == ELEMENT_TYPE) {
328  beginElementsWasSet = true;
329  } else {
330  beginElements_ = iCountTypes;
331  }
332  }
333  }
334 
335  processItems_->insert(item.process());
336 
337  if (iFirstThisType || item.moduleLabel() != previousModuleLabel || item.instance() != previousInstance) {
338  iCountCharacters += item.moduleLabel().size();
339  iCountCharacters += item.instance().size();
340  iCountCharacters += 2;
341  }
342 
343  iFirstThisType = false;
344  previousTypeID = item.typeID();
345  previousKindOfType = item.kindOfType();
346  previousModuleLabel = item.moduleLabel();
347  previousInstance = item.instance();
348  }
349 
350  // Size and fill the process name vector
351  unsigned int processNamesSize = 0;
352  for (auto const& processItem : *processItems_) {
353  processNamesSize += processItem.size();
354  ++processNamesSize;
355  }
356  processNames_.reserve(processNamesSize);
357  for (auto const& processItem : *processItems_) {
358  for (auto const& c : processItem) {
359  processNames_.push_back(c);
360  }
361  processNames_.push_back('\0');
362  lookupProcessNames_.push_back(processItem);
363  }
364 
365  // Reserve memory in the vectors
366  sortedTypeIDs_.reserve(iCountTypes);
367  ranges_.reserve(iCountTypes);
368  indexAndNames_.reserve(items_->size());
369  bigNamesContainer_.reserve(iCountCharacters);
370 
371  // Second pass. Really fill the vectors this time.
372  bool iFirstType = true;
373  iFirstThisType = true;
374  previousTypeID = TypeID();
375  unsigned int iCount = 0;
376  unsigned int iBeginning = 0;
377  iCountCharacters = 0;
378  unsigned int previousCharacterCount = 0;
379  if (!items_->empty()) {
380  for (auto const& item : *items_) {
381  if (iFirstThisType || item.typeID() != previousTypeID || item.kindOfType() != previousKindOfType) {
382  iFirstThisType = true;
383  sortedTypeIDs_.push_back(item.typeID());
384  if (iFirstType) {
385  iFirstType = false;
386  } else {
387  ranges_.push_back(Range(iBeginning, iCount));
388  }
389  iBeginning = iCount;
390  }
391  ++iCount;
392 
393  if (iFirstThisType || item.moduleLabel() != previousModuleLabel || item.instance() != previousInstance) {
394  unsigned int labelSize = item.moduleLabel().size();
395  for (unsigned int j = 0; j < labelSize; ++j) {
396  bigNamesContainer_.push_back(item.moduleLabel()[j]);
397  }
398  bigNamesContainer_.push_back('\0');
399 
400  unsigned int instanceSize = item.instance().size();
401  for (unsigned int j = 0; j < instanceSize; ++j) {
402  bigNamesContainer_.push_back(item.instance()[j]);
403  }
404  bigNamesContainer_.push_back('\0');
405 
406  previousCharacterCount = iCountCharacters;
407 
408  iCountCharacters += labelSize;
409  iCountCharacters += instanceSize;
410  iCountCharacters += 2;
411  }
412 
413  unsigned int processStart = processIndex(item.process().c_str());
414  if (processStart == std::numeric_limits<unsigned int>::max()) {
416  << "ProductResolverIndexHelper::setFrozen - Process not found in processNames_.\n";
417  }
418  indexAndNames_.emplace_back(item.index(), previousCharacterCount, processStart);
419 
420  iFirstThisType = false;
421  previousTypeID = item.typeID();
422  previousKindOfType = item.kindOfType();
423  previousModuleLabel = item.moduleLabel();
424  previousInstance = item.instance();
425  }
426  ranges_.push_back(Range(iBeginning, iCount));
427  }
428 
429  // Some sanity checks to protect against out of bounds vector accesses
430  // These should only fail if there is a bug. If profiling ever shows
431  // them to be expensive one might delete them.
432  sanityCheck();
433 
434  // Cleanup, do not need the temporary containers anymore
435  // propagate_const<T> has no reset() function
436  items_ = nullptr;
437  processItems_ = nullptr;
438  }
439 
440  std::vector<std::string> const& ProductResolverIndexHelper::lookupProcessNames() const {
441  if (items_) {
443  << "ProductResolverIndexHelper::lookupProcessNames - Attempt to access names before frozen.\n";
444  }
445  return lookupProcessNames_;
446  }
447 
449  TypeID const& typeID,
450  char const* moduleLabel,
451  char const* instance,
452  char const* process) const {
453  // Look for the type and check to see if it found it
454  unsigned iType = indexToType(kindOfType, typeID);
456  unsigned startProcess = 0;
457  if (process) {
458  startProcess = processIndex(process);
459  if (startProcess == std::numeric_limits<unsigned int>::max()) {
461  }
462  }
463 
465  unsigned int begin = range.begin();
466  unsigned int end = range.end();
467 
468  while (begin < end) {
469  unsigned int midpoint = begin + ((end - begin) / 2);
470  char const* namePtr = &bigNamesContainer_[indexAndNames_[midpoint].startInBigNamesContainer()];
471 
472  // Compare the module label
473  char const* label = moduleLabel;
474  while (*namePtr && (*namePtr == *label)) {
475  ++namePtr;
476  ++label;
477  }
478  if (*namePtr == *label) { // true only if both are at the '\0' at the end of the C string
479  ++namePtr; // move to the next C string
480 
481  // Compare the instance name
482  char const* instanceName = instance;
483  while (*namePtr && (*namePtr == *instanceName)) {
484  ++namePtr;
485  ++instanceName;
486  }
487  if (*namePtr == *instanceName) {
488  // Compare the process name
489  if (startProcess == indexAndNames_[midpoint].startInProcessNames()) {
490  return midpoint;
491  } else {
492  if (indexAndNames_[midpoint].startInProcessNames() > startProcess) {
493  while (true) {
494  --midpoint;
495  if (indexAndNames_[midpoint].startInProcessNames() == startProcess) {
496  return midpoint;
497  }
498  if (indexAndNames_[midpoint].startInProcessNames() == 0)
499  break;
500  }
501  } else {
502  while (true) {
503  ++midpoint;
504  if (midpoint == indexAndNames_.size())
505  break;
506  if (indexAndNames_[midpoint].startInProcessNames() == 0)
507  break;
508  if (indexAndNames_[midpoint].startInProcessNames() == startProcess) {
509  return midpoint;
510  }
511  }
512  }
513  break;
514  }
515  } else if (*namePtr < *instanceName) {
516  if (begin == midpoint)
517  break;
518  begin = midpoint;
519  } else {
520  end = midpoint;
521  }
522  } else if (*namePtr < *label) {
523  if (begin == midpoint)
524  break;
525  begin = midpoint;
526  } else {
527  end = midpoint;
528  }
529  } // end while (begin < end)
530  }
532  }
533 
534  unsigned int ProductResolverIndexHelper::indexToType(KindOfType kindOfType, TypeID const& typeID) const {
535  unsigned int beginType = 0;
536  unsigned int endType = beginElements_;
537  if (kindOfType == ELEMENT_TYPE) {
538  beginType = beginElements_;
539  endType = sortedTypeIDs_.size();
540  }
541 
542  while (beginType < endType) {
543  unsigned int midpointType = beginType + ((endType - beginType) / 2);
544  if (sortedTypeIDs_[midpointType] == typeID) {
545  return midpointType; // Found it
546  } else if (sortedTypeIDs_[midpointType] < typeID) {
547  if (beginType == midpointType)
548  break;
549  beginType = midpointType;
550  } else {
551  endType = midpointType;
552  }
553  }
554  return std::numeric_limits<unsigned int>::max(); // Failed to find it
555  }
556 
557  unsigned int ProductResolverIndexHelper::processIndex(char const* process) const {
558  char const* ptr = &processNames_[0];
559  char const* begin = ptr;
560  while (true) {
561  char const* p = process;
562  char const* beginName = ptr;
563  while (*ptr && (*ptr == *p)) {
564  ++ptr;
565  ++p;
566  }
567  if (*ptr == *p) {
568  return beginName - begin;
569  }
570  while (*ptr) {
571  ++ptr;
572  }
573  ++ptr;
574  if (static_cast<unsigned>(ptr - begin) >= processNames_.size()) {
576  }
577  }
578  return 0;
579  }
580 
582  const std::string& iProcessName) const {
584  for (unsigned int i = 0; i < beginElements_; ++i) {
585  auto const& range = ranges_[i];
586  for (unsigned int j = range.begin(); j < range.end(); ++j) {
587  auto const& indexAndNames = indexAndNames_[j];
588  if (0 == strcmp(&processNames_[indexAndNames.startInProcessNames()], iProcessName.c_str())) {
589  //The first null terminated string is the module label
590  auto pModLabel = &bigNamesContainer_[indexAndNames.startInBigNamesContainer()];
591  auto l = strlen(pModLabel);
592  auto pInstance = pModLabel + l + 1;
593  result.emplace(pModLabel, std::make_tuple(&sortedTypeIDs_[i], pInstance, indexAndNames.index()));
594  }
595  }
596  }
597  return result;
598  }
599 
601  bool sanityChecksPass = true;
602  if (sortedTypeIDs_.size() != ranges_.size())
603  sanityChecksPass = false;
604 
605  unsigned int previousEnd = 0;
606  for (auto const& range : ranges_) {
607  if (range.begin() != previousEnd)
608  sanityChecksPass = false;
609  if (range.begin() >= range.end())
610  sanityChecksPass = false;
611  previousEnd = range.end();
612  }
613  if (previousEnd != indexAndNames_.size())
614  sanityChecksPass = false;
615 
616  unsigned maxStart = 0;
617  unsigned maxStartProcess = 0;
618  for (auto const& indexAndName : indexAndNames_) {
619  if (indexAndName.index() >= nextIndexValue_ && indexAndName.index() != ProductResolverIndexAmbiguous)
620  sanityChecksPass = false;
621 
622  if (indexAndName.startInBigNamesContainer() >= bigNamesContainer_.size())
623  sanityChecksPass = false;
624  if (indexAndName.startInProcessNames() >= processNames_.size())
625  sanityChecksPass = false;
626 
627  if (indexAndName.startInBigNamesContainer() > maxStart)
628  maxStart = indexAndName.startInBigNamesContainer();
629  if (indexAndName.startInProcessNames() > maxStartProcess)
630  maxStartProcess = indexAndName.startInProcessNames();
631  }
632 
633  if (!indexAndNames_.empty()) {
634  if (bigNamesContainer_.back() != '\0')
635  sanityChecksPass = false;
636  if (processNames_.back() != '\0')
637  sanityChecksPass = false;
638  if (maxStart >= bigNamesContainer_.size())
639  sanityChecksPass = false;
640  unsigned int countZeroes = 0;
641  for (unsigned j = maxStart; j < bigNamesContainer_.size(); ++j) {
642  if (bigNamesContainer_[j] == '\0') {
643  ++countZeroes;
644  }
645  }
646  if (countZeroes != 2)
647  sanityChecksPass = false;
648  if (maxStartProcess >= processNames_.size())
649  sanityChecksPass = false;
650  countZeroes = 0;
651  for (unsigned j = maxStartProcess; j < processNames_.size(); ++j) {
652  if (processNames_[j] == '\0') {
653  ++countZeroes;
654  }
655  }
656  if (countZeroes != 1)
657  sanityChecksPass = false;
658  }
659 
660  if (!sanityChecksPass) {
661  throw Exception(errors::LogicError) << "ProductResolverIndexHelper::setFrozen - Detected illegal state.\n";
662  }
663  }
664 
666  TypeID const& typeID,
667  std::string const& moduleLabel,
668  std::string const& instance,
669  std::string const& process,
671  : kindOfType_(kindOfType),
672  typeID_(typeID),
673  moduleLabel_(moduleLabel),
674  instance_(instance),
675  process_(process),
676  index_(index) {}
677 
679  if (kindOfType_ < right.kindOfType_)
680  return true;
681  if (kindOfType_ > right.kindOfType_)
682  return false;
683  if (typeID_ < right.typeID_)
684  return true;
685  if (typeID_ > right.typeID_)
686  return false;
687  if (moduleLabel_ < right.moduleLabel_)
688  return true;
689  if (moduleLabel_ > right.moduleLabel_)
690  return false;
691  if (instance_ < right.instance_)
692  return true;
693  if (instance_ > right.instance_)
694  return false;
695  return process_ < right.process_;
696  }
697 
698  void ProductResolverIndexHelper::print(std::ostream& os) const {
699  os << "\n******* Dump ProductResolverIndexHelper *************************\n";
700 
701  os << "\nnextIndexValue_ = " << nextIndexValue_ << "\n";
702  os << "beginElements_ = " << beginElements_ << "\n";
703 
704  os << "\n******* sortedTypeIDs_ \n";
705  for (auto const& i : sortedTypeIDs_) {
706  os << i << "\n";
707  }
708  os << "******* ranges_ \n";
709  for (auto const& i : ranges_) {
710  os << i.begin() << " " << i.end() << "\n";
711  }
712  os << "******* indexAndNames_ \n";
713  for (auto const& i : indexAndNames_) {
714  os << i.index() << " " << i.startInBigNamesContainer() << " ";
715  char const* ptr = &bigNamesContainer_[i.startInBigNamesContainer()];
716  while (*ptr) {
717  os << *ptr;
718  ++ptr;
719  }
720  ++ptr;
721  os << " ";
722  while (*ptr) {
723  os << *ptr;
724  ++ptr;
725  }
726  os << " " << i.startInProcessNames() << " ";
727  ptr = &processNames_[i.startInProcessNames()];
728  while (*ptr) {
729  os << *ptr;
730  ++ptr;
731  }
732  os << "\n";
733  }
734  os << "******* bigNamesContainer_ \n";
735  for (auto i : bigNamesContainer_) {
736  if (i == '\0')
737  os << '\\' << '0';
738  else
739  os << i;
740  }
741  if (!bigNamesContainer_.empty())
742  os << "\n";
743  os << "******* processNames_ \n";
744  for (auto i : processNames_) {
745  if (i == '\0')
746  os << '\\' << '0';
747  else
748  os << i;
749  }
750  if (!processNames_.empty())
751  os << "\n";
752  if (items_) {
753  os << "******* items_ \n";
754  for (auto const& item : *items_) {
755  std::cout << item.kindOfType() << " " << item.moduleLabel() << " " << item.instance() << " " << item.process()
756  << " " << item.index() << " " << item.typeID() << "\n";
757  }
758  }
759  if (processItems_) {
760  os << "******* processItems_ \n";
761  for (auto const& item : *processItems_) {
762  os << item << "\n";
763  }
764  }
765  os << "sortedTypeIDs_.size() = " << sortedTypeIDs_.size() << "\n";
766  os << "indexAndNames_.size() = " << indexAndNames_.size() << "\n";
767  os << "bigNamesContainer_.size() = " << bigNamesContainer_.size() << "\n";
768  os << "processNames_.size() = " << processNames_.size() << "\n";
769  os << "\n";
770  }
771 } // namespace edm
unsigned int processIndex(char const *process) const
Definition: start.py:1
TypeID getContainedType(TypeID const &typeID)
unsigned int ProductResolverIndex
bool public_base_classes(std::vector< std::string > &missingDictionaries, TypeID const &typeID, std::vector< TypeID > &baseTypes)
Item(KindOfType kindOfType, TypeID const &typeID, std::string const &moduleLabel, std::string const &instance, std::string const &process, ProductResolverIndex index)
TypeID getContainedTypeFromWrapper(TypeID const &wrappedtypeID, std::string const &className)
PixelRecoRange< float > Range
static PFTauRenderPlugin instance
base
Main Program
Definition: newFWLiteAna.py:92
ModulesToIndiciesMap indiciesForModulesInProcess(const std::string &iProcessName) const
Matches relatedIndexes(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance) const
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:74
char const * label
Matches(ProductResolverIndexHelper const *productResolverIndexHelper, unsigned int startInIndexAndNames, unsigned int numberOfMatches)
edm::propagate_const< std::unique_ptr< std::set< std::string > > > processItems_
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=nullptr) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
unsigned int indexToIndexAndNames(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process) const
bool typeIsViewCompatible(TypeID const &requestedViewType, TypeID const &wrappedtypeID, std::string const &className)
char const * moduleLabel(unsigned int i) const
ProductResolverIndex index(unsigned int i) const
std::string const & className() const
Definition: TypeID.cc:40
std::vector< IndexAndNames > indexAndNames_
char const * processName(unsigned int i) const
std::vector< std::string > lookupProcessNames_
std::type_info const & typeInfo() const
std::string wrappedClassName(std::string const &iFullName)
ProductResolverIndex insert(TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process, TypeID const &containedTypeID, std::vector< TypeID > *baseTypesOfContainedType)
unsigned int indexToType(KindOfType kindOfType, TypeID const &typeID) const
HLT enums.
std::vector< IndexAndNames > const & indexAndNames() const
ProductResolverIndexHelper const * productResolverIndexHelper_
std::vector< std::string > const & lookupProcessNames() const
constexpr const std::type_info & typeInfo() const
Definition: TypeIDBase.h:50
std::unordered_multimap< std::string, std::tuple< TypeID const *, const char *, ProductResolverIndex > > ModulesToIndiciesMap
edm::propagate_const< std::unique_ptr< std::set< Item > > > items_
std::string className(const T &t)
Definition: ClassName.h:31
char const * productInstanceName(unsigned int i) const