CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DataFormats/Common/interface/EDProduct.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Common_EDProduct_h
00002 #define DataFormats_Common_EDProduct_h
00003 
00004 /*----------------------------------------------------------------------
00005 
00006 EDProduct: The base class of all things that will be inserted into the Event.
00007 
00008 ----------------------------------------------------------------------*/
00009 
00010 #include "DataFormats/Common/interface/EDProductfwd.h"
00011 
00012 #include <typeinfo>
00013 #include <vector>
00014 
00015 namespace edm {
00016 
00017   class EDProduct {
00018   public:
00019     EDProduct();
00020     virtual ~EDProduct();
00021     bool isPresent() const {return isPresent_();}
00022 
00023     // We have to use vector<void*> to keep the type information out
00024     // of the EDProduct class.
00025     void fillView(ProductID const& id,
00026                   std::vector<void const*>& view,
00027                   helper_vector_ptr & helpers) const;
00028 
00029     void setPtr(std::type_info const& iToType,
00030                 unsigned long iIndex,
00031                 void const*& oPtr) const;
00032 
00033     void fillPtrVector(std::type_info const& iToType,
00034                           std::vector<unsigned long> const& iIndicies,
00035                           std::vector<void const*>& oPtr) const;
00036 
00037     std::type_info const& dynamicTypeInfo() const {return dynamicTypeInfo_();}
00038 
00039 #ifndef __REFLEX__
00040     bool isMergeable() const {return isMergeable_();}
00041     bool mergeProduct(EDProduct const* newProduct) {return mergeProduct_(newProduct);}
00042     bool hasIsProductEqual() const {return hasIsProductEqual_();}
00043     bool isProductEqual(EDProduct const* newProduct) const {return isProductEqual_(newProduct);}
00044 #endif
00045 
00046   private:
00047     virtual std::type_info const& dynamicTypeInfo_() const = 0;
00048 
00049     // This will never be called.
00050     // For technical ROOT related reasons, we cannot
00051     // declare it = 0.
00052     virtual bool isPresent_() const {return true;}
00053 
00054 #ifndef __REFLEX__
00055     virtual bool isMergeable_() const { return true; }
00056     virtual bool mergeProduct_(EDProduct const* newProduct) { return true; }
00057     virtual bool hasIsProductEqual_() const { return true; }
00058     virtual bool isProductEqual_(EDProduct const* newProduct) const { return true; }
00059 #endif
00060 
00061     virtual void do_fillView(ProductID const& id,
00062                              std::vector<void const*>& pointers,
00063                              helper_vector_ptr & helpers) const = 0;
00064     virtual void do_setPtr(std::type_info const& iToType,
00065                            unsigned long iIndex,
00066                            void const*& oPtr) const = 0;
00067 
00068     virtual void do_fillPtrVector(std::type_info const& iToType,
00069                                   std::vector<unsigned long> const& iIndicies,
00070                                   std::vector<void const*>& oPtr) const = 0;
00071   };
00072 }
00073 #endif