Holder of any object instance.
Normally used with TFile, where any object can be read. Normally RShread or RUnique should be used
Definition at line 25 of file RAnyObjectHolder.hxx.
Public Member Functions | |
| RAnyObjectHolder (TClass *cl, void *obj, bool owner=false) | |
| virtual | ~RAnyObjectHolder () |
| template<class T> | |
| bool | CanCastTo () const |
| auto | Copy () const |
| Clone container. | |
| void | Forget () final |
| 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. | |
| const TClass * | GetClass () const final |
| Returns class of contained object. | |
| const void * | GetObject () const final |
| Returns direct (temporary) object pointer. | |
| template<class T> | |
| bool | InheritsFrom () const |
Protected Member Functions | |
| void * | AccessObject () final |
| Returns plain object pointer without care about ownership, should not be used often. | |
| RHolder * | DoCopy () const final |
| Create copy of container, works only when pointer can be shared. | |
| virtual void * | GetShared () const |
| Returns pointer on existing shared_ptr<T>. | |
| void * | TakeObject () final |
| Returns pointer with ownership, normally via unique_ptr<T>::release() or tobj->Clone(). | |
Private Attributes | |
| TClass * | fClass {nullptr} |
| ! object class | |
| void * | fObj {nullptr} |
| ! plain holder without IO | |
| bool | fOwner {false} |
| ! is object owner | |
#include <ROOT/Browsable/RAnyObjectHolder.hxx>
|
inline |
Definition at line 49 of file RAnyObjectHolder.hxx.
|
inlinevirtual |
Definition at line 50 of file RAnyObjectHolder.hxx.
|
inlinefinalprotectedvirtual |
Returns plain object pointer without care about ownership, should not be used often.
Reimplemented from ROOT::Browsable::RHolder.
Definition at line 30 of file RAnyObjectHolder.hxx.
|
inlineinherited |
Definition at line 67 of file RHolder.hxx.
|
inlineinherited |
Clone container.
Trivial for shared_ptr and TObject holder, does not work for unique_ptr
Definition at line 85 of file RHolder.hxx.
|
inlinefinalprotectedvirtual |
Create copy of container, works only when pointer can be shared.
Reimplemented from ROOT::Browsable::RHolder.
Definition at line 42 of file RAnyObjectHolder.hxx.
|
inlinefinalvirtual |
Clear all pointers without performing cleanup.
Reimplemented from ROOT::Browsable::RHolder.
Definition at line 56 of file RAnyObjectHolder.hxx.
|
inlineinherited |
Returns direct object pointer cast to provided class.
Definition at line 75 of file RHolder.hxx.
|
inlineinherited |
Returns plains pointer on object without ownership, only can be used for TObjects.
Definition at line 121 of file RHolder.hxx.
|
inlineinherited |
Returns shared_ptr of contained object.
Definition at line 106 of file RHolder.hxx.
|
inlineinherited |
Returns unique_ptr of contained object.
Definition at line 89 of file RHolder.hxx.
|
inlinefinalvirtual |
Returns class of contained object.
Implements ROOT::Browsable::RHolder.
Definition at line 63 of file RAnyObjectHolder.hxx.
|
inlinefinalvirtual |
Returns direct (temporary) object pointer.
Implements ROOT::Browsable::RHolder.
Definition at line 64 of file RAnyObjectHolder.hxx.
|
inlineprotectedvirtualinherited |
Returns pointer on existing shared_ptr<T>.
Reimplemented in ROOT::Browsable::RShared< T >.
Definition at line 37 of file RHolder.hxx.
|
inlineinherited |
Definition at line 61 of file RHolder.hxx.
|
inlinefinalprotectedvirtual |
Returns pointer with ownership, normally via unique_ptr<T>::release() or tobj->Clone().
Reimplemented from ROOT::Browsable::RHolder.
Definition at line 32 of file RAnyObjectHolder.hxx.
|
private |
! object class
Definition at line 26 of file RAnyObjectHolder.hxx.
|
private |
! plain holder without IO
Definition at line 27 of file RAnyObjectHolder.hxx.
|
private |
! is object owner
Definition at line 28 of file RAnyObjectHolder.hxx.