CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
FWSimpleRepresentationChecker Class Reference

#include <Fireworks/Core/interface/FWSimpleRepresentationChecker.h>

Inheritance diagram for FWSimpleRepresentationChecker:
FWRepresentationCheckerBase

Public Member Functions

 FWSimpleRepresentationChecker (const std::string &iTypeidName, const std::string &iPurpose, unsigned int iBitPackedViews, bool iRepresentsSubPart, bool iRequiresFF=false)
 
 FWSimpleRepresentationChecker (const FWSimpleRepresentationChecker &)=delete
 
FWRepresentationInfo infoFor (const std::string &iTypeName) const override
 
const FWSimpleRepresentationCheckeroperator= (const FWSimpleRepresentationChecker &)=delete
 
 ~FWSimpleRepresentationChecker () override
 
- Public Member Functions inherited from FWRepresentationCheckerBase
unsigned int bitPackedViews () const
 
 FWRepresentationCheckerBase (const std::string &iPurpose, unsigned int iBitPackedViews, bool iRepresentsSubPart, bool iRequiresFF=false)
 
 FWRepresentationCheckerBase (const FWRepresentationCheckerBase &)=delete
 
const FWRepresentationCheckerBaseoperator= (const FWRepresentationCheckerBase &)=delete
 
const std::string & purpose () const
 
bool representsSubPart () const
 
bool requiresFF () const
 
virtual ~FWRepresentationCheckerBase ()
 

Static Public Member Functions

static bool inheritsFrom (const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
 

Private Attributes

const std::string m_typeidName
 

Detailed Description

Description: Used to check to see if a Simple proxy builder could be used to represent a particular type

Usage: <usage>

Definition at line 29 of file FWSimpleRepresentationChecker.h.

Constructor & Destructor Documentation

◆ FWSimpleRepresentationChecker() [1/2]

FWSimpleRepresentationChecker::FWSimpleRepresentationChecker ( const std::string &  iTypeidName,
const std::string &  iPurpose,
unsigned int  iBitPackedViews,
bool  iRepresentsSubPart,
bool  iRequiresFF = false 
)

Definition at line 37 of file FWSimpleRepresentationChecker.cc.

42  : FWRepresentationCheckerBase(iPurpose, iBitPackedViews, iRepresentsSubPart, iRequiresFF),
43  m_typeidName(iTypeName) {}
FWRepresentationCheckerBase(const std::string &iPurpose, unsigned int iBitPackedViews, bool iRepresentsSubPart, bool iRequiresFF=false)

◆ ~FWSimpleRepresentationChecker()

FWSimpleRepresentationChecker::~FWSimpleRepresentationChecker ( )
override

Definition at line 50 of file FWSimpleRepresentationChecker.cc.

50 {}

◆ FWSimpleRepresentationChecker() [2/2]

FWSimpleRepresentationChecker::FWSimpleRepresentationChecker ( const FWSimpleRepresentationChecker )
delete

Member Function Documentation

◆ infoFor()

FWRepresentationInfo FWSimpleRepresentationChecker::infoFor ( const std::string &  iTypeName) const
overridevirtual

Implements FWRepresentationCheckerBase.

Definition at line 97 of file FWSimpleRepresentationChecker.cc.

References FWItemAccessorFactory::accessorFor(), FWRepresentationCheckerBase::bitPackedViews(), HLT_2022v12_cff::distance, inheritsFrom(), m_typeidName, FWRepresentationCheckerBase::purpose(), FWRepresentationCheckerBase::representsSubPart(), and FWRepresentationCheckerBase::requiresFF().

Referenced by FWDetailViewManager::findViewersFor().

97  {
98  unsigned int distance = 1;
99 
100  FWItemAccessorFactory factory;
101  //std::cout<<"checker infoFor"<<iTypeName<<std::endl;
102  TClass* clss = TClass::GetClass(iTypeName.c_str());
103  //Class could be unknown if the dictionary for it has not been loaded
104  if (nullptr == clss || nullptr == clss->GetTypeInfo()) {
105  return FWRepresentationInfo();
106  }
107  std::shared_ptr<FWItemAccessorBase> accessor = factory.accessorFor(clss);
108 
109  const TClass* modelClass = accessor->modelType();
110  //std::cout <<" "<<modelClass->GetName()<<" "<< bool(modelClass == clss)<< std::endl;
111 
112  if (nullptr == modelClass || nullptr == modelClass->GetTypeInfo()) {
113  //some containers e.g. vector<int> do not have known TClasses for their elements
114  // or the contained type may be unknown to ROOT
115  return FWRepresentationInfo();
116  }
117  edm::TypeWithDict modelType(*(modelClass->GetTypeInfo()));
118  //see if the modelType inherits from our type
119 
120  if (inheritsFrom(modelType, m_typeidName, distance)) {
122  }
123  return FWRepresentationInfo();
124 }
std::shared_ptr< FWItemAccessorBase > accessorFor(const TClass *) const
static bool inheritsFrom(const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
const std::string & purpose() const

◆ inheritsFrom()

bool FWSimpleRepresentationChecker::inheritsFrom ( const edm::TypeWithDict iChild,
const std::string &  iParentTypeName,
unsigned int &  distance 
)
static

Definition at line 71 of file FWSimpleRepresentationChecker.cc.

References newFWLiteAna::base, HLT_2022v12_cff::distance, edm::TypeWithDict::getClass(), edm::TypeBases::size(), and edm::TypeWithDict::typeInfo().

Referenced by infoFor(), and FWEveViewManager::newItem().

73  {
74  if (iChild.getClass()) {
75  if (iChild.getClass()->GetTypeInfo() == nullptr) {
76  return false;
77  }
78  }
79 
80  if (iChild.typeInfo().name() == iParentTypeName) {
81  return true;
82  }
83  edm::TypeBases bases(iChild);
84  if (bases.size() == 0) {
85  return false;
86  }
87  ++distance;
88  for (auto const& base : bases) {
89  if (inheritsFrom(edm::BaseWithDict(base).typeOf(), iParentTypeName, distance)) {
90  return true;
91  }
92  }
93  --distance;
94  return false;
95 }
base
Main Program
Definition: newFWLiteAna.py:92
static bool inheritsFrom(const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
std::type_info const & typeInfo() const
TClass * getClass() const

◆ operator=()

const FWSimpleRepresentationChecker& FWSimpleRepresentationChecker::operator= ( const FWSimpleRepresentationChecker )
delete

Member Data Documentation

◆ m_typeidName

const std::string FWSimpleRepresentationChecker::m_typeidName
private

Definition at line 52 of file FWSimpleRepresentationChecker.h.

Referenced by infoFor().