CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/Fireworks/Core/src/FWTriggerTableViewManager.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Core
00004 // Class  :     FWTriggerTableViewManager
00005 //
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:
00010 //         Created:  Sun Jan  6 22:01:27 EST 2008
00011 // $Id: FWTriggerTableViewManager.cc,v 1.8 2012/09/27 16:51:25 eulisse Exp $
00012 //
00013 
00014 // system include files
00015 #include <cassert>
00016 #include <iostream>
00017 #include <boost/bind.hpp>
00018 
00019 // user include files
00020 
00021 #include "Fireworks/Core/interface/FWTriggerTableViewManager.h"
00022 #include "Fireworks/Core/interface/FWHLTTriggerTableView.h"
00023 #include "Fireworks/Core/interface/FWL1TriggerTableView.h"
00024 #include "Fireworks/Core/interface/FWEventItem.h"
00025 #include "Fireworks/Core/interface/FWGUIManager.h"
00026 #include "Fireworks/Core/interface/FWColorManager.h"
00027 #include "Fireworks/Core/interface/FWTypeToRepresentations.h"
00028 #include "Fireworks/Core/interface/FWJobMetadataManager.h"
00029 
00030 
00031 FWTriggerTableViewManager::FWTriggerTableViewManager(FWGUIManager* iGUIMgr) :
00032    FWViewManagerBase()
00033 {
00034    FWGUIManager::ViewBuildFunctor f;
00035    f=boost::bind(&FWTriggerTableViewManager::buildView,
00036                  this, _1, _2);
00037    iGUIMgr->registerViewBuilder(FWViewType::idToName(FWViewType::kTableHLT), f);
00038    iGUIMgr->registerViewBuilder(FWViewType::idToName(FWViewType::kTableL1), f);
00039 }
00040 
00041 FWTriggerTableViewManager::~FWTriggerTableViewManager()
00042 {
00043 }
00044 
00045 class FWViewBase*
00046 FWTriggerTableViewManager::buildView(TEveWindowSlot* iParent, const std::string& type)
00047 {
00048    boost::shared_ptr<FWTriggerTableView> view;
00049    
00050    if (type == FWViewType::sName[FWViewType::kTableHLT])
00051       view.reset( new FWHLTTriggerTableView(iParent));
00052    else
00053       view.reset( new FWL1TriggerTableView(iParent));
00054 
00055    view->setProcessList(&(context().metadataManager()->processNamesInJob()));   
00056  
00057    view->setBackgroundColor(colorManager().background());
00058    m_views.push_back(boost::shared_ptr<FWTriggerTableView> (view));
00059    view->beingDestroyed_.connect(boost::bind(&FWTriggerTableViewManager::beingDestroyed,
00060                                              this,_1));
00061    return view.get();
00062 }
00063 
00064 void
00065 FWTriggerTableViewManager::beingDestroyed(const FWViewBase* iView)
00066 {
00067    for(std::vector<boost::shared_ptr<FWTriggerTableView> >::iterator it=
00068           m_views.begin(), itEnd = m_views.end();
00069        it != itEnd;
00070        ++it) {
00071       if(it->get() == iView) {
00072          m_views.erase(it);
00073          return;
00074       }
00075    }
00076 }
00077 
00078 void
00079 FWTriggerTableViewManager::colorsChanged()
00080 {
00081    for(std::vector<boost::shared_ptr<FWTriggerTableView> >::iterator it=
00082           m_views.begin(), itEnd = m_views.end();
00083        it != itEnd;
00084        ++it) {
00085       (*it)->setBackgroundColor(colorManager().background());
00086    }
00087 }
00088 
00089 void
00090 FWTriggerTableViewManager::eventEnd()
00091 {
00092    for(std::vector<boost::shared_ptr<FWTriggerTableView> >::iterator it=
00093           m_views.begin(), itEnd = m_views.end();
00094        it != itEnd;
00095        ++it) {
00096       (*it)->dataChanged();
00097    }
00098 }
00099 
00100 void
00101 FWTriggerTableViewManager::updateProcessList()
00102 { 
00103    // printf("FWTriggerTableViewManager::updateProcessLi\n");
00104    for(std::vector<boost::shared_ptr<FWTriggerTableView> >::iterator it=
00105           m_views.begin(), itEnd = m_views.end();
00106        it != itEnd;
00107        ++it) {
00108     
00109       (*it)->setProcessList(&(context().metadataManager()->processNamesInJob()));
00110       (*it)->resetCombo();
00111    }
00112 }
00113