18template <
typename WrapperType>
28 return {std::exchange(native, {})};
32 return {std::exchange(std::move(native), {})};
36template <
typename Response>
39 return response->responseHeader;
41 return response.responseHeader;
45template <
typename Response>
50template <
typename Response>
55 if (response.results ==
nullptr || response.resultsSize != 1) {
58 return std::ref(*response.results);
69 if (
const StatusCode code = result.statusCode; code.isBad()) {
72 return {std::exchange(result.addedNodeId, {})};
76 if (
const StatusCode code = result.statusCode; code.isBad()) {
80 Span(result.inputArgumentResults, result.inputArgumentResultsSize)) {
86 return std::vector<Variant>{
87 std::make_move_iterator(result.outputArguments),
88 std::make_move_iterator(result.outputArguments + result.outputArgumentsSize)
93template <
typename SubscriptionParameters,
typename Response>
97 parameters.publishingInterval = response.revisedPublishingInterval;
98 parameters.lifetimeCount = response.revisedLifetimeCount;
99 parameters.maxKeepAliveCount = response.revisedMaxKeepAliveCount;
102template <
typename MonitoringParameters,
typename Result>
107 parameters.samplingInterval = result.revisedSamplingInterval;
108 parameters.queueSize = result.revisedQueueSize;
113 if (
const StatusCode code = result.statusCode; code.isBad()) {
116 return result.monitoredItemId;
Represents a bad result stored in Result.
UA_MonitoringParameters wrapper class.
The template class Result encapsulates a StatusCode and optionally a value.
UA_StatusCode wrapper class.
constexpr bool isBad() const noexcept
Check if the status code is bad.
constexpr WrapperType * asWrapper(NativeType *native) noexcept
Cast native object pointers to Wrapper object pointers.
auto tryInvoke(F &&func, Args &&... args) noexcept -> typename ResultType< std::invoke_result_t< F, Args... > >::Type
Invoke a function and capture its Result (value or status code).
constexpr bool isBad(UA_StatusCode code) noexcept
void reviseMonitoringParameters(MonitoringParameters ¶meters, const Result &result) noexcept
void reviseSubscriptionParameters(SubscriptionParameters ¶meters, const Response &response) noexcept
auto getSingleResult(Response &response) noexcept -> Result< decltype(std::ref(*response.results))>
Result< NodeId > getAddedNodeId(UA_AddNodesResult &result) noexcept
Result< uint32_t > getMonitoredItemId(const UA_MonitoredItemCreateResult &result) noexcept
const UA_ResponseHeader & getResponseHeader(const Response &response) noexcept
StatusCode getServiceResult(const Response &response) noexcept
Result< void > toResult(UA_StatusCode code) noexcept
Result< std::vector< Variant > > getOutputArguments(UA_CallMethodResult &result) noexcept
Span(Container &) -> Span< typename Container::value_type >
#define UA_STATUSCODE_BADUNEXPECTEDERROR
Subscription parameters with default values from open62541.
typename WrapperType::NativeType NativeType
constexpr WrapperType operator()(NativeType &native) noexcept
constexpr WrapperType operator()(const NativeType &native) noexcept
constexpr WrapperType operator()(NativeType &&native) noexcept