CMS 3D CMS Logo

Public Member Functions | Private Attributes

FWTypeToRepresentations Class Reference

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

List of all members.

Public Member Functions

void add (boost::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< boost::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 34 of file FWTypeToRepresentations.h.


Constructor & Destructor Documentation

FWTypeToRepresentations::FWTypeToRepresentations ( )

Definition at line 33 of file FWTypeToRepresentations.cc.

{
}
FWTypeToRepresentations::~FWTypeToRepresentations ( ) [virtual]

Definition at line 42 of file FWTypeToRepresentations.cc.

{
}

Member Function Documentation

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

Definition at line 62 of file FWTypeToRepresentations.cc.

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

Referenced by FWEveViewManager::supportedTypesAndRepresentations().

{
   m_checkers.push_back(iChecker);
   if(m_typeToReps.size()) {
      //see if this works with types we already know about
      for(TypeToReps::iterator it = m_typeToReps.begin(), itEnd = m_typeToReps.end();
          it != itEnd;
          ++it) {
         FWRepresentationInfo info = iChecker->infoFor(it->first);
         if(info.isValid()) {
            //NOTE TO SELF: should probably sort by proximity
            it->second.push_back(info);
         }
      }
   }
}
void FWTypeToRepresentations::insert ( const FWTypeToRepresentations iOther)

Definition at line 79 of file FWTypeToRepresentations.cc.

References m_checkers, and m_typeToReps.

Referenced by FWViewManagerManager::supportedTypesAndRepresentations().

{
   m_typeToReps.clear();
   for(std::vector<boost::shared_ptr<FWRepresentationCheckerBase> >::const_iterator it =iOther.m_checkers.begin(),
                                                                                    itEnd = iOther.m_checkers.end();
       it != itEnd;
       ++it) {
      m_checkers.push_back(*it);
   }
}
const std::vector< FWRepresentationInfo > & FWTypeToRepresentations::representationsForType ( const std::string &  iTypeName) const

Definition at line 94 of file FWTypeToRepresentations.cc.

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

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

{
   TypeToReps::const_iterator itFound = m_typeToReps.find(iTypeName);
   if(itFound == m_typeToReps.end()) {
      std::vector<FWRepresentationInfo> reps;
      //check all reps
      for(std::vector<boost::shared_ptr<FWRepresentationCheckerBase> >::const_iterator it = m_checkers.begin(),
                                                                                       itEnd = m_checkers.end();
          it != itEnd;
          ++it) {
         FWRepresentationInfo info = (*it)->infoFor(iTypeName);
         if(info.isValid()) {
            reps.push_back(info);
         }
      }
      m_typeToReps.insert(std::make_pair(iTypeName,reps));
      itFound = m_typeToReps.find(iTypeName);
   }

   return itFound->second;
}

Member Data Documentation

std::vector<boost::shared_ptr<FWRepresentationCheckerBase> > FWTypeToRepresentations::m_checkers [private]

Definition at line 56 of file FWTypeToRepresentations.h.

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

std::map<std::string, std::vector<FWRepresentationInfo> > FWTypeToRepresentations::m_typeToReps [mutable, private]

Definition at line 55 of file FWTypeToRepresentations.h.

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