CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private 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)
 
FWRepresentationInfo infoFor (const std::string &iTypeName) const override
 
 ~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)
 
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 Member Functions

 FWSimpleRepresentationChecker (const FWSimpleRepresentationChecker &)=delete
 
const FWSimpleRepresentationCheckeroperator= (const FWSimpleRepresentationChecker &)=delete
 

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

◆ ~FWSimpleRepresentationChecker()

FWSimpleRepresentationChecker::~FWSimpleRepresentationChecker ( )
override

Definition at line 50 of file FWSimpleRepresentationChecker.cc.

50 {}

◆ FWSimpleRepresentationChecker() [2/2]

FWSimpleRepresentationChecker::FWSimpleRepresentationChecker ( const FWSimpleRepresentationChecker )
privatedelete

Member Function Documentation

◆ infoFor()

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

Implements FWRepresentationCheckerBase.

Definition at line 97 of file FWSimpleRepresentationChecker.cc.

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 }

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

Referenced by FWDetailViewManager::findViewersFor().

◆ inheritsFrom()

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

Definition at line 71 of file FWSimpleRepresentationChecker.cc.

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 }

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

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

◆ operator=()

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

Member Data Documentation

◆ m_typeidName

const std::string FWSimpleRepresentationChecker::m_typeidName
private

Definition at line 52 of file FWSimpleRepresentationChecker.h.

Referenced by infoFor().

FWSimpleRepresentationChecker::m_typeidName
const std::string m_typeidName
Definition: FWSimpleRepresentationChecker.h:52
FWItemAccessorFactory::accessorFor
std::shared_ptr< FWItemAccessorBase > accessorFor(const TClass *) const
Definition: FWItemAccessorFactory.cc:89
FWSimpleRepresentationChecker::inheritsFrom
static bool inheritsFrom(const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
Definition: FWSimpleRepresentationChecker.cc:71
FWItemAccessorFactory
Definition: FWItemAccessorFactory.h:31
edm::BaseWithDict
Definition: BaseWithDict.h:18
FWRepresentationCheckerBase::purpose
const std::string & purpose() const
Definition: FWRepresentationCheckerBase.cc:64
edm::TypeWithDict
Definition: TypeWithDict.h:38
FWRepresentationCheckerBase::bitPackedViews
unsigned int bitPackedViews() const
Definition: FWRepresentationCheckerBase.cc:66
edm::TypeWithDict::typeInfo
std::type_info const & typeInfo() const
Definition: TypeWithDict.cc:357
FWRepresentationCheckerBase::requiresFF
bool requiresFF() const
Definition: FWRepresentationCheckerBase.h:44
FWRepresentationInfo
Definition: FWRepresentationInfo.h:28
edm::TypeWithDict::getClass
TClass * getClass() const
Definition: TypeWithDict.cc:380
FWRepresentationCheckerBase::representsSubPart
bool representsSubPart() const
Definition: FWRepresentationCheckerBase.cc:68
FWRepresentationCheckerBase::FWRepresentationCheckerBase
FWRepresentationCheckerBase(const std::string &iPurpose, unsigned int iBitPackedViews, bool iRepresentsSubPart, bool iRequiresFF=false)
Definition: FWRepresentationCheckerBase.cc:29
edm::TypeBases
Definition: TypeWithDict.h:153
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
newFWLiteAna.base
base
Definition: newFWLiteAna.py:92