16template <
typename WrapperType>
26 return {std::exchange(native, {})};
30 return {std::exchange(std::move(native), {})};
34template <
typename Response>
37 return asNative(response).responseHeader;
39 return response.responseHeader;
43template <
typename Response>
48template <
typename Response>
57 using ResultType =
Result<
decltype(std::ref(*native->results))>;
59 return ResultType(
BadResult(serviceResult));
61 if (native->results ==
nullptr || native->resultsSize != 1) {
64 return ResultType(std::ref(*native->results));
67template <
typename Response>
73template <
typename WrapperType,
typename Response>
79template <
typename WrapperType,
typename Response>
83 result->statusCode = code;
89 if (
const StatusCode code = result.statusCode; code.isBad()) {
Represents a bad result stored in Result.
The template class Result encapsulates a StatusCode and optionally a value.
constexpr auto transform(F &&func) &
Transforms Result<T> to Result<U> using the given value transformation function.
UA_StatusCode wrapper class.
constexpr bool isBad() const noexcept
Check if the status code is bad.
constexpr NativeType * asNative(WrapperType *wrapper) noexcept
Cast Wrapper object pointers to native object pointers.
Result< NodeId > getAddedNodeId(UA_AddNodesResult &result) noexcept
const UA_ResponseHeader & getResponseHeader(const Response &response) noexcept
WrapperType wrapSingleResultWithStatus(Response &response) noexcept
StatusCode getSingleStatus(const Response &response) noexcept
Result< WrapperType > wrapSingleResult(Response &response) noexcept
StatusCode getServiceResult(const Response &response) noexcept
auto getSingleResultRef(Response &response) noexcept
Client * asWrapper(UA_Client *client) noexcept
Convert native UA_Client pointer to its wrapper instance.
#define UA_STATUSCODE_BADUNEXPECTEDERROR
typename WrapperType::NativeType NativeType
constexpr WrapperType operator()(NativeType &native) noexcept
constexpr WrapperType operator()(const NativeType &native) noexcept
constexpr WrapperType operator()(NativeType &&native) noexcept