CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/Fireworks/FWInterface/src/FWPSetTableManager.h

Go to the documentation of this file.
00001 #ifndef Fireworks_FWInterface_FWPSetTableManager_h
00002 #define Fireworks_FWInterface_FWPSetTableManager_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     FWInterface
00006 // Class  :     FWPSetTableManager
00007 // 
00016 //
00017 // Original Author:  
00018 //         Created:  Mon Feb 28 17:06:50 CET 2011
00019 // $Id: FWPSetTableManager.h,v 1.9 2012/04/06 19:51:38 amraktad Exp $
00020 //
00021 
00022 // system include files
00023 
00024 
00025 #include <sigc++/sigc++.h>
00026 #include "Fireworks/TableWidget/interface/FWTableManagerBase.h"
00027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00028 #include "Fireworks/TableWidget/interface/FWTextTreeCellRenderer.h"
00029 
00030 class FWPSetCellEditor;
00031 namespace edm 
00032 {
00033    class ScheduleInfo;
00034 }
00035 
00036 
00037 
00038 class FWPSetTableManager : public FWTableManagerBase 
00039 {
00040    friend class FWPathsPopup;
00041 
00042 public: 
00044    struct PSetData
00045    {
00046       PSetData() :level(-1),
00047          tracked(false),
00048 
00049          type(-1),
00050    
00051          parent(-1),
00052 
00053          module(-1),
00054          path(-1),
00055 
00056          expandedUser(false),
00057          expandedFilter(false),
00058 
00059          visible(false),
00060 
00061          matches(false),
00062          childMatches(false),
00063 
00064          editable(false) {}
00065 
00066       std::string label;
00067       std::string value;
00068 
00069       int         level;
00070       bool        tracked;
00071       char        type;
00072       size_t      parent;
00073    
00074       size_t      module;
00075       size_t      path;
00076 
00077       bool        expandedUser;
00078       bool        expandedFilter;
00079 
00080       bool        visible;
00081       bool        matches;
00082       bool        childMatches;
00083       bool        editable;
00084 
00085       edm::ParameterSet pset;
00086    };
00087 
00088    FWPSetTableManager();
00089    virtual ~FWPSetTableManager();
00090 
00091 
00092    virtual int unsortedRowNumber(int unsorted) const ;
00093    virtual int numberOfRows() const;
00094    virtual int numberOfColumns() const;
00095    virtual std::vector<std::string> getTitles() const;
00096    virtual const std::string title() const;
00097    virtual FWTableCellRendererBase* cellRenderer(int iSortedRowNumber, int iCol) const;
00098 
00099    int selectedRow() const;
00100    int selectedColumn() const;
00101    virtual bool rowIsSelected(int row) const;
00102 
00103    virtual void implSort(int, bool);
00104    virtual bool cellDataIsSortable() const { return false ; }
00105 
00106    virtual void updateFilter(const char *filter);
00107 
00108    virtual std::vector<unsigned int> maxWidthForColumns() const;
00109 
00110    std::vector<PSetData> &data()  { return m_entries; }
00111    std::vector<int> &rowToIndex() { return m_row_to_index; }
00112   
00113    //______________________________________________________________________________
00114 
00115 protected:
00116    struct ModuleInfo
00117    {
00121       size_t            pathIndex;
00122       size_t            path;
00123       size_t            entry;
00124       bool              passed;
00128       bool              dirty;
00129    };
00130 
00132    struct PathUpdate
00133    {
00134       std::string pathName;
00135       bool passed;
00136       size_t  choiceMaker;
00137    };
00138 
00139 
00140    void setExpanded(int row);
00141    void updateSchedule(const edm::ScheduleInfo *info);
00142    void update(std::vector<PathUpdate> &pathUpdates);
00143 
00144    bool applyEditor();
00145    void cancelEditor();
00146 
00147    std::vector<ModuleInfo> &modules() { return m_modules; }
00148    std::vector<PSetData>   &entries() { return m_entries; }
00149 
00150    void  setSelection (int row, int column, int mask);
00151    //______________________________________________________________________________
00152 
00153 private: 
00154 
00156    struct PathInfo
00157    {
00158       std::string pathName;
00159       size_t      entryId;
00160       int         modulePassed;
00161       size_t      moduleStart;
00162       size_t      moduleEnd;
00163       bool        passed;
00164    };
00165 
00166    FWPSetTableManager(const FWPSetTableManager&); // stop default
00167    const FWPSetTableManager& operator=(const FWPSetTableManager&); // stop default
00168 
00169    void recalculateVisibility();
00170 
00171    template <class T> void createScalarString(PSetData &data, T v);
00172    template <typename T> void createVectorString(FWPSetTableManager::PSetData &data, const T &v, bool quotes);
00173 
00174    void setCellValueEditor(FWPSetCellEditor *editor);
00175 
00176    void handleEntry(const edm::Entry &entry,const std::string &key);
00177    void handlePSetEntry(const edm::ParameterSetEntry& entry, const std::string& key);
00178    void handleVPSetEntry(const edm::VParameterSetEntry& entry, const std::string& key);
00179    void handlePSet(const edm::ParameterSet &ps);
00180 
00181    std::vector<PSetData>           m_entries;
00183    std::vector<PathInfo>           m_paths;
00184    std::vector<ModuleInfo>         m_modules;
00185    std::map<std::string, size_t>   m_pathIndex;
00186    std::vector<size_t>             m_parentStack;
00187    std::vector<int>                m_row_to_index;
00188    int                             m_selectedRow;
00189    int                             m_selectedColumn;
00190    std::string                     m_filter;
00191    FWPSetCellEditor               *m_editor;
00192    std::vector<std::string>        m_availablePaths;
00193 
00194    mutable FWTextTreeCellRenderer m_renderer;  
00195 };
00196 
00197 
00198 #endif