9#ifndef ROOT7_Browsable_RHolder
10#define ROOT7_Browsable_RHolder
17namespace Experimental {
60 return TClass::GetClass<T>()->InheritsFrom(
GetClass());
66 return const_cast<TClass *
>(
GetClass())->GetBaseClassOffset(TClass::GetClass<T>()) == 0;
81 auto Copy()
const {
return std::unique_ptr<RHolder>(
DoCopy()); }
93 std::unique_ptr<T> unique;
94 unique.reset(
static_cast<T *
>(pobj));
109 return *(
static_cast<std::shared_ptr<T> *
>(pshared));
112 return get_unique<T>();
Basic class for object holder of any kind.
virtual const TClass * GetClass() const =0
Returns class of contained object.
virtual RHolder * DoCopy() const
Create copy of container, works only when pointer can be shared.
std::shared_ptr< T > get_shared()
Returns shared_ptr of contained object.
virtual ~RHolder()=default
virtual void * AccessObject()
Returns plain object pointer without care about ownership, should not be used often.
bool InheritsFrom() const
const T * Get() const
Returns direct object pointer cast to provided class.
virtual const void * GetObject() const =0
Returns direct (temporary) object pointer.
virtual void * TakeObject()
Returns pointer with ownership, normally via unique_ptr<T>::release() or tobj->Clone()
T * get_object()
Returns plains pointer on object without ownership, only can be used for TObjects.
auto Copy() const
Clone container.
virtual void * GetShared() const
Returns pointer on existing shared_ptr<T>
std::unique_ptr< T > get_unique()
Returns unique_ptr of contained object.
TClass instances represent classes, structs and namespaces in the ROOT type system.
RLogChannel & BrowsableLog()
Log channel for Browsable diagnostics.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...