Basic class for object holder of any kind.
Could be used to transfer shared_ptr or unique_ptr or plain pointer
Definition at line 35 of file RHolder.hxx.
Public Member Functions | |
virtual | ~RHolder ()=default |
template<class T > | |
bool | CanCastTo () const |
auto | Copy () const |
Clone container. | |
virtual void | Forget () |
Clear all pointers without performing cleanup. | |
template<class T > | |
const T * | Get () const |
Returns direct object pointer cast to provided class. | |
template<class T > | |
T * | get_object () |
Returns plains pointer on object without ownership, only can be used for TObjects. | |
template<class T > | |
std::shared_ptr< T > | get_shared () |
Returns shared_ptr of contained object. | |
template<class T > | |
std::unique_ptr< T > | get_unique () |
Returns unique_ptr of contained object. | |
virtual const TClass * | GetClass () const =0 |
Returns class of contained object. | |
virtual const void * | GetObject () const =0 |
Returns direct (temporary) object pointer. | |
template<class T > | |
bool | InheritsFrom () const |
Protected Member Functions | |
virtual void * | AccessObject () |
Returns plain object pointer without care about ownership, should not be used often. | |
virtual RHolder * | DoCopy () const |
Create copy of container, works only when pointer can be shared. | |
virtual void * | GetShared () const |
Returns pointer on existing shared_ptr<T> | |
virtual void * | TakeObject () |
Returns pointer with ownership, normally via unique_ptr<T>::release() or tobj->Clone() | |
#include <ROOT/Browsable/RHolder.hxx>
|
virtualdefault |
|
inlineprotectedvirtual |
Returns plain object pointer without care about ownership, should not be used often.
Reimplemented in ROOT::Browsable::RAnyObjectHolder, and ROOT::Browsable::TObjectHolder.
Definition at line 45 of file RHolder.hxx.
|
inline |
Definition at line 69 of file RHolder.hxx.
|
inline |
Clone container.
Trivial for shared_ptr and TObject holder, does not work for unique_ptr
Definition at line 87 of file RHolder.hxx.
|
inlineprotectedvirtual |
Create copy of container, works only when pointer can be shared.
Reimplemented in ROOT::Browsable::RAnyObjectHolder, ROOT::Browsable::RShared< T >, and ROOT::Browsable::TObjectHolder.
Definition at line 48 of file RHolder.hxx.
|
inlinevirtual |
Clear all pointers without performing cleanup.
Reimplemented in ROOT::Browsable::RAnyObjectHolder, and ROOT::Browsable::TObjectHolder.
Definition at line 60 of file RHolder.hxx.
|
inline |
Returns direct object pointer cast to provided class.
Definition at line 77 of file RHolder.hxx.
|
inline |
Returns plains pointer on object without ownership, only can be used for TObjects.
Definition at line 123 of file RHolder.hxx.
|
inline |
Returns shared_ptr of contained object.
Definition at line 108 of file RHolder.hxx.
|
inline |
Returns unique_ptr of contained object.
Definition at line 91 of file RHolder.hxx.
|
pure virtual |
Returns class of contained object.
Implemented in ROOT::Browsable::RAnyObjectHolder, ROOT::Browsable::RShared< T >, ROOT::Browsable::RUnique< T >, ROOT::Browsable::TObjectHolder, and RFieldHolder.
|
pure virtual |
Returns direct (temporary) object pointer.
Implemented in ROOT::Browsable::RAnyObjectHolder, ROOT::Browsable::RShared< T >, ROOT::Browsable::RUnique< T >, ROOT::Browsable::TObjectHolder, and RFieldHolder.
|
inlineprotectedvirtual |
Returns pointer on existing shared_ptr<T>
Reimplemented in ROOT::Browsable::RShared< T >.
Definition at line 39 of file RHolder.hxx.
|
inline |
Definition at line 63 of file RHolder.hxx.
|
inlineprotectedvirtual |
Returns pointer with ownership, normally via unique_ptr<T>::release() or tobj->Clone()
Reimplemented in ROOT::Browsable::RAnyObjectHolder, ROOT::Browsable::RUnique< T >, and ROOT::Browsable::TObjectHolder.
Definition at line 42 of file RHolder.hxx.