CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
FWSimpleRepresentationChecker
operator= (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 96 of file FWSimpleRepresentationChecker.cc.

References FWItemAccessorFactory::accessorFor(), FWRepresentationCheckerBase::bitPackedViews(), HLT_25ns14e33_v1_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(0==clss || 0==clss->GetTypeInfo()) {
105  return FWRepresentationInfo();
106  }
107  boost::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(0==modelClass || 0 == 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 }
const std::string & purpose() const
static bool inheritsFrom(const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
boost::shared_ptr< FWItemAccessorBase > accessorFor(const TClass *) const
bool FWSimpleRepresentationChecker::inheritsFrom ( const edm::TypeWithDict iChild,
const std::string &  iParentTypeName,
unsigned int &  distance 
)
static

Definition at line 75 of file FWSimpleRepresentationChecker.cc.

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

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

77  {
78  if(iChild.typeInfo().name() == iParentTypeName) {
79  return true;
80  }
81  edm::TypeBases bases(iChild);
82  if(bases.size() == 0) {
83  return false;
84  }
85  ++distance;
86  for(auto const& base : bases) {
87  if(inheritsFrom(edm::BaseWithDict(base).typeOf(),iParentTypeName,distance)) {
88  return true;
89  }
90  }
91  --distance;
92  return false;
93 }
tuple 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
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().