CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/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.7 2011/07/08 04:40:00 amraktad Exp $
00012 //
00013 
00014 // system include files
00015 #include <iostream>
00016 #include <boost/bind.hpp>
00017 
00018 // user include files
00019 
00020 #include "Fireworks/Core/interface/FWTriggerTableViewManager.h"
00021 #include "Fireworks/Core/interface/FWHLTTriggerTableView.h"
00022 #include "Fireworks/Core/interface/FWL1TriggerTableView.h"
00023 #include "Fireworks/Core/interface/FWEventItem.h"
00024 #include "Fireworks/Core/interface/FWGUIManager.h"
00025 #include "Fireworks/Core/interface/FWColorManager.h"
00026 #include "Fireworks/Core/interface/FWTypeToRepresentations.h"
00027 #include "Fireworks/Core/interface/FWJobMetadataManager.h"
00028 
00029 
00030 FWTriggerTableViewManager::FWTriggerTableViewManager(FWGUIManager* iGUIMgr) :
00031    FWViewManagerBase()
00032 {
00033    FWGUIManager::ViewBuildFunctor f;
00034    f=boost::bind(&FWTriggerTableViewManager::buildView,
00035                  this, _1, _2);
00036    iGUIMgr->registerViewBuilder(FWViewType::idToName(FWViewType::kTableHLT), f);
00037    iGUIMgr->registerViewBuilder(FWViewType::idToName(FWViewType::kTableL1), f);
00038 }
00039 
00040 FWTriggerTableViewManager::~FWTriggerTableViewManager()
00041 {
00042 }
00043 
00044 class FWViewBase*
00045 FWTriggerTableViewManager::buildView(TEveWindowSlot* iParent, const std::string& type)
00046 {
00047    boost::shared_ptr<FWTriggerTableView> view;
00048    
00049    if (type == FWViewType::sName[FWViewType::kTableHLT])
00050       view.reset( new FWHLTTriggerTableView(iParent));
00051    else
00052       view.reset( new FWL1TriggerTableView(iParent));
00053 
00054    view->setProcessList(&(context().metadataManager()->processNamesInJob()));   
00055  
00056    view->setBackgroundColor(colorManager().background());
00057    m_views.push_back(boost::shared_ptr<FWTriggerTableView> (view));
00058    view->beingDestroyed_.connect(boost::bind(&FWTriggerTableViewManager::beingDestroyed,
00059                                              this,_1));
00060    return view.get();
00061 }
00062 
00063 void
00064 FWTriggerTableViewManager::beingDestroyed(const FWViewBase* iView)
00065 {
00066    for(std::vector<boost::shared_ptr<FWTriggerTableView> >::iterator it=
00067           m_views.begin(), itEnd = m_views.end();
00068        it != itEnd;
00069        ++it) {
00070       if(it->get() == iView) {
00071          m_views.erase(it);
00072          return;
00073       }
00074    }
00075 }
00076 
00077 void
00078 FWTriggerTableViewManager::colorsChanged()
00079 {
00080    for(std::vector<boost::shared_ptr<FWTriggerTableView> >::iterator it=
00081           m_views.begin(), itEnd = m_views.end();
00082        it != itEnd;
00083        ++it) {
00084       (*it)->setBackgroundColor(colorManager().background());
00085    }
00086 }
00087 
00088 void
00089 FWTriggerTableViewManager::eventEnd()
00090 {
00091    for(std::vector<boost::shared_ptr<FWTriggerTableView> >::iterator it=
00092           m_views.begin(), itEnd = m_views.end();
00093        it != itEnd;
00094        ++it) {
00095       (*it)->dataChanged();
00096    }
00097 }
00098 
00099 void
00100 FWTriggerTableViewManager::updateProcessList()
00101 { 
00102    // printf("FWTriggerTableViewManager::updateProcessLi\n");
00103    for(std::vector<boost::shared_ptr<FWTriggerTableView> >::iterator it=
00104           m_views.begin(), itEnd = m_views.end();
00105        it != itEnd;
00106        ++it) {
00107     
00108       (*it)->setProcessList(&(context().metadataManager()->processNamesInJob()));
00109       (*it)->resetCombo();
00110    }
00111 }
00112