CVB++ 14.0
browse_filter.hpp
1#pragma once
2
3#include "../global.hpp"
4
5#include "exception.hpp"
6#include "node_id.hpp"
7
8namespace Cvb
9{
10CVB_BEGIN_INLINE_NS;
11template <>
12inline HandleGuard<OpcUa::BrowseFilter>::HandleGuard(void * handle) noexcept
13 : HandleGuard<OpcUa::BrowseFilter>(handle, [](void* handle)
14{
15 CVB_CALL_CAPI(ReleaseObject(handle));
16})
17{
18}
19
20namespace OpcUa
21{
27 : public std::enable_shared_from_this<BrowseFilter>
28{
29public:
30
41 OpcUa::ReferenceDirection direction, OpcUa::ReferenceType referenceType, std::size_t maxReferences,
42 BrowseSubType subTypes, std::uint32_t nodeClassMask)
43 {
44 auto tmp = new CExports::TCVOPCBrowseFilter;
45 tmp->ReferenceDirection = static_cast<CExports::TCVOPCReferenceDirection>(direction);
46 tmp->ReferenceTypeId = static_cast<CExports::TCVOPCReferenceType>(referenceType);
47 tmp->MaxReferences = static_cast<CExports::cvbval_t>(maxReferences);
48 tmp->IncludeSubTypes = static_cast<CExports::TCVOPCBrowseSubType>(subTypes);
49 tmp->NodeClassMask = static_cast<CExports::cvbval_t>(nodeClassMask);
50
51 HandleGuard<BrowseFilter> guard(tmp);
52 if (!guard.Handle())
54
55 BrowseFilterPtr bf(new BrowseFilter(std::move(guard)));
56
57 return bf;
58 }
59
67 {
68 return Create(ReferenceDirection::Forward, referenceTypeID, 10000U, BrowseSubType::SubTypesIncluded, 0U);
69 }
70
77 {
78 return Create(ReferenceDirection::Forward, OpcUa::ReferenceType::Hierarchical, 10000U, BrowseSubType::SubTypesIncluded, 0U);
79 }
80
85 void * Handle() const noexcept
86 {
87 return handle_.Handle();
88 }
89
90 virtual ~BrowseFilter() = default;
91
92protected:
94 explicit BrowseFilter(HandleGuard<BrowseFilter> && guard) noexcept
95 : handle_(std::move(guard))
96 {
97 }
98
99private:
100 explicit BrowseFilter(std::function<HandleGuard<BrowseFilter>()> creator)
101 : BrowseFilter(creator())
102 {
103 }
104 HandleGuard<BrowseFilter> handle_;
106};
107}
108CVB_END_INLINE_NS
109}
The BrowseFilter serves to specify the parameter of a browse operation on an OPCUA node object.
Definition: browse_filter.hpp:28
static BrowseFilterPtr Create(OpcUa::ReferenceType referenceTypeID)
Creates a simpler BrowseFilter for browsing the OPCUA client.
Definition: browse_filter.hpp:66
static BrowseFilterPtr Create(OpcUa::ReferenceDirection direction, OpcUa::ReferenceType referenceType, std::size_t maxReferences, BrowseSubType subTypes, std::uint32_t nodeClassMask)
Creates a BrowseFilter for browsing the OPCUA client.
Definition: browse_filter.hpp:40
void * Handle() const noexcept
Returns C-API style handle to BaseNode Object.
Definition: browse_filter.hpp:85
static BrowseFilterPtr Create()
Creates an even simpler BrowseFilter for browsing the OPCUA client.
Definition: browse_filter.hpp:76
Special runtime exception to carry a native error code.
Definition: exception.hpp:25
const int CVB_ERROR
Generic unspecified error.
Definition: exception.hpp:24
ReferenceType
Used for defining References between Nodes. See OpcUa::Server::AddReference.
Definition: opcua.hpp:222
ReferenceDirection
Describes the direction for a OpcUa::Reference.
Definition: opcua.hpp:116
BrowseSubType
Define whether sub types of nodes should be included as part of a BaseNode::Browse operation.
Definition: opcua.hpp:307
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24