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)
 
virtual FWRepresentationInfo infoFor (const std::string &iTypeName) const
 
virtual ~FWSimpleRepresentationChecker ()
 
- 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 &)
 
const FWSimpleRepresentationCheckeroperator= (const FWSimpleRepresentationChecker &)
 

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::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.

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

Definition at line 52 of file FWSimpleRepresentationChecker.cc.

53 {
54 }
FWSimpleRepresentationChecker::FWSimpleRepresentationChecker ( const FWSimpleRepresentationChecker )
private

Member Function Documentation

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

Implements FWRepresentationCheckerBase.

Definition at line 103 of file FWSimpleRepresentationChecker.cc.

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

Referenced by FWDetailViewManager::findViewersFor().

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

Definition at line 75 of file FWSimpleRepresentationChecker.cc.

References runEdmFileComparison::base, SoftLeptonByDistance_cfi::distance, edm::TypeWithDict::getClass(), edm::TypeBases::size(), and edm::TypeWithDict::typeInfo().

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

77  {
78 
79  if (iChild.getClass()) {
80  if (iChild.getClass()->GetTypeInfo() == 0) {
81  return false;
82  }
83  }
84 
85  if(iChild.typeInfo().name() == iParentTypeName) {
86  return true;
87  }
88  edm::TypeBases bases(iChild);
89  if(bases.size() == 0) {
90  return false;
91  }
92  ++distance;
93  for(auto const& base : bases) {
94  if(inheritsFrom(edm::BaseWithDict(base).typeOf(),iParentTypeName,distance)) {
95  return true;
96  }
97  }
98  --distance;
99  return false;
100 }
static bool inheritsFrom(const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
TClass * getClass() const
std::type_info const & typeInfo() const
base
Make Sure CMSSW is Setup ##.
const FWSimpleRepresentationChecker& FWSimpleRepresentationChecker::operator= ( const FWSimpleRepresentationChecker )
private

Member Data Documentation

const std::string FWSimpleRepresentationChecker::m_typeidName
private

Definition at line 54 of file FWSimpleRepresentationChecker.h.

Referenced by infoFor().