CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/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.8 2011/03/04 18:53:10 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 
00105    virtual void updateFilter(const char *filter);
00106 
00107    virtual std::vector<unsigned int> maxWidthForColumns() const;
00108 
00109    std::vector<PSetData> &data()  { return m_entries; }
00110    std::vector<int> &rowToIndex() { return m_row_to_index; }
00111   
00112    //______________________________________________________________________________
00113 
00114 protected:
00115    struct ModuleInfo
00116    {
00120       size_t            pathIndex;
00121       size_t            path;
00122       size_t            entry;
00123       bool              passed;
00127       bool              dirty;
00128    };
00129 
00131    struct PathUpdate
00132    {
00133       std::string pathName;
00134       bool passed;
00135       size_t  choiceMaker;
00136    };
00137 
00138 
00139    void setExpanded(int row);
00140    void updateSchedule(const edm::ScheduleInfo *info);
00141    void update(std::vector<PathUpdate> &pathUpdates);
00142 
00143    bool applyEditor();
00144    void cancelEditor();
00145 
00146    std::vector<ModuleInfo> &modules() { return m_modules; }
00147    std::vector<PSetData>   &entries() { return m_entries; }
00148 
00149    void  setSelection (int row, int column, int mask);
00150    //______________________________________________________________________________
00151 
00152 private: 
00153 
00155    struct PathInfo
00156    {
00157       std::string pathName;
00158       size_t      entryId;
00159       int         modulePassed;
00160       size_t      moduleStart;
00161       size_t      moduleEnd;
00162       bool        passed;
00163    };
00164 
00165    FWPSetTableManager(const FWPSetTableManager&); // stop default
00166    const FWPSetTableManager& operator=(const FWPSetTableManager&); // stop default
00167 
00168    void recalculateVisibility();
00169 
00170    template <class T> void createScalarString(PSetData &data, T v);
00171    template <typename T> void createVectorString(FWPSetTableManager::PSetData &data, const T &v, bool quotes);
00172 
00173    void setCellValueEditor(FWPSetCellEditor *editor);
00174 
00175    void handleEntry(const edm::Entry &entry,const std::string &key);
00176    void handlePSetEntry(const edm::ParameterSetEntry& entry, const std::string& key);
00177    void handleVPSetEntry(const edm::VParameterSetEntry& entry, const std::string& key);
00178    void handlePSet(const edm::ParameterSet &ps);
00179 
00180    std::vector<PSetData>           m_entries;
00182    std::vector<PathInfo>           m_paths;
00183    std::vector<ModuleInfo>         m_modules;
00184    std::map<std::string, size_t>   m_pathIndex;
00185    std::vector<size_t>             m_parentStack;
00186    std::vector<int>                m_row_to_index;
00187    int                             m_selectedRow;
00188    int                             m_selectedColumn;
00189    std::string                     m_filter;
00190    FWPSetCellEditor               *m_editor;
00191    std::vector<std::string>        m_availablePaths;
00192 
00193    mutable FWTextTreeCellRenderer m_renderer;  
00194 };
00195 
00196 
00197 #endif