Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-05 22:48:06

0001 #ifndef Fireworks_Core_FWItemValueGetter_h
0002 #define Fireworks_Core_FWItemValueGetter_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Core
0006 // Class  :     FWItemValueGetter
0007 //
0008 /**\class FWItemValueGetter FWItemValueGetter.h Fireworks/Core/interface/FWItemValueGetter.h
0009 
0010    Description: Retrieves a particular value from an item
0011 
0012    Usage:
0013     <usage>
0014 
0015  */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Sun Nov 30 16:14:58 EST 2008
0019 //
0020 
0021 #include <string>
0022 #include <vector>
0023 
0024 #include "Rtypes.h"
0025 #include "FWCore/Reflection/interface/TypeWithDict.h"
0026 
0027 #include "CommonTools/Utils/interface/SelectorPtr.h"
0028 #include "CommonTools/Utils/interface/SelectorBase.h"
0029 #include "CommonTools/Utils/interface/ExpressionPtr.h"
0030 #include "CommonTools/Utils/interface/ExpressionBase.h"
0031 
0032 class FWItemValueGetter {
0033 public:
0034   FWItemValueGetter(const edm::TypeWithDict&, const std::string& iPurpose);
0035   double valueFor(const void*, int idx) const;
0036   UInt_t precision(int idx) const;
0037   std::vector<std::string> getTitles() const;
0038   int numValues() const;
0039 
0040   const std::string& getToolTip(const void* iObject) const;
0041 
0042 private:
0043   struct Entry {
0044     reco::parser::ExpressionPtr m_expr;
0045     std::string m_expression;
0046     std::string m_unit;
0047     std::string m_title;
0048     UInt_t m_precision;
0049 
0050     Entry(reco::parser::ExpressionPtr iExpr, std::string iExpression, std::string iUnit, std::string iTitle, int iPrec)
0051         : m_expr(iExpr), m_expression(iExpression), m_unit(iUnit), m_title(iTitle), m_precision(iPrec) {}
0052   };
0053 
0054   bool addEntry(std::string iExpression, int iPrec = 2, std::string iTitle = "", std::string iUnit = "");
0055 
0056   typedef std::vector<Entry> Entries_t;
0057   Entries_t::const_iterator Entries_i;
0058 
0059   Entries_t m_entries;
0060   edm::TypeWithDict m_type;
0061 
0062   int m_titleWidth;
0063 };
0064 
0065 #endif