open62541pp 0.17.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 | |
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 (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 60 of file result.hpp.
|
inlineconstexprnoexcept |
Construct a Result from a value (lvalue) and a StatusCode.
Definition at line 69 of file result.hpp.
|
inlineconstexprnoexcept |
Construct a Result from a value (rvalue) and a StatusCode.
Definition at line 78 of file result.hpp.
|
inlineconstexprnoexcept |
Construct a Result from a BadResult.
Definition at line 87 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 99 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 104 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 112 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 117 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 122 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 127 of file result.hpp.
|
inlineconstexprnoexcept |
Get the StatusCode of the Result.
Definition at line 136 of file result.hpp.
|
inlineexplicitconstexprnoexcept |
Check if the Result has a value.
Definition at line 143 of file result.hpp.
|
inlineconstexprnoexcept |
Check if the Result has a value.
Definition at line 150 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 158 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 164 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 170 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 176 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 186 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 192 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 203 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 209 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 215 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 221 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 232 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 238 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 244 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 250 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 261 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 267 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 273 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 279 of file result.hpp.