Logo ROOT  
Reference Guide
ROOT::Experimental::RResult< T > Class Template Reference

template<typename T>
class ROOT::Experimental::RResult< T >


The class is used as a return type for operations that can fail; wraps a value of type T or an RError

RResult enforces checking whether it contains a valid value or an error state. If the RResult leaves the scope unchecked, it will throw an exception (due to ~RResultBase).

Definition at line 186 of file RError.hxx.

Public Member Functions

 RResult (const T &value)
 
 RResult (T &&value)
 
 RResult (RError &&error)
 
 RResult (const RResult &other)=delete
 
 RResult (RResult &&other)=default
 
 ~RResult ()=default
 
const T & Get ()
 
 operator bool ()
 
RResultoperator= (const RResult &other)=delete
 
RResultoperator= (RResult &&other)=default
 
- Public Member Functions inherited from ROOT::Experimental::Internal::RResultBase
 RResultBase (const RResultBase &other)=delete
 
 RResultBase (RResultBase &&other)=default
 
 ~RResultBase () noexcept(false)
 
RErrorGetError ()
 
voidoperator new (std::size_t size)=delete
 
voidoperator new (std::size_t, void *)=delete
 
voidoperator new[] (std::size_t)=delete
 
voidoperator new[] (std::size_t, void *)=delete
 
RResultBaseoperator= (const RResultBase &other)=delete
 
RResultBaseoperator= (RResultBase &&other)=default
 
void Throw ()
 Throws an RException with fError. More...
 

Static Public Member Functions

static RResultForward (RResult &result, RError::RLocation &&sourceLocation)
 Used by R__FORWARD_RESULT in order to keep track of the stack trace in case of errors. More...
 

Private Attributes

fValue
 The result value in case of successful execution. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ROOT::Experimental::Internal::RResultBase
 RResultBase ()=default
 
 RResultBase (RError &&error)
 
bool Check ()
 Used by the RResult<T> bool operator. More...
 
- Protected Attributes inherited from ROOT::Experimental::Internal::RResultBase
std::unique_ptr< RErrorfError
 This is the nullptr for an RResult representing success. More...
 
bool fIsChecked {false}
 Switches to true once the user of an RResult object checks the object status. More...
 

#include <ROOT/RError.hxx>

Inheritance diagram for ROOT::Experimental::RResult< T >:
[legend]

Constructor & Destructor Documentation

◆ RResult() [1/5]

template<typename T >
ROOT::Experimental::RResult< T >::RResult ( const T &  value)
inline

Definition at line 192 of file RError.hxx.

◆ RResult() [2/5]

template<typename T >
ROOT::Experimental::RResult< T >::RResult ( T &&  value)
inline

Definition at line 193 of file RError.hxx.

◆ RResult() [3/5]

template<typename T >
ROOT::Experimental::RResult< T >::RResult ( RError &&  error)
inline

Definition at line 194 of file RError.hxx.

◆ RResult() [4/5]

template<typename T >
ROOT::Experimental::RResult< T >::RResult ( const RResult< T > &  other)
delete

◆ RResult() [5/5]

template<typename T >
ROOT::Experimental::RResult< T >::RResult ( RResult< T > &&  other)
default

◆ ~RResult()

template<typename T >
ROOT::Experimental::RResult< T >::~RResult ( )
default

Member Function Documentation

◆ Forward()

template<typename T >
static RResult& ROOT::Experimental::RResult< T >::Forward ( RResult< T > &  result,
RError::RLocation &&  sourceLocation 
)
inlinestatic

Used by R__FORWARD_RESULT in order to keep track of the stack trace in case of errors.

Definition at line 204 of file RError.hxx.

◆ Get()

template<typename T >
const T& ROOT::Experimental::RResult< T >::Get ( )
inline

Definition at line 210 of file RError.hxx.

◆ operator bool()

template<typename T >
ROOT::Experimental::RResult< T >::operator bool ( )
inlineexplicit

Definition at line 222 of file RError.hxx.

◆ operator=() [1/2]

template<typename T >
RResult& ROOT::Experimental::RResult< T >::operator= ( const RResult< T > &  other)
delete

◆ operator=() [2/2]

template<typename T >
RResult& ROOT::Experimental::RResult< T >::operator= ( RResult< T > &&  other)
default

Member Data Documentation

◆ fValue

template<typename T >
T ROOT::Experimental::RResult< T >::fValue
private

The result value in case of successful execution.

Definition at line 189 of file RError.hxx.


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