Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-03 04:09:58

0001 #ifndef Fireworks_Core_FWEnumParameter_h
0002 #define Fireworks_Core_FWEnumParameter_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Core
0006 // Class  :     FWEnumParameter
0007 //
0008 /**\class FWEnumParameter FWEnumParameter.h Fireworks/Core/interface/FWEnumParameter.h
0009 
0010  Description: Specialization of FWLongParameter to allow drop-down menu GUI.
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  matevz
0018 //         Created:  Fri Apr 30 15:16:55 CEST 2010
0019 //
0020 
0021 // system include files
0022 
0023 // user include files
0024 #include "Fireworks/Core/interface/FWLongParameter.h"
0025 #include "RtypesCore.h"
0026 #include <map>
0027 
0028 // forward declarations
0029 
0030 class FWEnumParameter : public FWLongParameter {
0031 public:
0032   FWEnumParameter() : FWLongParameter() {}
0033 
0034   FWEnumParameter(
0035       FWParameterizable* iParent, const std::string& iName, const long& iDefault = 0, long iMin = -1, long iMax = -1)
0036       : FWLongParameter(iParent, iName, iDefault, iMin, iMax) {}
0037 
0038   template <class K>
0039   FWEnumParameter(FWParameterizable* iParent,
0040                   const std::string& iName,
0041                   K iCallback,
0042                   const long& iDefault = 0,
0043                   long iMin = -1,
0044                   long iMax = -1)
0045       : FWLongParameter(iParent, iName, iCallback, iDefault, iMin, iMax) {}
0046 
0047   // ---------- const member functions ---------------------
0048 
0049   // ---------- static member functions --------------------
0050 
0051   // ---------- member functions ---------------------------
0052 
0053   bool addEntry(Long_t id, const std::string& txt) { return m_enumEntries.insert(std::make_pair(id, txt)).second; }
0054 
0055   const std::map<Long_t, std::string>& entryMap() const { return m_enumEntries; }
0056 
0057   FWEnumParameter(const FWEnumParameter&) = delete;                   // stop default
0058   const FWEnumParameter& operator=(const FWEnumParameter&) = delete;  // stop default
0059 
0060 private:
0061   // ---------- member data --------------------------------
0062   std::map<Long_t, std::string> m_enumEntries;
0063 };
0064 
0065 #endif