Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::RResult< void > Class Reference

RResult<void> has no data member and no Inspect() method but instead a Success() factory method.

Definition at line 263 of file RError.hxx.

Public Member Functions

 RResult (const RResult &other)=delete
 
 RResult (const RResult &other)=delete
 
 RResult (const void &value)
 
 RResult (RError &&error)
 
 RResult (RError &&error)
 
 RResult (RResult &&other)=default
 
 RResult (RResult &&other)=default
 
 RResult (void &&value)
 
 ~RResult ()=default
 
 ~RResult ()=default
 
RResultForward (RError::RLocation &&sourceLocation)
 Used by R__FORWARD_RESULT in order to keep track of the stack trace in case of errors.
 
RResultForward (RError::RLocation &&sourceLocation)
 Used by R__FORWARD_RESULT in order to keep track of the stack trace in case of errors.
 
std::optional< RErrorGetError () const
 
const void & Inspect ()
 If the operation was successful, returns a const reference to the inner type.
 
 operator bool ()
 
 operator bool ()
 
RResultoperator= (const RResult &other)=delete
 
RResultoperator= (const RResult &other)=delete
 
RResultoperator= (RResult &&other)=default
 
RResultoperator= (RResult &&other)=default
 
void Throw ()
 Throws an RException with fError.
 
void ThrowOnError ()
 Short-hand method to throw an exception in the case of errors.
 
void Unwrap ()
 If the operation was successful, returns the inner type by value.
 

Static Public Member Functions

static RError ForwardError (RResultBase &&result, RError::RLocation &&sourceLocation)
 Used by R__FORWARD_ERROR in order to keep track of the stack trace.
 
static RResult Success ()
 Returns a RResult<void> that captures the successful execution of the function.
 

Protected Member Functions

bool Check ()
 Used by the RResult<T> bool operator.
 

Protected Attributes

std::unique_ptr< RErrorfError
 This is the nullptr for an RResult representing success.
 
bool fIsChecked
 Switches to true once the user of an RResult object checks the object status.
 

Private Member Functions

 RResult ()=default
 
void ThrowOnError ()
 

Private Attributes

std::optional< void > fValue
 The result value, only present in case of successful execution.
 

#include <ROOT/RError.hxx>

Inheritance diagram for ROOT::RResult< void >:
[legend]

Constructor & Destructor Documentation

◆ RResult() [1/9]

ROOT::RResult< void >::RResult ( )
privatedefault

◆ RResult() [2/9]

ROOT::RResult< void >::RResult ( RError && error)
inline

Definition at line 270 of file RError.hxx.

◆ RResult() [3/9]

ROOT::RResult< void >::RResult ( const RResult< void > & other)
delete

◆ RResult() [4/9]

ROOT::RResult< void >::RResult ( RResult< void > && other)
default

◆ ~RResult() [1/2]

ROOT::RResult< void >::~RResult ( )
default

◆ RResult() [5/9]

ROOT::RResult< void >::RResult ( const void & value)
inline

Definition at line 218 of file RError.hxx.

◆ RResult() [6/9]

ROOT::RResult< void >::RResult ( void && value)
inline

Definition at line 219 of file RError.hxx.

◆ RResult() [7/9]

ROOT::RResult< void >::RResult ( RError && error)
inline

Definition at line 220 of file RError.hxx.

◆ RResult() [8/9]

ROOT::RResult< void >::RResult ( const RResult< void > & other)
delete

◆ RResult() [9/9]

ROOT::RResult< void >::RResult ( RResult< void > && other)
default

◆ ~RResult() [2/2]

ROOT::RResult< void >::~RResult ( )
default

Member Function Documentation

◆ Check()

bool ROOT::RResultBase::Check ( )
inlineprotected

Used by the RResult<T> bool operator.

Definition at line 108 of file RError.hxx.

◆ Forward() [1/2]

RResult & ROOT::RResult< void >::Forward ( RError::RLocation && sourceLocation)
inline

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

Definition at line 230 of file RError.hxx.

◆ Forward() [2/2]

RResult & ROOT::RResult< void >::Forward ( RError::RLocation && sourceLocation)
inline

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

Definition at line 280 of file RError.hxx.

◆ ForwardError()

static RError ROOT::RResultBase::ForwardError ( RResultBase && result,
RError::RLocation && sourceLocation )
inlinestaticnodiscard

Used by R__FORWARD_ERROR in order to keep track of the stack trace.

Definition at line 128 of file RError.hxx.

◆ GetError()

std::optional< RError > ROOT::RResultBase::GetError ( ) const
inline

Definition at line 122 of file RError.hxx.

◆ Inspect()

const void & ROOT::RResult< void >::Inspect ( )
inline

If the operation was successful, returns a const reference to the inner type.

If there was an error, Inspect() instead throws an exception.

Definition at line 239 of file RError.hxx.

◆ operator bool() [1/2]

ROOT::RResult< void >::operator bool ( )
inlineexplicit

Definition at line 258 of file RError.hxx.

◆ operator bool() [2/2]

ROOT::RResult< void >::operator bool ( )
inlineexplicit

Definition at line 295 of file RError.hxx.

◆ operator=() [1/4]

RResult & ROOT::RResult< void >::operator= ( const RResult< void > & other)
delete

◆ operator=() [2/4]

RResult & ROOT::RResult< void >::operator= ( const RResult< void > & other)
delete

◆ operator=() [3/4]

RResult & ROOT::RResult< void >::operator= ( RResult< void > && other)
default

◆ operator=() [4/4]

RResult & ROOT::RResult< void >::operator= ( RResult< void > && other)
default

◆ Success()

static RResult ROOT::RResult< void >::Success ( )
inlinestatic

Returns a RResult<void> that captures the successful execution of the function.

Definition at line 269 of file RError.hxx.

◆ Throw()

void ROOT::RResultBase::Throw ( )

Throws an RException with fError.

Definition at line 124 of file RError.cxx.

◆ ThrowOnError() [1/2]

void ROOT::RResult< void >::ThrowOnError ( )
inlineprivate

Definition at line 203 of file RError.hxx.

◆ ThrowOnError() [2/2]

void ROOT::RResult< void >::ThrowOnError ( )
inline

Short-hand method to throw an exception in the case of errors.

Does nothing for successful RResults.

Definition at line 289 of file RError.hxx.

◆ Unwrap()

void ROOT::RResult< void >::Unwrap ( )
inline

If the operation was successful, returns the inner type by value.

For move-only types, Unwrap can only be called once, as it yields ownership of the inner value to the caller using std::move, potentially leaving the RResult in an unspecified state.

If there was an error, Unwrap() instead throws an exception.

Definition at line 252 of file RError.hxx.

Member Data Documentation

◆ fError

std::unique_ptr<RError> ROOT::RResultBase::fError
protected

This is the nullptr for an RResult representing success.

Definition at line 100 of file RError.hxx.

◆ fIsChecked

bool ROOT::RResultBase::fIsChecked
protected

Switches to true once the user of an RResult object checks the object status.

Definition at line 102 of file RError.hxx.

◆ fValue

std::optional<void> ROOT::RResult< void >::fValue
private

The result value, only present in case of successful execution.

Definition at line 200 of file RError.hxx.

  • core/foundation/inc/ROOT/RError.hxx