1 #ifndef DataFormats_Common_RefToBase_h
2 #define DataFormats_Common_RefToBase_h
37 #include "boost/shared_ptr.hpp"
38 #include "boost/static_assert.hpp"
39 #include "boost/type_traits/is_base_of.hpp"
60 template<
typename C,
typename T,
typename F>
class Ref;
61 template<
typename C>
class RefProd;
63 template<
typename T>
class View;
73 template <
typename C1,
typename T1,
typename F1>
79 template <
typename T1>
81 RefToBase(boost::shared_ptr<reftobase::RefHolderBase>
p);
93 template <
class REF> REF
castTo()
const;
104 std::auto_ptr<reftobase::RefHolderBase>
holder()
const;
130 RefToBase<T>::RefToBase() :
141 template <
typename C1,
typename T1,
typename F1>
144 holder_(new reftobase::Holder<
T,
Ref<C1, T1, F1> >(iRef))
148 template <
typename C>
151 holder_(new reftobase::Holder<
T,
RefProd<
C> >(iRef))
155 template <
typename T1>
158 holder_(new reftobase::IndirectHolder<
T> (
159 boost::shared_ptr< edm::reftobase::RefHolderBase>(iRef.holder().
release())
173 holder_(new reftobase::IndirectHolder<
T>(p))
198 return *getPtrImpl();
232 "attempting get key from null RefToBase;\n"
233 "You should check for nullity before calling key().");
234 return holder_->key();
246 "attempting to cast a null RefToBase;\n"
247 "You should check for nullity before casting.");
252 if (!holder_->fillRefIfMyTypeMatches(concrete_holder,
259 hidden_ref_type.c_str(),
260 " failed. Catch this exception in case you need to check"
261 " the concrete reference type.");
263 return concrete_holder.
getRef();
272 return !id().isValid();
299 ? holder_->isEqualTo(*rhs.
holder_)
308 return !(*
this == rhs);
322 return holder_? holder_->productGetter():
nullptr;
328 return holder_?holder_->hasProductCache():
false;
334 return holder_?holder_->product():
nullptr;
342 return holder_ ? holder_->getPtr() : 0;
347 return holder_? holder_->holder() : std::auto_ptr<reftobase::RefHolderBase>();
edm::Ref< Container > Ref
value_type const * getPtrImpl() const
bool operator==(RefToBase const &rhs) const
std::auto_ptr< reftobase::RefHolderBase > holder() const
REF const & getRef() const
bool isNull() const
Checks for null.
EDProductGetter const * productGetter() const
void swap(RefToBase &other)
virtual bool isAvailable() const =0
value_type const & operator*() const
#define CMS_CLASS_VERSION(_version_)
void swap(Association< C > &lhs, Association< C > &rhs)
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
bool operator!=(RefToBase const &rhs) const
value_type const * operator->() const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
void const * product() const
bool operator!() const
Checks for null.
RefToBase & operator=(RefToBase const &rhs)
bool hasProductCache() const
edm::RefProd< Container > RefProd
REF castTo() const
cast to a concrete type
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
reftobase::BaseHolder< value_type > * holder_
bool isNonnull() const
Checks for non-null.
value_type const * get() const