CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/DataFormats/Provenance/interface/WrapperInterfaceBase.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Provenance_WrapperInterfaceBase_h
00002 #define DataFormats_Provenance_WrapperInterfaceBase_h
00003 
00004 /*----------------------------------------------------------------------
00005 
00006 WrapperInterfaceBase: The base class of all things that will be inserted into the Event.
00007 /
00008 ----------------------------------------------------------------------*/
00009 #include "boost/shared_ptr.hpp"
00010 
00011 #include <typeinfo>
00012 #include <vector>
00013 
00014 namespace edm {
00015   class ProductID;
00016   namespace reftobase {
00017     class RefVectorHolderBase;
00018   }
00019   typedef boost::shared_ptr<reftobase::RefVectorHolderBase> helper_vector_ptr;
00020   class WrapperInterfaceBase {
00021   public:
00022     WrapperInterfaceBase();
00023     virtual ~WrapperInterfaceBase();
00024 
00025     void deleteProduct(void const* me) const {
00026       deleteProduct_(me);
00027     }
00028 
00029     void fillView(void const* me,
00030                   ProductID const& id,
00031                   std::vector<void const*>& view,
00032                   helper_vector_ptr& helpers) const;
00033 
00034     void setPtr(void const* me,
00035                 std::type_info const& iToType,
00036                 unsigned long iIndex,
00037                 void const*& oPtr) const;
00038 
00039     void fillPtrVector(void const* me,
00040                        std::type_info const& iToType,
00041                        std::vector<unsigned long> const& iIndicies,
00042                        std::vector<void const*>& oPtr) const;
00043 
00044     bool isMergeable(void const* me) const {
00045       return isMergeable_(me);
00046     }
00047 
00048     bool hasIsProductEqual(void const* me) const {
00049       return hasIsProductEqual_(me);
00050     }
00051 
00052     bool mergeProduct(void* me, void const* newProduct) const {
00053       return mergeProduct_(me, newProduct);
00054     }
00055 
00056     bool isProductEqual(void const* me, void const* newProduct) const {
00057       return isProductEqual_(me, newProduct);
00058     }
00059 
00060     bool isPresent(void const* me) const {
00061       return isPresent_(me);
00062     }
00063 
00064     std::type_info const& dynamicTypeInfo() const {
00065       return dynamicTypeInfo_();
00066     }
00067 
00068     std::type_info const& wrappedTypeInfo() const {
00069       return wrappedTypeInfo_();
00070     }
00071 
00072   private:
00073     virtual void deleteProduct_(void const* me) const = 0;
00074 
00075     virtual void do_fillView(void const* me,
00076                              ProductID const& id,
00077                              std::vector<void const*>& pointers,
00078                              helper_vector_ptr& helpers) const = 0;
00079 
00080     virtual void do_setPtr(void const* me,
00081                            std::type_info const& iToType,
00082                            unsigned long iIndex,
00083                            void const*& oPtr) const = 0;
00084 
00085     virtual void do_fillPtrVector(void const* me,
00086                                   std::type_info const& iToType,
00087                                   std::vector<unsigned long> const& iIndicies,
00088                                   std::vector<void const*>& oPtr) const = 0;
00089 
00090     virtual bool isMergeable_(void const* me) const = 0;
00091 
00092     virtual bool hasIsProductEqual_(void const* me) const = 0;
00093 
00094     virtual bool mergeProduct_(void* me, void const* newProduct) const = 0;
00095 
00096     virtual bool isProductEqual_(void const* me, void const* newProduct) const = 0;
00097 
00098     virtual std::type_info const& dynamicTypeInfo_() const = 0;
00099 
00100     virtual std::type_info const& wrappedTypeInfo_() const = 0;
00101 
00102     virtual bool isPresent_(void const* me) const = 0;
00103   };
00104 }
00105 #endif