Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Acts::Result< void, E > Class Template Reference

#include <acts/blob/sPHENIX/Core/include/Acts/Utilities/Result.hpp>

Public Member Functions

 Result ()=default
 Default constructor which initializes the result in the ok state.
 
 Result (const Result< void, E > &other)=default
 The copy constructor is deleted.
 
Result< void, E > & operator= (const Result< void, E > &other)=default
 The (self) assignment operator is deleted.
 
 Result (Result< void, E > &&other)
 
Result< void, E > & operator= (Result< void, E > &&other) noexcept
 
template<typename E2 >
 Result (E2 error) noexcept
 
template<typename E2 >
Result< void, E > & operator= (E2 error)
 
bool ok () const noexcept
 
Eerror ()&noexcept
 
const Eerror () const &noexcept
 
E error ()&&noexcept
 

Static Public Member Functions

static Result< void, Esuccess ()
 
static Result< void, Efailure (E error)
 

Private Attributes

std::optional< Em_opt
 

Detailed Description

template<typename E>
class Acts::Result< void, E >

Template specialization for the void case. This specialization handles the case where there is no actual return value, but an error might be returned. Returning the error directly would make handling different from other functions using the Result<T, E> mechanism. Result<void, E> does not have the dereference operator, and value methods. The static success factory does not accept a value.

Note
To ease usage, this Result<void, E> is default constructible in the ok state, whereas Result<T, E> is not.
Template Parameters
EThe type of the error

Definition at line 208 of file Result.hpp.

View newest version in sPHENIX GitHub at line 208 of file Result.hpp

Constructor & Destructor Documentation

template<typename E >
Acts::Result< void, E >::Result ( )
default

Default constructor which initializes the result in the ok state.

template<typename E >
Acts::Result< void, E >::Result ( const Result< void, E > &  other)
default

The copy constructor is deleted.

template<typename E >
Acts::Result< void, E >::Result ( Result< void, E > &&  other)
inline

Move constructor

Parameters
otherThe other result object, rvalue ref

Definition at line 221 of file Result.hpp.

View newest version in sPHENIX GitHub at line 221 of file Result.hpp

template<typename E >
template<typename E2 >
Acts::Result< void, E >::Result ( E2  error)
inlinenoexcept

Constructor from error. This implicitly requires E2 to be convertible to E.

Template Parameters
E2The type of the actual error
Parameters
errorThe instance of the actual error

Definition at line 235 of file Result.hpp.

View newest version in sPHENIX GitHub at line 235 of file Result.hpp

Member Function Documentation

template<typename E >
E& Acts::Result< void, E >::error ( )
inlinenoexcept

Returns a reference to the error stored in the result.

Note
If res.ok() this method will abort (noexcept)
Returns
Reference to the error

Definition at line 265 of file Result.hpp.

View newest version in sPHENIX GitHub at line 265 of file Result.hpp

template<typename E >
const E& Acts::Result< void, E >::error ( ) const
inlinenoexcept

Returns a reference to the error stored in the result.

Note
If res.ok() this method will abort (noexcept)
Returns
Reference to the error

Definition at line 270 of file Result.hpp.

View newest version in sPHENIX GitHub at line 270 of file Result.hpp

template<typename E >
E Acts::Result< void, E >::error ( )
inlinenoexcept

Returns the error by-value.

Note
If res.ok() this method will abort (noexcept)
Returns
Reference to the error

Definition at line 275 of file Result.hpp.

View newest version in sPHENIX GitHub at line 275 of file Result.hpp

References testing::internal::move().

+ Here is the call graph for this function:

template<typename E >
static Result<void, E> Acts::Result< void, E >::failure ( E  error)
inlinestatic

Static factory function to initialize the result in the error state.

Parameters
errorThe error to initialize with.
Returns
Result object, in error state.

Definition at line 254 of file Result.hpp.

View newest version in sPHENIX GitHub at line 254 of file Result.hpp

References testing::internal::move().

+ Here is the call graph for this function:

template<typename E >
bool Acts::Result< void, E >::ok ( ) const
inlinenoexcept

Checks whether this result is in the ok state, and no error.

Returns
bool Whether result contains an error or not.

Definition at line 260 of file Result.hpp.

View newest version in sPHENIX GitHub at line 260 of file Result.hpp

template<typename E >
Result<void, E>& Acts::Result< void, E >::operator= ( const Result< void, E > &  other)
default

The (self) assignment operator is deleted.

template<typename E >
Result<void, E>& Acts::Result< void, E >::operator= ( Result< void, E > &&  other)
inlinenoexcept

Move assignment operator

Parameters
otherThe other result object, rvalue ref

Definition at line 225 of file Result.hpp.

View newest version in sPHENIX GitHub at line 225 of file Result.hpp

References m_opt, and testing::internal::move().

+ Here is the call graph for this function:

template<typename E >
template<typename E2 >
Result<void, E>& Acts::Result< void, E >::operator= ( E2  error)
inline

Assignment operator from an error.

Template Parameters
E2The type of the actual error
Parameters
errorThe instance of the actual error
Returns
The assigned instance

Definition at line 242 of file Result.hpp.

View newest version in sPHENIX GitHub at line 242 of file Result.hpp

References testing::internal::move().

+ Here is the call graph for this function:

template<typename E >
static Result<void, E> Acts::Result< void, E >::success ( )
inlinestatic

Static factory function to initialize the result in the ok state.

Returns
Result object, in ok state

Definition at line 249 of file Result.hpp.

View newest version in sPHENIX GitHub at line 249 of file Result.hpp

Member Data Documentation

template<typename E >
std::optional<E> Acts::Result< void, E >::m_opt
private

Definition at line 278 of file Result.hpp.

View newest version in sPHENIX GitHub at line 278 of file Result.hpp

Referenced by operator=().


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