CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
edm::productholderindexhelper Namespace Reference

Functions

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

Function Documentation

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

Definition at line 52 of file ProductHolderIndexHelper.cc.

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

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

52  {
53  std::string className = typeID.className();
54  TypeWithDict const wrappedType = TypeWithDict::byName(wrappedClassName(className));
55  TypeID const wrappedTypeID = TypeID(wrappedType.typeInfo());
56  return getContainedTypeFromWrapper(wrappedTypeID, className);
57  }
TypeID getContainedTypeFromWrapper(TypeID const &wrappedtypeID, std::string const &className)
std::string wrappedClassName(std::string const &iFullName)
std::string className(const T &t)
Definition: ClassName.h:30
TypeID edm::productholderindexhelper::getContainedTypeFromWrapper ( TypeID const &  wrappedtypeID,
std::string const &  className 
)

Definition at line 20 of file ProductHolderIndexHelper.cc.

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

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

20  {
21  static int const vtcOffset = 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 size_t const rvsize = refVector.size();
28  static size_t const rtbvsize = refToBaseVector.size();
29  static size_t const pvsize = ptrVector.size();
30  static size_t const vpsize = vectorPtr.size();
31  bool mayBeRefVector = (className.substr(0, rvsize) == refVector)
32  || (className.substr(0, rtbvsize) == refToBaseVector)
33  || (className.substr(0, pvsize) == ptrVector)
34  || (className.substr(0, vpsize) == vectorPtr);
35  TClass* cl = TClass::GetClass(wrappedTypeID.className().c_str());
36  if(cl == nullptr) {
37  return TypeID(typeid(void));
38  }
39  void* p = cl->New();
40  int offset = cl->GetBaseClassOffset(wbClass) + vtcOffset;;
41  std::unique_ptr<ViewTypeChecker> checker = getAnyPtr<ViewTypeChecker>(p, offset);
42  if(mayBeRefVector) {
43  std::type_info const& ti = checker->memberTypeInfo();
44  if(ti != typeid(void)) {
45  return TypeID(ti);
46  }
47  }
48  return TypeID(checker->valueTypeInfo());
49  }
std::string className(const T &t)
Definition: ClassName.h:30