CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/Fireworks/Core/interface/FWProxyBuilderTemplate.h

Go to the documentation of this file.
00001 #ifndef Fireworks_Core_FWProxyBuilderTemplate_h
00002 #define Fireworks_Core_FWProxyBuilderTemplate_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Core
00006 // Class  :     FWProxyBuilderTemplate
00007 //
00016 //
00017 // Original Author:  Matevz Tadel
00018 //         Created:  April 23 2010
00019 // $Id: FWProxyBuilderTemplate.h,v 1.1 2010/04/23 21:01:59 amraktad Exp $
00020 //
00021 
00022 // system include files
00023 #include <typeinfo>
00024 
00025 // user include files
00026 #include "Fireworks/Core/interface/FWProxyBuilderBase.h"
00027 #include "Fireworks/Core/interface/FWSimpleProxyHelper.h"
00028 
00029 class FWEventItem;
00030 
00031 template <typename T>
00032 class FWProxyBuilderTemplate : public FWProxyBuilderBase
00033 {
00034 public:
00035    FWProxyBuilderTemplate() : m_helper(typeid(T)) {}
00036    virtual ~FWProxyBuilderTemplate() {}
00037 
00038    // ---------- const member functions ---------------------
00039 
00040    // ---------- static member functions --------------------
00041 
00042    // ---------- member functions ---------------------------
00043 
00044 protected:
00045    const T& modelData(int index) { return *reinterpret_cast<const T*>(m_helper.offsetObject(item()->modelData(index))); }
00046 
00047 private:
00048    FWProxyBuilderTemplate(const FWProxyBuilderTemplate&); // stop default
00049 
00050    const FWProxyBuilderTemplate& operator=(const FWProxyBuilderTemplate&); // stop default
00051 
00052    virtual void itemChangedImp(const FWEventItem* iItem) { if (iItem) m_helper.itemChanged(iItem); }
00053    
00054    // ---------- member data --------------------------------
00055    FWSimpleProxyHelper m_helper;
00056 };
00057 
00058 #endif