open62541pp 0.15.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 with a value and a StatusCode (good or uncertain).
Definition at line 69 of file result.hpp.
|
inlineconstexprnoexcept |
Construct a Result with a value and a StatusCode (good or uncertain).
Definition at line 80 of file result.hpp.
|
inlineconstexprnoexcept |
Create a Result with the given error.
Definition at line 91 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 103 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 108 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 116 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 121 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 126 of file result.hpp.
|
inlineconstexprnoexcept |
Get the value of the Result.
Accessing a Result without a value leads to undefined behavior.
Definition at line 131 of file result.hpp.
|
inlineconstexprnoexcept |
Get the StatusCode of the Result.
Definition at line 140 of file result.hpp.
Referenced by opcua::services::browseAll(), and opcua::Result< void >::value().
|
inlineexplicitconstexprnoexcept |
Check if the Result has a value.
Definition at line 147 of file result.hpp.
|
inlineconstexprnoexcept |
Check if the Result has a value.
Definition at line 154 of file result.hpp.
Referenced by opcua::Result< T >::operator bool(), and opcua::Result< void >::operator bool().
|
inlineconstexpr |
Get the value of the Result.
BadStatus | If the Result does not have a value (bad StatusCode). |
Definition at line 162 of file result.hpp.
Referenced by opcua::services::browseAll().
|
inlineconstexpr |
Get the value of the Result.
BadStatus | If the Result does not have a value (bad StatusCode). |
Definition at line 168 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 174 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 180 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 190 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 196 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 207 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 213 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 219 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 225 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 236 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 242 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 248 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 254 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 265 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 271 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 277 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 283 of file result.hpp.