CMS 3D CMS Logo

Functions
edm::productholderindexhelper Namespace Reference

Functions

TypeID getContainedType (TypeID const &typeID)
 
TypeID getContainedTypeFromWrapper (TypeID const &wrappedtypeID, std::string const &className)
 
bool typeIsViewCompatible (TypeID const &requestedViewType, 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.

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

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

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  }
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:31

◆ getContainedTypeFromWrapper()

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

Definition at line 19 of file ProductResolverIndexHelper.cc.

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

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

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  }
std::string className(const T &t)
Definition: ClassName.h:31

◆ typeIsViewCompatible()

bool edm::productholderindexhelper::typeIsViewCompatible ( TypeID const &  requestedViewType,
TypeID const &  wrappedtypeID,
std::string const &  className 
)

Definition at line 74 of file ProductResolverIndexHelper.cc.

References newFWLiteAna::base, className(), getContainedTypeFromWrapper(), or, and edm::public_base_classes().

Referenced by edm::StreamSchedule::tryToPlaceConditionalModules().

76  {
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  }
bool public_base_classes(std::vector< std::string > &missingDictionaries, TypeID const &typeID, std::vector< TypeID > &baseTypes)
TypeID getContainedTypeFromWrapper(TypeID const &wrappedtypeID, std::string const &className)
base
Main Program
Definition: newFWLiteAna.py:92
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
std::string className(const T &t)
Definition: ClassName.h:31