Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Browsable::RHolder Class Referenceabstract

Basic class for object holder of any kind.

Could be used to transfer shared_ptr or unique_ptr or plain pointer

Author
Sergey Linev S.Lin.nosp@m.ev@g.nosp@m.si.de
Date
2019-10-19
Warning
This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!

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 TClassGetClass () 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 RHolderDoCopy () 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>

Inheritance diagram for ROOT::Browsable::RHolder:
[legend]

Constructor & Destructor Documentation

◆ ~RHolder()

virtual ROOT::Browsable::RHolder::~RHolder ( )
virtualdefault

Member Function Documentation

◆ AccessObject()

virtual void * ROOT::Browsable::RHolder::AccessObject ( )
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.

◆ CanCastTo()

template<class T >
bool ROOT::Browsable::RHolder::CanCastTo ( ) const
inline

Definition at line 69 of file RHolder.hxx.

◆ Copy()

auto ROOT::Browsable::RHolder::Copy ( ) const
inline

Clone container.

Trivial for shared_ptr and TObject holder, does not work for unique_ptr

Definition at line 87 of file RHolder.hxx.

◆ DoCopy()

virtual RHolder * ROOT::Browsable::RHolder::DoCopy ( ) const
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.

◆ Forget()

virtual void ROOT::Browsable::RHolder::Forget ( )
inlinevirtual

Clear all pointers without performing cleanup.

Reimplemented in ROOT::Browsable::RAnyObjectHolder, and ROOT::Browsable::TObjectHolder.

Definition at line 60 of file RHolder.hxx.

◆ Get()

template<class T >
const T * ROOT::Browsable::RHolder::Get ( ) const
inline

Returns direct object pointer cast to provided class.

Definition at line 77 of file RHolder.hxx.

◆ get_object()

template<class T >
T * ROOT::Browsable::RHolder::get_object ( )
inline

Returns plains pointer on object without ownership, only can be used for TObjects.

Definition at line 123 of file RHolder.hxx.

◆ get_shared()

template<class T >
std::shared_ptr< T > ROOT::Browsable::RHolder::get_shared ( )
inline

Returns shared_ptr of contained object.

Definition at line 108 of file RHolder.hxx.

◆ get_unique()

template<class T >
std::unique_ptr< T > ROOT::Browsable::RHolder::get_unique ( )
inline

Returns unique_ptr of contained object.

Definition at line 91 of file RHolder.hxx.

◆ GetClass()

virtual const TClass * ROOT::Browsable::RHolder::GetClass ( ) const
pure virtual

◆ GetObject()

virtual const void * ROOT::Browsable::RHolder::GetObject ( ) const
pure virtual

◆ GetShared()

virtual void * ROOT::Browsable::RHolder::GetShared ( ) const
inlineprotectedvirtual

Returns pointer on existing shared_ptr<T>

Reimplemented in ROOT::Browsable::RShared< T >.

Definition at line 39 of file RHolder.hxx.

◆ InheritsFrom()

template<class T >
bool ROOT::Browsable::RHolder::InheritsFrom ( ) const
inline

Definition at line 63 of file RHolder.hxx.

◆ TakeObject()

virtual void * ROOT::Browsable::RHolder::TakeObject ( )
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.


The documentation for this class was generated from the following file: