CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EDProduct.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_EDProduct_h
2 #define DataFormats_Common_EDProduct_h
3 
4 /*----------------------------------------------------------------------
5 
6 EDProduct: The base class of all things that will be inserted into the Event.
7 
8 ----------------------------------------------------------------------*/
9 
10 #include <vector>
12 
13 namespace edm {
14 
15  class EDProduct {
16  public:
17  EDProduct();
18  virtual ~EDProduct();
19  bool isPresent() const {return isPresent_();}
20 
21  // We have to use vector<void*> to keep the type information out
22  // of the EDProduct class.
23  void fillView(ProductID const& id,
24  std::vector<void const*>& view,
25  helper_vector_ptr & helpers) const;
26 
27  void setPtr(std::type_info const& iToType,
28  unsigned long iIndex,
29  void const*& oPtr) const;
30 
31  void fillPtrVector(std::type_info const& iToType,
32  std::vector<unsigned long> const& iIndicies,
33  std::vector<void const*>& oPtr) const;
34 
35  std::type_info const& dynamicTypeInfo() const {return dynamicTypeInfo_();}
36 
37 #ifndef __REFLEX__
38  bool isMergeable() const {return isMergeable_();}
39  bool mergeProduct(EDProduct const* newProduct) {return mergeProduct_(newProduct);}
40  bool hasIsProductEqual() const {return hasIsProductEqual_();}
41  bool isProductEqual(EDProduct const* newProduct) const {return isProductEqual_(newProduct);}
42 #endif
43 
44  private:
45  virtual std::type_info const& dynamicTypeInfo_() const = 0;
46 
47  // This will never be called.
48  // For technical ROOT related reasons, we cannot
49  // declare it = 0.
50  virtual bool isPresent_() const {return true;}
51 
52 #ifndef __REFLEX__
53  virtual bool isMergeable_() const { return true; }
54  virtual bool mergeProduct_(EDProduct const* newProduct) { return true; }
55  virtual bool hasIsProductEqual_() const { return true; }
56  virtual bool isProductEqual_(EDProduct const* newProduct) const { return true; }
57 #endif
58 
59  virtual void do_fillView(ProductID const& id,
60  std::vector<void const*>& pointers,
61  helper_vector_ptr & helpers) const = 0;
62  virtual void do_setPtr(std::type_info const& iToType,
63  unsigned long iIndex,
64  void const*& oPtr) const = 0;
65 
66  virtual void do_fillPtrVector(std::type_info const& iToType,
67  std::vector<unsigned long> const& iIndicies,
68  std::vector<void const*>& oPtr) const = 0;
69  };
70 }
71 #endif
void fillView(ProductID const &id, std::vector< void const * > &view, helper_vector_ptr &helpers) const
Definition: EDProduct.cc:13
void setPtr(std::type_info const &iToType, unsigned long iIndex, void const *&oPtr) const
Definition: EDProduct.cc:26
virtual void do_fillView(ProductID const &id, std::vector< void const * > &pointers, helper_vector_ptr &helpers) const =0
std::type_info const & dynamicTypeInfo() const
Definition: EDProduct.h:35
void fillPtrVector(std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr) const
Definition: EDProduct.cc:33
bool hasIsProductEqual() const
Definition: EDProduct.h:40
virtual bool mergeProduct_(EDProduct const *newProduct)
Definition: EDProduct.h:54
virtual bool isProductEqual_(EDProduct const *newProduct) const
Definition: EDProduct.h:56
virtual std::type_info const & dynamicTypeInfo_() const =0
virtual ~EDProduct()
Definition: EDProduct.cc:11
virtual bool isPresent_() const
Definition: EDProduct.h:50
boost::shared_ptr< reftobase::RefVectorHolderBase > helper_vector_ptr
Definition: EDProductfwd.h:46
virtual void do_setPtr(std::type_info const &iToType, unsigned long iIndex, void const *&oPtr) const =0
bool mergeProduct(EDProduct const *newProduct)
Definition: EDProduct.h:39
virtual bool isMergeable_() const
Definition: EDProduct.h:53
bool isMergeable() const
Definition: EDProduct.h:38
bool isProductEqual(EDProduct const *newProduct) const
Definition: EDProduct.h:41
bool isPresent() const
Definition: EDProduct.h:19
virtual void do_fillPtrVector(std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr) const =0
virtual bool hasIsProductEqual_() const
Definition: EDProduct.h:55