#include <Fireworks/Core/interface/FWEventItemsManager.h>
Description: Manages multiple FWEventItems
Usage: <usage>
Definition at line 45 of file FWEventItemsManager.h.
typedef std::vector<FWEventItem*>::const_iterator FWEventItemsManager::const_iterator |
Definition at line 52 of file FWEventItemsManager.h.
FWEventItemsManager::FWEventItemsManager | ( | FWModelChangeManager * | iManager | ) |
Definition at line 41 of file FWEventItemsManager.cc.
: m_changeManager(iManager), m_context(0), m_event(0), m_accessorFactory(new FWItemAccessorFactory()) { }
FWEventItemsManager::~FWEventItemsManager | ( | ) | [virtual] |
FWEventItemsManager has ownership of the items it contains.
Note that because of the way we keep track of removed items, m_items[i] could actually be 0 for indices corresponding to removed items.
Definition at line 60 of file FWEventItemsManager.cc.
References alignCSCRings::e, i, and m_items.
FWEventItemsManager::FWEventItemsManager | ( | const FWEventItemsManager & | ) | [private] |
const FWEventItem * FWEventItemsManager::add | ( | const FWPhysicsObjectDesc & | iItem, |
const FWConfiguration * | pbConf = 0 |
||
) |
Definition at line 84 of file FWEventItemsManager.cc.
References FWDisplayProperties::color(), FWColorManager::colorHasIndex(), fireworks::Context::colorManager(), FWPhysicsObjectDesc::displayProperties(), fwLog, FWColorManager::getDefaultStartColorIndex(), fwlog::kWarning, m_accessorFactory, m_changeManager, m_context, m_event, m_items, newItem_, removeItem(), FWPhysicsObjectDesc::setDisplayProperties(), groupFilesInBlocks::temp, and FWPhysicsObjectDesc::type().
Referenced by FWGUIEventDataAdder::addNewItem(), and setFrom().
{ FWPhysicsObjectDesc temp(iItem); if(! m_context->colorManager()->colorHasIndex(temp.displayProperties().color())) { FWDisplayProperties prop(temp.displayProperties()); fwLog(fwlog::kWarning) << Form("FWEventItemsManager::add(const FWPhysicsObjectDesc& iItem), color index not valid. Set Color idex to %d\n", FWColorManager::getDefaultStartColorIndex()); prop.setColor(FWColorManager::getDefaultStartColorIndex()); temp.setDisplayProperties(prop); } m_items.push_back(new FWEventItem(m_context,m_items.size(),m_accessorFactory->accessorFor(temp.type()), temp, pbc)); newItem_(m_items.back()); m_items.back()->goingToBeDestroyed_.connect(boost::bind(&FWEventItemsManager::removeItem,this,_1)); if(m_event) { FWChangeSentry sentry(*m_changeManager); m_items.back()->setEvent(m_event); } return m_items.back(); }
void FWEventItemsManager::addTo | ( | FWConfiguration & | iTo | ) | const [virtual] |
Implements FWConfigurable.
Definition at line 157 of file FWEventItemsManager.cc.
References FWConfiguration::addKeyValue(), fireworks::Context::colorManager(), dbtoconf::conf, dtTPAnalyzer_cfg::dataType, kColor(), kFalse(), kFilterExpression(), kIsVisible(), kLayer(), kModuleLabel(), kProcessName(), kProductInstanceLabel(), kPurpose(), kTransparency(), kTrue(), kType(), m_context, and m_items.
{ FWColorManager* cm = m_context->colorManager(); assert(0!=cm); for(std::vector<FWEventItem*>::const_iterator it = m_items.begin(); it != m_items.end(); ++it) { if(!*it) continue; FWConfiguration conf(6); ROOT::Reflex::Type dataType( ROOT::Reflex::Type::ByTypeInfo(*((*it)->type()->GetTypeInfo()))); assert(dataType != ROOT::Reflex::Type() ); conf.addKeyValue(kType,FWConfiguration(dataType.Name(ROOT::Reflex::SCOPED))); conf.addKeyValue(kModuleLabel,FWConfiguration((*it)->moduleLabel())); conf.addKeyValue(kProductInstanceLabel, FWConfiguration((*it)->productInstanceLabel())); conf.addKeyValue(kProcessName, FWConfiguration((*it)->processName())); conf.addKeyValue(kFilterExpression, FWConfiguration((*it)->filterExpression())); { std::ostringstream os; os << (*it)->defaultDisplayProperties().color(); conf.addKeyValue(kColor, FWConfiguration(os.str())); } conf.addKeyValue(kIsVisible, FWConfiguration((*it)->defaultDisplayProperties().isVisible() ? kTrue : kFalse)); { std::ostringstream os; os << (*it)->layer(); conf.addKeyValue(kLayer,FWConfiguration(os.str())); } conf.addKeyValue(kPurpose,(*it)->purpose()); { std::ostringstream os; os << static_cast<int>((*it)->defaultDisplayProperties().transparency()); conf.addKeyValue(kTransparency, FWConfiguration(os.str())); } FWConfiguration pbTmp; (*it)->getConfig()->addTo(pbTmp); conf.addKeyValue("PBConfig",pbTmp, true); iTo.addKeyValue((*it)->name(), conf, true); } }
FWEventItemsManager::const_iterator FWEventItemsManager::begin | ( | void | ) | const |
NOTE: iterator is allowed to return a null object for items that have been removed.
Definition at line 321 of file FWEventItemsManager.cc.
References m_items.
Referenced by FWGUIEventDataAdder::addNewItem(), FWEventItem::isInBack(), FWEventItem::isInFront(), FWEventItem::moveToBack(), FWEventItem::moveToFront(), FWFileEntry::runFilter(), and CmsShowMain::setupDataHandling().
{ return m_items.begin(); }
void FWEventItemsManager::clearItems | ( | void | ) |
Clear all the items in the model.
Notice that a previous implementation was setting all the items to 0, I guess to track accessing delete items.
Definition at line 128 of file FWEventItemsManager.cc.
References FWEventItem::destroy(), alignCSCRings::e, goingToClearItems_, i, and m_items.
Referenced by setFrom().
FWEventItemsManager::const_iterator FWEventItemsManager::end | ( | void | ) | const |
Definition at line 326 of file FWEventItemsManager.cc.
References m_items.
Referenced by FWGUIEventDataAdder::addNewItem(), FWEventItem::isInBack(), FWEventItem::isInFront(), FWEventItem::moveToBack(), FWEventItem::moveToFront(), FWFileEntry::runFilter(), and CmsShowMain::setupDataHandling().
{ return m_items.end(); }
const FWEventItem * FWEventItemsManager::find | ( | const std::string & | iName | ) | const |
Look up an item by name.
Definition at line 334 of file FWEventItemsManager.cc.
References alignCSCRings::e, i, m_items, and FWEventItem::name().
Referenced by FWGUIEventDataAdder::addNewItem().
void FWEventItemsManager::newEvent | ( | const edm::EventBase * | iEvent | ) |
Prepare to handle a new event by associating all the items to watch it.
Definition at line 110 of file FWEventItemsManager.cc.
References alignCSCRings::e, i, iEvent, m_changeManager, m_event, m_items, and FWEventItem::setEvent().
{ FWChangeSentry sentry(*m_changeManager); m_event = iEvent; for(size_t i = 0, e = m_items.size(); i != e; ++i) { FWEventItem *item = m_items[i]; if(item) item->setEvent(iEvent); } }
const FWEventItemsManager& FWEventItemsManager::operator= | ( | const FWEventItemsManager & | ) | [private] |
void FWEventItemsManager::removeItem | ( | const FWEventItem * | iItem | ) | [private] |
Remove one item.
Notice that rather than erasing the item from the list, it is preferred to set it to zero, I guess to catch accesses to remove items and to avoid having to recalculate the current selection.
GE: I think this is a broken way of handling removal of objects. The object should be properly deleted and the current selection should be updated accordingly.
Definition at line 305 of file FWEventItemsManager.cc.
References FWEventItem::id(), and m_items.
Referenced by add().
void FWEventItemsManager::setContext | ( | fireworks::Context * | iContext | ) |
Definition at line 312 of file FWEventItemsManager.cc.
References m_context.
Referenced by CmsShowMain::CmsShowMain(), FWFFLooper::FWFFLooper(), and FWFFService::FWFFService().
{ m_context = iContext; }
void FWEventItemsManager::setFrom | ( | const FWConfiguration & | iFrom | ) | [virtual] |
This is responsible for resetting the status of items from configuration
Implements FWConfigurable.
Definition at line 204 of file FWEventItemsManager.cc.
References add(), FWConfiguration::addKeyValue(), clearItems(), fireworks::Context::colorManager(), dbtoconf::conf, FWConfiguration::keyValues(), kTrue(), m_context, mergeVDriftHistosByStation::name, FWColorManager::oldColorToIndex(), edm::second(), FWConfiguration::valueForKey(), and FWConfiguration::version().
{ FWColorManager* cm = m_context->colorManager(); assert(0!=cm); clearItems(); const FWConfiguration::KeyValues* keyValues = iFrom.keyValues(); if (keyValues == 0) return; for (FWConfiguration::KeyValues::const_iterator it = keyValues->begin(); it != keyValues->end(); ++it) { const std::string& name = it->first; const FWConfiguration& conf = it->second; const FWConfiguration::KeyValues* keyValues = conf.keyValues(); assert(0!=keyValues); const std::string& type = (*keyValues)[0].second.value(); const std::string& moduleLabel = (*keyValues)[1].second.value(); const std::string& productInstanceLabel = (*keyValues)[2].second.value(); const std::string& processName = (*keyValues)[3].second.value(); const std::string& filterExpression = (*keyValues)[4].second.value(); const std::string& sColor = (*keyValues)[5].second.value(); const bool isVisible = (*keyValues)[6].second.value() == kTrue; unsigned int colorIndex; if(conf.version() < 5) { std::istringstream is(sColor); Color_t color; is >> color; colorIndex = cm->oldColorToIndex(color, conf.version()); } else { // In version 4 we assume: // fireworks colors start at ROOT index 1000 // geometry colors start at ROOT index 1100 // We save them as such -- no conversions needed. std::istringstream is(sColor); is >> colorIndex; } int transparency = 0; // Read transparency from file. We don't care about checking errors // because strtol returns 0 in that case. if (conf.version() > 3) transparency = strtol((*keyValues)[9].second.value().c_str(), 0, 10); FWDisplayProperties dp(colorIndex, isVisible, transparency); unsigned int layer = strtol((*keyValues)[7].second.value().c_str(), 0, 10); //For older configs assume name is the same as purpose std::string purpose(name); if (conf.version() > 1) purpose = (*keyValues)[8].second.value(); FWConfiguration* proxyConfig = (FWConfiguration*) conf.valueForKey("PBConfig") ? new FWConfiguration(*conf.valueForKey("PBConfig")) : 0; // beckward compatibilty for obsolete proxy builders if (conf.version() < 6) { assert(proxyConfig == 0); if (purpose == "VerticesWithTracks") { purpose = "Vertices"; proxyConfig = new FWConfiguration(); FWConfiguration vTmp; vTmp.addKeyValue("Draw Tracks", FWConfiguration("1")); proxyConfig->addKeyValue("Var", vTmp,true); } } FWPhysicsObjectDesc desc(name, TClass::GetClass(type.c_str()), purpose, dp, moduleLabel, productInstanceLabel, processName, filterExpression, layer); add(desc, proxyConfig ); } }
sigc::signal<void> FWEventItemsManager::goingToClearItems_ |
Definition at line 76 of file FWEventItemsManager.h.
Referenced by clearItems(), FWSummaryManager::FWSummaryManager(), and CmsShowMainBase::setupViewManagers().
boost::shared_ptr<FWItemAccessorFactory> FWEventItemsManager::m_accessorFactory [private] |
Definition at line 90 of file FWEventItemsManager.h.
Referenced by add().
Definition at line 86 of file FWEventItemsManager.h.
Referenced by add(), and newEvent().
fireworks::Context* FWEventItemsManager::m_context [private] |
Definition at line 87 of file FWEventItemsManager.h.
Referenced by add(), addTo(), setContext(), and setFrom().
const edm::EventBase* FWEventItemsManager::m_event [private] |
Definition at line 89 of file FWEventItemsManager.h.
Referenced by add(), and newEvent().
std::vector<FWEventItem*> FWEventItemsManager::m_items [private] |
Definition at line 85 of file FWEventItemsManager.h.
Referenced by add(), addTo(), begin(), clearItems(), end(), find(), newEvent(), removeItem(), and ~FWEventItemsManager().
sigc::signal<void, FWEventItem*> FWEventItemsManager::newItem_ |
Definition at line 75 of file FWEventItemsManager.h.
Referenced by add(), FWGUIManager::FWGUIManager(), and FWSummaryManager::FWSummaryManager().