Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::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 33 of file RHolder.hxx.

Public Member Functions

virtual ~RHolder ()=default
 
template<class T >
bool CanCastTo () const
 
auto Copy () const
 Clone container.
 
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::Experimental::Browsable::RHolder:
[legend]

Constructor & Destructor Documentation

◆ ~RHolder()

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

Member Function Documentation

◆ AccessObject()

virtual void * ROOT::Experimental::Browsable::RHolder::AccessObject ( )
inlineprotectedvirtual

Returns plain object pointer without care about ownership, should not be used often.

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

Definition at line 43 of file RHolder.hxx.

◆ CanCastTo()

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

Definition at line 64 of file RHolder.hxx.

◆ Copy()

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

Clone container.

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

Definition at line 82 of file RHolder.hxx.

◆ DoCopy()

virtual RHolder * ROOT::Experimental::Browsable::RHolder::DoCopy ( ) const
inlineprotectedvirtual

Create copy of container, works only when pointer can be shared.

Reimplemented in ROOT::Experimental::Browsable::RAnyObjectHolder, ROOT::Experimental::Browsable::RShared< T >, and ROOT::Experimental::Browsable::TObjectHolder.

Definition at line 46 of file RHolder.hxx.

◆ Get()

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

Returns direct object pointer cast to provided class.

Definition at line 72 of file RHolder.hxx.

◆ get_object()

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

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

Definition at line 118 of file RHolder.hxx.

◆ get_shared()

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

Returns shared_ptr of contained object.

Definition at line 103 of file RHolder.hxx.

◆ get_unique()

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

Returns unique_ptr of contained object.

Definition at line 86 of file RHolder.hxx.

◆ GetClass()

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

◆ GetObject()

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

◆ GetShared()

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

Returns pointer on existing shared_ptr<T>

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

Definition at line 37 of file RHolder.hxx.

◆ InheritsFrom()

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

Definition at line 58 of file RHolder.hxx.

◆ TakeObject()

virtual void * ROOT::Experimental::Browsable::RHolder::TakeObject ( )
inlineprotectedvirtual

Returns pointer with ownership, normally via unique_ptr<T>::release() or tobj->Clone()

Reimplemented in ROOT::Experimental::Browsable::RAnyObjectHolder, ROOT::Experimental::Browsable::RUnique< T >, and ROOT::Experimental::Browsable::TObjectHolder.

Definition at line 40 of file RHolder.hxx.


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