CMS 3D CMS Logo

Functions
edm::productholderindexhelper Namespace Reference

Functions

TypeID getContainedType (TypeID const &typeID)
 
TypeID getContainedTypeFromWrapper (TypeID const &wrappedtypeID, std::string const &className)
 

Function Documentation

◆ getContainedType()

TypeID edm::productholderindexhelper::getContainedType ( TypeID const &  typeID)

Definition at line 67 of file ProductResolverIndexHelper.cc.

67  {
68  const std::string& className = typeID.className();
69  TypeWithDict const wrappedType = TypeWithDict::byName(wrappedClassName(className));
70  TypeID const wrappedTypeID = TypeID(wrappedType.typeInfo());
71  return getContainedTypeFromWrapper(wrappedTypeID, className);
72  }

References edm::TypeWithDict::byName(), className(), edm::TypeID::className(), getContainedTypeFromWrapper(), AlCaHLTBitMon_QueryRunRegistry::string, edm::TypeWithDict::typeInfo(), and edm::wrappedClassName().

Referenced by edm::ProductResolverIndexHelper::insert().

◆ getContainedTypeFromWrapper()

TypeID edm::productholderindexhelper::getContainedTypeFromWrapper ( TypeID const &  wrappedtypeID,
std::string const &  className 
)

Definition at line 19 of file ProductResolverIndexHelper.cc.

19  {
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  }

References GetRecoTauVFromDQM_MC_cff::cl, className(), edm::TypeID::className(), hltrates_dqm_sourceclient-live_cfg::offset, AlCaHLTBitMon_ParallelJobs::p, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::ProductRegistry::checkDictionariesOfConsumedTypes(), getContainedType(), and edm::ProductRegistry::initializeLookupTables().

AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::productholderindexhelper::getContainedTypeFromWrapper
TypeID getContainedTypeFromWrapper(TypeID const &wrappedtypeID, std::string const &className)
Definition: ProductResolverIndexHelper.cc:19
GetRecoTauVFromDQM_MC_cff.cl
cl
Definition: GetRecoTauVFromDQM_MC_cff.py:38
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::wrappedClassName
std::string wrappedClassName(std::string const &iFullName)
Definition: WrappedClassName.cc:4
className
std::string className(const T &t)
Definition: ClassName.h:31
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82