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 49 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().

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