|
open62541pp 0.22.0
C++ wrapper of open62541
|
#include <result.hpp>
The template class Result encapsulates a StatusCode and optionally a value.
A result may have one of the following contents:
Result<void> is a template specialization containing only a StatusCode.
The design is inspired by:
Definition at line 53 of file result.hpp.
Public Types | |
| using | ValueType = T |
Public Member Functions | |
| template<typename U = T, std::enable_if_t< std::is_default_constructible_v< U >, int > = 0> | |
| constexpr | Result () noexcept(std::is_nothrow_default_constructible_v< T >) |
| constexpr | Result (const T &value, StatusCode code=UA_STATUSCODE_GOOD) noexcept(std::is_nothrow_copy_constructible_v< T >) |
| constexpr | Result (T &&value, StatusCode code=UA_STATUSCODE_GOOD) noexcept(std::is_nothrow_move_constructible_v< T >) |
| constexpr | Result (const BadResult &error) noexcept |
| constexpr T * | operator-> () noexcept |
| constexpr const T * | operator-> () const noexcept |
| constexpr T & | operator* () &noexcept |
| constexpr const T & | operator* () const &noexcept |
| constexpr T && | operator* () &&noexcept |
| constexpr const T && | operator* () const &&noexcept |
| constexpr StatusCode | code () const noexcept |
| constexpr | operator bool () const noexcept |
| constexpr bool | hasValue () const noexcept |
| constexpr T & | value () & |
| constexpr const T & | value () const & |
| constexpr T && | value () && |
| constexpr const T && | value () const && |
| template<typename U > | |
| constexpr T | valueOr (U &&defaultValue) const & |
| template<typename U > | |
| constexpr T | valueOr (U &&defaultValue) && |
| template<typename F > | |
| constexpr auto | transform (F &&func) & |
| template<typename F > | |
| constexpr auto | transform (F &&func) const & |
| template<typename F > | |
| constexpr auto | transform (F &&func) && |
| template<typename F > | |
| constexpr auto | transform (F &&func) const && |
| template<typename F > | |
| constexpr auto | andThen (F &&func) & |
| template<typename F > | |
| constexpr auto | andThen (F &&func) const & |
| template<typename F > | |
| constexpr auto | andThen (F &&func) && |
| template<typename F > | |
| constexpr auto | andThen (F &&func) const && |
| template<typename F > | |
| constexpr auto | orElse (F &&func) & |
| template<typename F > | |
| constexpr auto | orElse (F &&func) const & |
| template<typename F > | |
| constexpr auto | orElse (F &&func) && |
| template<typename F > | |
| constexpr auto | orElse (F &&func) const && |
| using opcua::Result< T >::ValueType = T |
Definition at line 55 of file result.hpp.
|
inlineconstexprnoexcept |
Default constructor (default-initialized value and good StatusCode).
Definition at line 61 of file result.hpp.
|
inlineconstexprnoexcept |
Construct a Result from a value (lvalue) and a StatusCode.
Definition at line 70 of file result.hpp.
|
inlineconstexprnoexcept |
Construct a Result from a value (rvalue) and a StatusCode.
Definition at line 79 of file result.hpp.
|
inlineconstexprnoexcept |
Construct a Result from a BadResult.
Definition at line 88 of file result.hpp.
|
inlineconstexpr |
Transforms Result<T> to Result<U> using the given function.
The function is only applied if the Result has a value. Otherwise Result<U> with the same bad StatusCode is returned.
| func | Callable with the signature Result<U>(T&&) or Result<U>(T&&, StatusCode) |
Definition at line 233 of file result.hpp.
|
inlineconstexpr |
Transforms Result<T> to Result<U> using the given function.
The function is only applied if the Result has a value. Otherwise Result<U> with the same bad StatusCode is returned.
| func | Callable with the signature Result<U>(T&&) or Result<U>(T&&, StatusCode) |
Definition at line 245 of file result.hpp.
|
inlineconstexpr |
Transforms Result<T> to Result<U> using the given function.
The function is only applied if the Result has a value. Otherwise Result<U> with the same bad StatusCode is returned.
| func | Callable with the signature Result<U>(T&&) or Result<U>(T&&, StatusCode) |
Definition at line 239 of file result.hpp.
|
inlineconstexpr |
Transforms Result<T> to Result<U> using the given function.
The function is only applied if the Result has a value. Otherwise Result<U> with the same bad StatusCode is returned.
| func | Callable with the signature Result<U>(T&&) or Result<U>(T&&, StatusCode) |
Definition at line 251 of file result.hpp.
|
inlineconstexprnoexcept |
Get the StatusCode of the Result.
Definition at line 137 of file result.hpp.
|
inlineconstexprnoexcept |
Check if the Result has a value.
Definition at line 151 of file result.hpp.
|
inlineexplicitconstexprnoexcept |
Check if the Result has a value.
Definition at line 144 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 123 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 113 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 128 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 118 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 105 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 100 of file result.hpp.
|
inlineconstexpr |
Transforms Result<T> with a bad StatusCode to Result<T> using the given function.
The function is only applied if the Result has no value. Otherwise the same Result<T> is returned.
| func | Callable with the signature Result<T>(StatusCode) |
Definition at line 262 of file result.hpp.
|
inlineconstexpr |
Transforms Result<T> with a bad StatusCode to Result<T> using the given function.
The function is only applied if the Result has no value. Otherwise the same Result<T> is returned.
| func | Callable with the signature Result<T>(StatusCode) |
Definition at line 274 of file result.hpp.
|
inlineconstexpr |
Transforms Result<T> with a bad StatusCode to Result<T> using the given function.
The function is only applied if the Result has no value. Otherwise the same Result<T> is returned.
| func | Callable with the signature Result<T>(StatusCode) |
Definition at line 268 of file result.hpp.
|
inlineconstexpr |
Transforms Result<T> with a bad StatusCode to Result<T> using the given function.
The function is only applied if the Result has no value. Otherwise the same Result<T> is returned.
| func | Callable with the signature Result<T>(StatusCode) |
Definition at line 280 of file result.hpp.
|
inlineconstexpr |
Transforms Result<T> to Result<U> using the given value transformation function.
The function is only applied if the Result has a value. Otherwise Result<U> with the same bad StatusCode is returned.
| func | Callable with the signature U(T&&) |
Definition at line 204 of file result.hpp.
|
inlineconstexpr |
Transforms Result<T> to Result<U> using the given value transformation function.
The function is only applied if the Result has a value. Otherwise Result<U> with the same bad StatusCode is returned.
| func | Callable with the signature U(T&&) |
Definition at line 216 of file result.hpp.
|
inlineconstexpr |
Transforms Result<T> to Result<U> using the given value transformation function.
The function is only applied if the Result has a value. Otherwise Result<U> with the same bad StatusCode is returned.
| func | Callable with the signature U(T&&) |
Definition at line 210 of file result.hpp.
|
inlineconstexpr |
Transforms Result<T> to Result<U> using the given value transformation function.
The function is only applied if the Result has a value. Otherwise Result<U> with the same bad StatusCode is returned.
| func | Callable with the signature U(T&&) |
Definition at line 222 of file result.hpp.
|
inlineconstexpr |
Get the value of the Result.
| BadStatus | If the Result does not have a value (bad StatusCode). |
Definition at line 159 of file result.hpp.
|
inlineconstexpr |
Get the value of the Result.
| BadStatus | If the Result does not have a value (bad StatusCode). |
Definition at line 171 of file result.hpp.
|
inlineconstexpr |
Get the value of the Result.
| BadStatus | If the Result does not have a value (bad StatusCode). |
Definition at line 165 of file result.hpp.
|
inlineconstexpr |
Get the value of the Result.
| BadStatus | If the Result does not have a value (bad StatusCode). |
Definition at line 177 of file result.hpp.
|
inlineconstexpr |
Get the value of the Result or a default value.
The default value is returned in case of an bad StatusCode.
Definition at line 193 of file result.hpp.
|
inlineconstexpr |
Get the value of the Result or a default value.
The default value is returned in case of an bad StatusCode.
Definition at line 187 of file result.hpp.