1 #ifndef DataFormats_Common_RefToBase_h
2 #define DataFormats_Common_RefToBase_h
38 #include "boost/static_assert.hpp"
39 #include "boost/type_traits/is_base_of.hpp"
61 template<
typename C,
typename T,
typename F>
class Ref;
62 template<
typename C>
class RefProd;
64 template<
typename T>
class View;
74 template <
typename C1,
typename T1,
typename F1>
80 template <
typename T1>
82 RefToBase(std::shared_ptr<reftobase::RefHolderBase>
p);
94 template <
class REF> REF
castTo()
const;
105 std::auto_ptr<reftobase::RefHolderBase>
holder()
const;
131 RefToBase<T>::RefToBase() :
142 template <
typename C1,
typename T1,
typename F1>
145 holder_(new reftobase::Holder<
T,
Ref<C1, T1, F1> >(iRef))
149 template <
typename C>
152 holder_(new reftobase::Holder<
T,
RefProd<
C> >(iRef))
156 template <
typename T1>
159 holder_(new reftobase::IndirectHolder<
T> (
160 std::shared_ptr< edm::reftobase::RefHolderBase>(iRef.holder().
release())
174 holder_(new reftobase::IndirectHolder<
T>(p))
199 return *getPtrImpl();
233 "attempting get key from null RefToBase;\n"
234 "You should check for nullity before calling key().");
235 return holder_->key();
247 "attempting to cast a null RefToBase;\n"
248 "You should check for nullity before casting.");
253 if (!holder_->fillRefIfMyTypeMatches(concrete_holder,
260 hidden_ref_type.c_str(),
261 " failed. Catch this exception in case you need to check"
262 " the concrete reference type.");
264 return concrete_holder.
getRef();
273 return !id().isValid();
300 ? holder_->isEqualTo(*rhs.
holder_)
309 return !(*
this == rhs);
323 return holder_? holder_->productGetter():
nullptr;
329 return holder_?holder_->hasProductCache():
false;
335 return holder_?holder_->product():
nullptr;
343 return holder_ ? holder_->getPtr() : 0;
348 return holder_? holder_->holder() : std::auto_ptr<reftobase::RefHolderBase>();
value_type const * get() const
edm::Ref< Container > Ref
REF const & getRef() const
bool hasProductCache() const
bool isNonnull() const
Checks for non-null.
virtual bool isAvailable() const =0
std::auto_ptr< reftobase::RefHolderBase > holder() const
#define CMS_CLASS_VERSION(_version_)
void swap(Association< C > &lhs, Association< C > &rhs)
bool operator==(RefToBase const &rhs) const
void const * product() const
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
void swap(RefToBase &other)
reftobase::BaseHolder< value_type > * holder_
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
value_type const * operator->() const
bool operator!=(RefToBase const &rhs) const
edm::RefProd< Container > RefProd
REF castTo() const
cast to a concrete type
bool isNull() const
Checks for null.
value_type const * getPtrImpl() const
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
EDProductGetter const * productGetter() const
bool operator!() const
Checks for null.
value_type const & operator*() const
RefToBase & operator=(RefToBase const &rhs)