1 #ifndef DataFormats_Common_RefToBase_h
2 #define DataFormats_Common_RefToBase_h
47 #include <type_traits>
60 template <
typename C,
typename T,
typename F>
79 template <typename C1, typename T1, typename F1>
88 RefToBase(std::shared_ptr<reftobase::RefHolderBase>
p);
95 value_type const*
operator->() const;
96 value_type const*
get() const;
139 inline RefToBase<T>::RefToBase() : holder_(
nullptr) {}
146 other.holder_ =
nullptr;
153 other.holder_ =
nullptr;
158 template <
typename C1,
typename T1,
typename F1>
160 : holder_(new reftobase::Holder<
T,
Ref<C1, T1, F1>>(iRef)) {}
163 template <
typename C>
167 template <
typename T1>
170 new reftobase::IndirectHolder<
T>(std::shared_ptr<edm::reftobase::RefHolderBase>(iRef.holder().
release()))) {
184 : holder_(new reftobase::IndirectHolder<
T>(p)) {}
200 return *getPtrImpl();
220 if (holder_ ==
nullptr) {
222 "attempting get key from null RefToBase;\n"
223 "You should check for nullity before calling key().");
226 return holder_->key();
232 template <
typename T,
typename U>
235 "RefToBase::castTo error element types are not related by inheritance");
238 template <
typename T,
typename U>
244 template <
typename T,
typename OUT>
246 return dynamic_cast<OUT
const*
>(
t);
249 template <
typename T,
typename OUT>
260 "attempting to cast a null RefToBase;\n"
261 "You should check for nullity before casting.");
264 checkTypeCompatibility<T, typename REF::value_type>();
272 return REF(
id(),
key(), getter);
276 if (value ==
nullptr) {
281 return REF(
id(), newValue,
key(), isTransient());
285 "RefToBase<T>::castTo Error attempting to cast mismatched types\n"
286 "casting from RefToBase with T: ",
296 return !
id().isValid();
313 return holder_ ? holder_->isEqualTo(*rhs.
holder_) : holder_ == rhs.
holder_;
318 return !(*
this == rhs);
328 return holder_ ? holder_->productGetter() :
nullptr;
333 return holder_ ? holder_->getPtr() :
nullptr;
338 return holder_ ? holder_->holder() : std::unique_ptr<reftobase::RefHolderBase>();
357 template <
typename T>
RefToBase & operator=(RefToBase &&other) noexcept
value_type const * get() const
edm::Ref< Container > Ref
uint16_t *__restrict__ id
virtual bool isTransient() const =0
bool isNonnull() const
Checks for non-null.
virtual bool isAvailable() const =0
#define CMS_CLASS_VERSION(_version_)
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
EDProductGetter const * productGetter(std::atomic< void const * > const &iCache)
void swap(Association< C > &lhs, Association< C > &rhs)
bool operator==(RefToBase const &rhs) 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)
Container::value_type value_type
reftobase::BaseHolder< value_type > * holder_
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
value_type const * operator->() const
tuple key
prepare the HTCondor submission files and eventually submit them
bool operator!=(RefToBase const &rhs) const
edm::RefProd< Container > RefProd
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
std::unique_ptr< reftobase::RefHolderBase > holder() const