CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/Fireworks/Core/interface/FWItemValueGetter.h

Go to the documentation of this file.
00001 #ifndef Fireworks_Core_FWItemValueGetter_h
00002 #define Fireworks_Core_FWItemValueGetter_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Core
00006 // Class  :     FWItemValueGetter
00007 //
00016 //
00017 // Original Author:  Chris Jones
00018 //         Created:  Sun Nov 30 16:14:58 EST 2008
00019 // $Id: FWItemValueGetter.h,v 1.6 2012/06/26 22:13:03 wmtan Exp $
00020 //
00021 
00022 #include <string>
00023 #include <vector>
00024 
00025 #include "Rtypes.h"
00026 #include "Reflex/Member.h"
00027 #include "Reflex/Type.h"
00028 
00029 #include "CommonTools/Utils/src/SelectorPtr.h"
00030 #include "CommonTools/Utils/src/SelectorBase.h"
00031 #include "CommonTools/Utils/src/ExpressionPtr.h"
00032 #include "CommonTools/Utils/src/ExpressionBase.h"
00033 
00034 
00035 class FWItemValueGetter
00036 {
00037 public:
00038    FWItemValueGetter(const Reflex::Type&, const std::string& iPurpose);
00039    double valueFor(const void*, int idx) const;
00040    UInt_t precision( int idx) const;
00041    std::vector<std::string> getTitles() const;
00042    int numValues() const; 
00043 
00044    const std::string& getToolTip(const void* iObject) const;
00045 
00046 
00047 private:
00048    struct Entry {
00049       reco::parser::ExpressionPtr m_expr;
00050       std::string m_expression; 
00051       std::string m_unit;
00052       std::string m_title;
00053       UInt_t     m_precision;
00054 
00055       Entry(reco::parser::ExpressionPtr iExpr, std::string iExpression, std::string iUnit, std::string iTitle, int iPrec) :
00056          m_expr(iExpr), m_expression(iExpression), m_unit(iUnit), m_title(iTitle), m_precision(iPrec) {}
00057    };
00058 
00059    bool addEntry(std::string iExpression,int iPrec = 2,  std::string iTitle = "",  std::string iUnit = "");
00060 
00061    typedef std::vector<Entry > Entries_t;
00062    Entries_t::const_iterator Entries_i;
00063 
00064    Entries_t m_entries;
00065    Reflex::Type m_type;
00066 
00067    int m_titleWidth;
00068 
00069    
00070 };
00071 
00072 #endif