EIC 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
 
 Result (const Result< void, E > &other)=default
 
Result< void, E > & operator= (const Result< void, E > &other)=default
 
 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
 
E & error ()&noexcept
 
error ()&&noexcept
 

Static Public Member Functions

static Result< void, E > success ()
 
static Result< void, E > failure (E error)
 

Private Attributes

std::optional< E > m_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 220 of file Result.hpp.

View newest version in sPHENIX GitHub at line 220 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 241 of file Result.hpp.

View newest version in sPHENIX GitHub at line 241 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 258 of file Result.hpp.

View newest version in sPHENIX GitHub at line 258 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 298 of file Result.hpp.

View newest version in sPHENIX GitHub at line 298 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 305 of file Result.hpp.

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

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

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

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

Definition at line 283 of file Result.hpp.

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

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 291 of file Result.hpp.

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

Referenced by pepsi_pdfinfo().

+ Here is the caller graph for this function:

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 247 of file Result.hpp.

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

References m_opt.

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 267 of file Result.hpp.

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

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 276 of file Result.hpp.

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

Member Data Documentation

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

Definition at line 308 of file Result.hpp.

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

Referenced by operator=().


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