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>
85 template <
typename T1>
88 RefToBase(std::shared_ptr<reftobase::RefHolderBase>
p);
148 other.holder_ =
nullptr;
154 holder_ =
other.holder_;
155 other.holder_ =
nullptr;
160 template <
typename C1,
typename T1,
typename F1>
162 : holder_(new reftobase::Holder<
T,
Ref<C1, T1, F1>>(iRef)) {}
165 template <
typename C>
169 template <
typename T1>
172 new reftobase::IndirectHolder<
T>(
std::shared_ptr<
edm::reftobase::RefHolderBase>(iRef.holder().
release()))) {
186 : holder_(new reftobase::IndirectHolder<
T>(
p)) {}
202 return *getPtrImpl();
217 return holder_ ? holder_->id() :
ProductID();
222 if (holder_ ==
nullptr) {
224 "attempting get key from null RefToBase;\n" 225 "You should check for nullity before calling key().");
228 return holder_->key();
234 template <
typename T,
typename U>
237 "RefToBase::castTo error element types are not related by inheritance");
240 template <
typename T,
typename U>
246 template <
typename T,
typename OUT>
251 template <
typename T,
typename OUT>
262 "attempting to cast a null RefToBase;\n" 263 "You should check for nullity before casting.");
266 checkTypeCompatibility<T, typename REF::value_type>();
274 return REF(
id(),
key(), getter);
278 if (
value ==
nullptr) {
283 return REF(
id(), newValue,
key(), isTransient());
287 "RefToBase<T>::castTo Error attempting to cast mismatched types\n" 288 "casting from RefToBase with T: ",
298 return !
id().isValid();
315 return holder_ ? holder_->isEqualTo(*rhs.
holder_) : holder_ == rhs.
holder_;
320 return !(*
this == rhs);
330 return holder_ ? holder_->productGetter() :
nullptr;
335 return holder_ ? holder_->getPtr() :
nullptr;
340 return holder_ ? holder_->
holder() : std::unique_ptr<reftobase::RefHolderBase>();
359 template <
typename T>
RefToBase & operator=(RefToBase &&other) noexcept
Basic3DVector & operator=(const Basic3DVector &)=default
Assignment operator.
edm::Ref< Container > Ref
std::unique_ptr< reftobase::RefHolderBase > holder() const
void swap(RefToBase< T > &a, RefToBase< T > &b)
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
void swap(RefToBase &other)
Container::value_type value_type
reftobase::BaseHolder< value_type > * holder_
EDProductGetter const * productGetter() const
bool operator==(const QGLikelihoodParameters &lhs, const QGLikelihoodCategory &rhs)
Test if parameters are compatible with category.
value_type const * getPtrImpl() const
key
prepare the HTCondor submission files and eventually submit them
def template(fileName, svg, replaceme="REPLACEME")
bool isNull() const
Checks for null.
bool operator!=(DTCELinkId const &lhs, DTCELinkId const &rhs)
edm::RefProd< Container > RefProd
T castTo(const char *arg)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
EDProductGetter const * productGetter(std::atomic< void const *> const &iCache)
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
value_type const * get() const