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 195 of file RError.hxx.
Public Member Functions | |
RResult (const RResult &other)=delete | |
RResult (const T &value) | |
RResult (RError &&error) | |
RResult (RResult &&other)=default | |
RResult (T &&value) | |
~RResult ()=default | |
RResult & | Forward (RError::RLocation &&sourceLocation) |
Used by R__FORWARD_RESULT in order to keep track of the stack trace in case of errors. | |
const T & | Inspect () |
If the operation was successful, returns a const reference to the inner type. | |
operator bool () | |
RResult & | operator= (const RResult &other)=delete |
RResult & | operator= (RResult &&other)=default |
T | Unwrap () |
If the operation was successful, returns the inner type by value. | |
Public Member Functions inherited from ROOT::Experimental::Internal::RResultBase | |
RResultBase (const RResultBase &other)=delete | |
RResultBase (RResultBase &&other)=default | |
~RResultBase () noexcept(false) | |
RError * | GetError () |
void * | operator new (std::size_t size)=delete |
void * | operator new (std::size_t, void *)=delete |
void * | operator new[] (std::size_t)=delete |
void * | operator new[] (std::size_t, void *)=delete |
RResultBase & | operator= (const RResultBase &other)=delete |
RResultBase & | operator= (RResultBase &&other)=default |
void | Throw () |
Throws an RException with fError. | |
Private Member Functions | |
void | ThrowOnError () |
Private Attributes | |
T | fValue |
The result value in case of successful execution. | |
Additional Inherited Members | |
Static Public Member Functions inherited from ROOT::Experimental::Internal::RResultBase | |
static RError | ForwardError (RResultBase &&result, RError::RLocation &&sourceLocation) |
Used by R__FORWARD_ERROR in order to keep track of the stack trace. | |
Protected Member Functions inherited from ROOT::Experimental::Internal::RResultBase | |
RResultBase ()=default | |
RResultBase (RError &&error) | |
bool | Check () |
Used by the RResult<T> bool operator. | |
Protected Attributes inherited from ROOT::Experimental::Internal::RResultBase | |
std::unique_ptr< RError > | fError |
This is the nullptr for an RResult representing success. | |
bool | fIsChecked {false} |
Switches to true once the user of an RResult object checks the object status. | |
#include <ROOT/RError.hxx>
|
inline |
Definition at line 215 of file RError.hxx.
|
inline |
Definition at line 216 of file RError.hxx.
|
inline |
Definition at line 217 of file RError.hxx.
|
delete |
|
default |
|
default |
|
inline |
Used by R__FORWARD_RESULT in order to keep track of the stack trace in case of errors.
Definition at line 227 of file RError.hxx.
|
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 235 of file RError.hxx.
|
inlineexplicit |
Definition at line 252 of file RError.hxx.
|
delete |
|
default |
|
inlineprivate |
Definition at line 201 of file RError.hxx.
|
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 247 of file RError.hxx.
|
private |
The result value in case of successful execution.
Definition at line 198 of file RError.hxx.