CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
WrapperInterface.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_WrapperInterface_h
2 #define DataFormats_Common_WrapperInterface_h
3 
4 /*----------------------------------------------------------------------
5 
6 WrapperInterface:
7 
8 ----------------------------------------------------------------------*/
9 
12 
13 #include "boost/utility.hpp"
14 #include <vector>
15 
16 namespace edm {
17 
18  template <typename T>
19  class WrapperInterface : public WrapperInterfaceBase, private boost::noncopyable {
20  public:
21  typedef T value_type;
22  typedef T wrapped_type;
23 
25  virtual ~WrapperInterface() {}
26 
27  //these are used by FWLite
28  static std::type_info const& productTypeInfo() {return typeid(T);}
29  static std::type_info const& typeInfo() {return typeid(Wrapper<T>);}
30 
31  private:
32  static Wrapper<T> const* typeCast(void const* me) {
33  return static_cast<Wrapper<T> const*>(me);
34  }
35 
36  static Wrapper<T>* typeCast(void* me) {
37  return static_cast<Wrapper<T>*>(me);
38  }
39 
40  virtual void deleteProduct_(void const* me) const {
41  delete typeCast(me);
42  }
43 
44  virtual void do_fillView(void const* me,
45  ProductID const& id,
46  std::vector<void const*>& pointers,
47  helper_vector_ptr& helpers) const {
48 
49  typeCast(me)->fillView(id, pointers, helpers);
50  }
51  virtual void do_setPtr(void const* me,
52  std::type_info const& iToType,
53  unsigned long iIndex,
54  void const*& oPtr) const {
55  typeCast(me)->setPtr(iToType, iIndex, oPtr);
56  }
57 
58  virtual void do_fillPtrVector(void const* me,
59  std::type_info const& iToType,
60  std::vector<unsigned long> const& iIndicies,
61  std::vector<void const*>& oPtr) const {
62  typeCast(me)->fillPtrVector(iToType, iIndicies, oPtr);
63  }
64 
65  virtual bool isMergeable_(void const* me) const {
66  return typeCast(me)->isMergeable();
67  }
68 
69  virtual bool hasIsProductEqual_(void const* me) const {
70  return typeCast(me)->hasIsProductEqual();
71  }
72 
73  virtual bool mergeProduct_(void* me, void const* newProduct) const {
74  return typeCast(me)->mergeProduct(typeCast(newProduct));
75  }
76 
77  virtual bool isProductEqual_(void const* me, void const* newProduct) const {
78  return typeCast(me)->isProductEqual(typeCast(newProduct));
79  }
80 
81  virtual std::type_info const& dynamicTypeInfo_() const {
82  return typeid(T);
83  }
84 
85  virtual std::type_info const& wrappedTypeInfo_() const {
86  return typeid(Wrapper<T>);
87  }
88 
89  virtual bool isPresent_(void const* me) const {
90  return typeCast(me)->isPresent();
91  }
92  };
93 } //namespace edm
94 
95 #endif
boost::shared_ptr< reftobase::RefVectorHolderBase > helper_vector_ptr
Definition: EDProductfwd.h:46
static std::type_info const & productTypeInfo()
virtual void do_fillPtrVector(void const *me, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr) const
virtual void do_fillView(void const *me, ProductID const &id, std::vector< void const * > &pointers, helper_vector_ptr &helpers) const
virtual bool mergeProduct_(void *me, void const *newProduct) const
static std::type_info const & typeInfo()
virtual bool isMergeable_(void const *me) const
virtual bool isPresent_(void const *me) const
static Wrapper< T > const * typeCast(void const *me)
virtual std::type_info const & wrappedTypeInfo_() const
virtual bool isProductEqual_(void const *me, void const *newProduct) const
virtual void do_setPtr(void const *me, std::type_info const &iToType, unsigned long iIndex, void const *&oPtr) const
string const
Definition: compareJSON.py:14
virtual std::type_info const & dynamicTypeInfo_() const
virtual bool hasIsProductEqual_(void const *me) const
long double T
virtual void deleteProduct_(void const *me) const
static Wrapper< T > * typeCast(void *me)