Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef Fireworks_Core_FWProxyBuilderTemplate_h
0002 #define Fireworks_Core_FWProxyBuilderTemplate_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Core
0006 // Class  :     FWProxyBuilderTemplate
0007 //
0008 /**\class FWProxyBuilderTemplate FWProxyBuilderTemplate.h Fireworks/Core/interface/FWProxyBuilderTemplate.h
0009 
0010    Description: <one line class summary>
0011 
0012    Usage:s
0013     <usage>
0014 
0015  */
0016 //
0017 // Original Author:  Matevz Tadel
0018 //         Created:  April 23 2010
0019 //
0020 
0021 // system include files
0022 #include <typeinfo>
0023 
0024 // user include files
0025 #include "Fireworks/Core/interface/FWProxyBuilderBase.h"
0026 #include "Fireworks/Core/interface/FWSimpleProxyHelper.h"
0027 #include "Fireworks/Core/interface/FWEventItem.h"
0028 
0029 template <typename T>
0030 class FWProxyBuilderTemplate : public FWProxyBuilderBase {
0031 public:
0032   FWProxyBuilderTemplate() : m_helper(typeid(T)) {}
0033   ~FWProxyBuilderTemplate() override {}
0034 
0035   // ---------- const member functions ---------------------
0036 
0037   // ---------- static member functions --------------------
0038 
0039   // ---------- member functions ---------------------------
0040 
0041 protected:
0042   const T& modelData(int index) { return *reinterpret_cast<const T*>(m_helper.offsetObject(item()->modelData(index))); }
0043 
0044 public:
0045   FWProxyBuilderTemplate(const FWProxyBuilderTemplate&) = delete;  // stop default
0046 
0047   const FWProxyBuilderTemplate& operator=(const FWProxyBuilderTemplate&) = delete;  // stop default
0048 
0049 private:
0050   virtual void itemChangedImp(const FWEventItem* iItem) {
0051     if (iItem)
0052       m_helper.itemChanged(iItem);
0053   }
0054 
0055   // ---------- member data --------------------------------
0056   FWSimpleProxyHelper m_helper;
0057 };
0058 
0059 #endif