Go to the documentation of this file.00001 #ifndef DataFormats_Common_RefBase_h
00002 #define DataFormats_Common_RefBase_h
00003
00004 #error "This header should no longer be included"
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "DataFormats/Common/interface/EDProductfwd.h"
00014 #include "DataFormats/Common/interface/RefCore.h"
00015 #include "DataFormats/Common/interface/traits.h"
00016 #include "DataFormats/Common/interface/ConstPtrCache.h"
00017
00018 namespace edm {
00019
00020 template<typename KEY>
00021 class RefBase {
00022 public:
00023 typedef KEY key_type;
00024
00026 RefBase() : product_(), index_(key_traits<key_type>::value), cache_(0) {}
00027
00029 RefBase(ProductID const& productID, void const* prodPtr, key_type itemKey,
00030 void const* itemPtr, EDProductGetter const* prodGetter, bool transient):
00031 product_(productID, prodPtr, prodGetter, transient), index_(itemKey),cache_(itemPtr) {}
00032
00034 RefBase(RefCore const& prod, KEY const& itm) :
00035 product_(prod), index_(itm),cache_(0) {}
00036
00039
00041 RefCore const& refCore() const { return product_;}
00042
00044
00045
00046 key_type key() const { return index_; }
00047
00048
00050 bool isValid() const { return index_!=edm::key_traits<key_type>::value; }
00051 bool isNull() const { return !isValid(); }
00052 bool isNonnull() const { return isValid(); }
00053
00054 private:
00055 RefCore product_;
00056 key_type index_;
00057 mutable ConstPtrCache cache_;
00058 };
00059
00060 template <typename KEY>
00061 bool
00062 operator==(RefBase<KEY> const& lhs, RefBase<KEY> const& rhs) {
00063 return lhs.refCore() == rhs.refCore() && lhs.item() == rhs.item();
00064 }
00065
00066 template <typename KEY>
00067 bool
00068 operator!=(RefBase<KEY> const& lhs, RefBase<KEY> const& rhs) {
00069 return !(lhs == rhs);
00070 }
00071
00072 template <typename KEY>
00073 bool
00074 operator<(RefBase<KEY> const& lhs, RefBase<KEY> const& rhs) {
00075 return (lhs.refCore() == rhs.refCore() ? lhs.item() < rhs.item() : lhs.refCore() < rhs.refCore());
00076 }
00077 }
00078
00079 #endif