CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/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.6 2011/02/16 18:38:36 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 
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