CMS 3D CMS Logo

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

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

Public Member Functions

void add (std::shared_ptr< FWRepresentationCheckerBase > iChecker)
 
 FWTypeToRepresentations ()
 
void insert (const FWTypeToRepresentations &)
 
const std::vector< FWRepresentationInfo > & representationsForType (const std::string &iTypeName) const
 
virtual ~FWTypeToRepresentations ()
 

Private Attributes

std::vector< std::shared_ptr< FWRepresentationCheckerBase > > m_checkers
 
std::map< std::string, std::vector< FWRepresentationInfo > > m_typeToReps
 

Detailed Description

Description: For a given C++ type, gives back a list of what 'Representations' are available

Usage: <usage>

Definition at line 33 of file FWTypeToRepresentations.h.

Constructor & Destructor Documentation

FWTypeToRepresentations::FWTypeToRepresentations ( )

Definition at line 32 of file FWTypeToRepresentations.cc.

33 {
34 }
FWTypeToRepresentations::~FWTypeToRepresentations ( )
virtual

Definition at line 41 of file FWTypeToRepresentations.cc.

42 {
43 }

Member Function Documentation

void FWTypeToRepresentations::add ( std::shared_ptr< FWRepresentationCheckerBase iChecker)

Definition at line 61 of file FWTypeToRepresentations.cc.

References info(), FWRepresentationInfo::isValid(), m_checkers, and m_typeToReps.

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), SequenceTypes.Task::replace(), and FWEveViewManager::supportedTypesAndRepresentations().

62 {
63  m_checkers.push_back(iChecker);
64  if(!m_typeToReps.empty()) {
65  //see if this works with types we already know about
66  for(TypeToReps::iterator it = m_typeToReps.begin(), itEnd = m_typeToReps.end();
67  it != itEnd;
68  ++it) {
69  FWRepresentationInfo info = iChecker->infoFor(it->first);
70  if(info.isValid()) {
71  //NOTE TO SELF: should probably sort by proximity
72  it->second.push_back(info);
73  }
74  }
75  }
76 }
std::vector< std::shared_ptr< FWRepresentationCheckerBase > > m_checkers
static const TGPicture * info(bool iBackgroundIsBlack)
std::map< std::string, std::vector< FWRepresentationInfo > > m_typeToReps
void FWTypeToRepresentations::insert ( const FWTypeToRepresentations iOther)

Definition at line 78 of file FWTypeToRepresentations.cc.

References m_checkers, and m_typeToReps.

Referenced by FWViewManagerManager::supportedTypesAndRepresentations().

79 {
80  m_typeToReps.clear();
81  for(std::vector<std::shared_ptr<FWRepresentationCheckerBase> >::const_iterator it =iOther.m_checkers.begin(),
82  itEnd = iOther.m_checkers.end();
83  it != itEnd;
84  ++it) {
85  m_checkers.push_back(*it);
86  }
87 }
std::vector< std::shared_ptr< FWRepresentationCheckerBase > > m_checkers
std::map< std::string, std::vector< FWRepresentationInfo > > m_typeToReps
const std::vector< FWRepresentationInfo > & FWTypeToRepresentations::representationsForType ( const std::string &  iTypeName) const

Definition at line 93 of file FWTypeToRepresentations.cc.

References info(), FWRepresentationInfo::isValid(), m_checkers, and m_typeToReps.

Referenced by FWLiteJobMetadataManager::doUpdate(), and FWFFMetadataManager::doUpdate().

94 {
95  TypeToReps::const_iterator itFound = m_typeToReps.find(iTypeName);
96  if(itFound == m_typeToReps.end()) {
97  std::vector<FWRepresentationInfo> reps;
98  //check all reps
99  for(std::vector<std::shared_ptr<FWRepresentationCheckerBase> >::const_iterator it = m_checkers.begin(),
100  itEnd = m_checkers.end();
101  it != itEnd;
102  ++it) {
103 
104  FWRepresentationInfo info = (*it)->infoFor(iTypeName);
105  if(info.isValid())
106  reps.push_back(info);
107  }
108 
109  m_typeToReps.insert(std::make_pair(iTypeName,reps));
110  itFound = m_typeToReps.find(iTypeName);
111  }
112 
113  return itFound->second;
114 }
std::vector< std::shared_ptr< FWRepresentationCheckerBase > > m_checkers
static const TGPicture * info(bool iBackgroundIsBlack)
std::map< std::string, std::vector< FWRepresentationInfo > > m_typeToReps

Member Data Documentation

std::vector<std::shared_ptr<FWRepresentationCheckerBase> > FWTypeToRepresentations::m_checkers
private

Definition at line 55 of file FWTypeToRepresentations.h.

Referenced by add(), insert(), and representationsForType().

std::map<std::string, std::vector<FWRepresentationInfo> > FWTypeToRepresentations::m_typeToReps
mutableprivate

Definition at line 54 of file FWTypeToRepresentations.h.

Referenced by add(), insert(), and representationsForType().