CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h

Go to the documentation of this file.
00001 #ifndef Fireworks_Core_FWSimpleProxyBuilderTemplate_h
00002 #define Fireworks_Core_FWSimpleProxyBuilderTemplate_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Core
00006 // Class  :     FWSimpleProxyBuilderTemplate
00007 //
00016 //
00017 // Original Author:  Chris Jones
00018 //         Created:  Tue Dec  2 11:20:00 EST 2008
00019 // $Id: FWSimpleProxyBuilderTemplate.h,v 1.7 2010/05/04 13:24:40 amraktad Exp $
00020 //
00021 
00022 // system include files
00023 
00024 // user include files
00025 #include "Fireworks/Core/interface/FWSimpleProxyBuilder.h"
00026 
00027 // forward declarations
00028 
00029 template <typename T>
00030 class FWSimpleProxyBuilderTemplate : public FWSimpleProxyBuilder {
00031 
00032 public:
00033    FWSimpleProxyBuilderTemplate() :
00034       FWSimpleProxyBuilder(typeid(T)) {
00035    }
00036 
00037    //virtual ~FWSimpleProxyBuilderTemplate();
00038 
00039    // ---------- const member functions ---------------------
00040 
00041    // ---------- static member functions --------------------
00042 
00043    // ---------- member functions ---------------------------
00044 
00045 protected:
00046    const T& modelData(int index) { return *reinterpret_cast<const T*>(m_helper.offsetObject(item()->modelData(index))); }
00047 
00048 private:
00049    FWSimpleProxyBuilderTemplate(const FWSimpleProxyBuilderTemplate&); // stop default
00050 
00051    const FWSimpleProxyBuilderTemplate& operator=(const FWSimpleProxyBuilderTemplate&); // stop default
00052 
00053    virtual void build(const void*iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* context)
00054    {
00055       if(0!=iData) {
00056          build(*reinterpret_cast<const T*> (iData), iIndex, oItemHolder, context);
00057       }
00058    }
00059 
00060    virtual void buildViewType(const void*iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType viewType, const FWViewContext* context)
00061    {
00062       if(0!=iData) {
00063          buildViewType(*reinterpret_cast<const T*> (iData), iIndex, oItemHolder, viewType, context);
00064       }
00065    }
00069    virtual void build(const T& iData, unsigned int iIndex,TEveElement& oItemHolder, const FWViewContext*)
00070    {
00071       throw std::runtime_error("virtual build(const T&, unsigned int, TEveElement&, const FWViewContext*) not implemented by inherited class.");
00072    }
00073 
00074    virtual void buildViewType(const T& iData, unsigned int iIndex,TEveElement& oItemHolder, FWViewType::EType viewType, const FWViewContext*) 
00075    { 
00076       throw std::runtime_error("virtual buildViewType(const T&, unsigned int, TEveElement&, FWViewType::EType, const FWViewContext*) not implemented by inherited class");
00077    };
00078 
00079    // ---------- member data --------------------------------
00080 
00081 };
00082 
00083 
00084 #endif