Go to the documentation of this file.00001 #ifndef DataFormats_Provenance_WrapperInterfaceBase_h
00002 #define DataFormats_Provenance_WrapperInterfaceBase_h
00003
00004
00005
00006
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 bool sameType(WrapperInterfaceBase const & other) const {
00069 return other.dynamicTypeInfo()==dynamicTypeInfo();
00070 }
00071
00072 std::type_info const& wrappedTypeInfo() const {
00073 return wrappedTypeInfo_();
00074 }
00075
00076 private:
00077 virtual void deleteProduct_(void const* me) const = 0;
00078
00079 virtual void do_fillView(void const* me,
00080 ProductID const& id,
00081 std::vector<void const*>& pointers,
00082 helper_vector_ptr& helpers) const = 0;
00083
00084 virtual void do_setPtr(void const* me,
00085 std::type_info const& iToType,
00086 unsigned long iIndex,
00087 void const*& oPtr) const = 0;
00088
00089 virtual void do_fillPtrVector(void const* me,
00090 std::type_info const& iToType,
00091 std::vector<unsigned long> const& iIndicies,
00092 std::vector<void const*>& oPtr) const = 0;
00093
00094 virtual bool isMergeable_(void const* me) const = 0;
00095
00096 virtual bool hasIsProductEqual_(void const* me) const = 0;
00097
00098 virtual bool mergeProduct_(void* me, void const* newProduct) const = 0;
00099
00100 virtual bool isProductEqual_(void const* me, void const* newProduct) const = 0;
00101
00102 virtual std::type_info const& dynamicTypeInfo_() const = 0;
00103
00104 virtual std::type_info const& wrappedTypeInfo_() const = 0;
00105
00106 virtual bool isPresent_(void const* me) const = 0;
00107 };
00108 }
00109 #endif