CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/Fireworks/Core/interface/FWTableViewManager.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef Fireworks_Core_FWTableViewManager_h
00003 #define Fireworks_Core_FWTableViewManager_h
00004 //
00005 // Package:     Core
00006 // Class  :     FWTableViewManager
00007 //
00016 //
00017 // Original Author:
00018 //         Created:  Sat Jan  5 10:29:00 EST 2008
00019 // $Id: FWTableViewManager.h,v 1.9 2010/11/04 22:38:54 amraktad Exp $
00020 //
00021 
00022 // system include files
00023 #include <string>
00024 #include <vector>
00025 #include <set>
00026 #include <map>
00027 #include "Reflex/Type.h"
00028 
00029 // user include files
00030 
00031 #include "Fireworks/Core/interface/FWViewManagerBase.h"
00032 #include "Fireworks/Core/interface/FWTableView.h"
00033 #include "Fireworks/Core/interface/FWConfigurable.h"
00034 
00035 class FWViewBase;
00036 class FWGUIManager;
00037 class TEveWindowSlot;
00038 
00039 class FWTableViewManager : public FWViewManagerBase, public FWConfigurable 
00040 {
00041    friend class FWTableView;
00042    friend class FWTableViewTableManager;
00043 public:
00044    struct TableEntry {
00045       enum { INT = 0, INT_HEX = -1, BOOL = -2 };
00046       std::string    expression;
00047       std::string    name;
00048       int            precision;
00049    };
00050 
00052    typedef std::vector<const FWEventItem *>                Items;
00054    typedef std::vector<TableEntry> TableEntries;
00057    typedef std::map<std::string, TableEntries> TableSpecs;
00058 
00059    FWTableViewManager(FWGUIManager*);
00060    virtual ~FWTableViewManager();
00061 
00062    // ---------- const member functions ---------------------
00063    virtual FWTypeToRepresentations supportedTypesAndRepresentations() const;
00064    // ---------- static member functions --------------------
00065 
00066    // ---------- member functions ---------------------------
00067    virtual void            newItem(const FWEventItem*);
00068    void                    destroyItem(const FWEventItem *item);
00069    void                    removeAllItems(void);
00070    FWViewBase *            buildView(TEveWindowSlot *iParent, const std::string& type);
00071    const Items &           items() const { return m_items; }
00072    TableSpecs::iterator    tableFormats(const Reflex::Type &key);
00073    TableSpecs::iterator    tableFormats(const TClass &key);
00074    void                    addTo(FWConfiguration&) const;
00075    void                    addToImpl(FWConfiguration&) const;
00076    void                    setFrom(const FWConfiguration&);
00077 
00078    void                    notifyViews();
00079 
00080    static const std::string kConfigTypeNames;
00081    static const std::string kConfigColumns;
00082 
00083 protected:
00084    FWTableViewManager();
00085 
00087    virtual void modelChangesComing();
00088    virtual void modelChangesDone();
00089    virtual void colorsChanged();
00090    void dataChanged ();
00091 
00092    typedef std::vector<boost::shared_ptr<FWTableView> >    Views;
00093 
00094    Views       m_views;
00095    Items       m_items;
00096    TableSpecs  m_tableFormats;
00097 private:
00098    TableSpecs::iterator tableFormatsImpl(const Reflex::Type &key);
00099    FWTableViewManager(const FWTableViewManager&);    // stop default
00100    const FWTableViewManager& operator=(const FWTableViewManager&);    // stop default
00101 
00102    void beingDestroyed(const FWViewBase*);
00103    
00104    class TableHandle
00105    {
00106    public: 
00107       TableHandle &column(const char *formula, int precision, const char *name);
00108       TableHandle &column(const char *label, int precision)
00109          {
00110             return column(label, precision, label);
00111          }
00112 
00113       TableHandle(const char *name, TableSpecs &specs)
00114          :m_name(name), m_specs(specs) 
00115          {
00116             m_specs[name].clear();
00117          }
00118    private:
00119       std::string  m_name;
00120       TableSpecs  &m_specs;
00121    };
00122 
00123    TableHandle table(const char *collection);
00124 };
00125 
00126 #endif