open62541pp
0.18.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
include
open62541pp
common.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstdint>
4
#include <string_view>
5
6
#include "
open62541pp/bitmask.hpp
"
7
8
namespace
opcua
{
9
10
/// Namespace index.
11
/// @see https://reference.opcfoundation.org/Core/Part3/v105/docs/8.2.2
12
using
NamespaceIndex
= uint16_t;
13
14
/// Namespace with index and URI.
15
struct
Namespace
{
16
NamespaceIndex
index
;
17
std::string_view
uri
;
18
};
19
20
/// Type index of the ::UA_TYPES array.
21
using
TypeIndex
= uint16_t;
22
23
/**
24
* Attribute identifiers.
25
* @see UA_AttributeId
26
* @see https://reference.opcfoundation.org/Core/Part3/v105/docs/5.9
27
*/
28
enum class
AttributeId
: int32_t {
29
// clang-format off
30
NodeId
= 1,
/**< @include{doc} attributes/nodeid.dox */
31
NodeClass
= 2,
/**< @include{doc} attributes/nodeclass.dox */
32
BrowseName
= 3,
/**< @include{doc} attributes/browsename.dox */
33
DisplayName
= 4,
/**< @include{doc} attributes/displayname.dox */
34
Description
= 5,
/**< @include{doc} attributes/description.dox */
35
WriteMask
= 6,
/**< @include{doc} attributes/writemask.dox */
36
UserWriteMask
= 7,
/**< @include{doc} attributes/userwritemask.dox */
37
IsAbstract
= 8,
/**< @include{doc} attributes/isabstract.dox */
38
Symmetric
= 9,
/**< @include{doc} attributes/symmetric.dox */
39
InverseName
= 10,
/**< @include{doc} attributes/inversename.dox */
40
ContainsNoLoops
= 11,
/**< @include{doc} attributes/containsnoloops.dox */
41
EventNotifier
= 12,
/**< @include{doc} attributes/eventnotifier.dox */
42
Value
= 13,
/**< @include{doc} attributes/value.dox */
43
DataType
= 14,
/**< @include{doc} attributes/datatype.dox */
44
ValueRank
= 15,
/**< @include{doc} attributes/valuerank.dox */
45
ArrayDimensions
= 16,
/**< @include{doc} attributes/arraydimensions.dox */
46
AccessLevel
= 17,
/**< @include{doc} attributes/accesslevel.dox */
47
UserAccessLevel
= 18,
/**< @include{doc} attributes/useraccesslevel.dox */
48
MinimumSamplingInterval
= 19,
/**< @include{doc} attributes/minimumsamplinginterval.dox */
49
Historizing
= 20,
/**< @include{doc} attributes/historizing.dox */
50
Executable
= 21,
/**< @include{doc} attributes/executable.dox */
51
UserExecutable
= 22,
/**< @include{doc} attributes/userexecutable.dox */
52
DataTypeDefinition
= 23,
/**< @include{doc} attributes/datatypedefinition.dox */
53
RolePermissions
= 24,
/**< @include{doc} attributes/rolepermissions.dox */
54
UserRolePermissions
= 25,
/**< @include{doc} attributes/userrolepermissions.dox */
55
AccessRestrictions
= 26,
/**< @include{doc} attributes/accessrestrictions.dox */
56
AccessLevelEx
= 27,
/**< @include{doc} attributes/accesslevelex.dox */
57
// clang-format on
58
};
59
60
/**
61
* Node class.
62
*
63
* The enum can be used as a bitmask and allows bitwise operations, e.g.:
64
* @code
65
* auto mask = NodeClass::Object | NodeClass::Variable;
66
* @endcode
67
*
68
* @see UA_NodeClass
69
* @see https://reference.opcfoundation.org/Core/Part3/v105/docs/8.29
70
*/
71
enum class
NodeClass
: int32_t {
72
// clang-format off
73
Unspecified
= 0,
74
Object
= 1,
75
Variable
= 2,
76
Method
= 4,
77
ObjectType
= 8,
78
VariableType
= 16,
79
ReferenceType
= 32,
80
DataType
= 64,
81
View
= 128,
82
// clang-format on
83
};
84
85
template
<>
86
struct
IsBitmaskEnum
<
NodeClass
> : std::true_type {};
87
88
/**
89
* Access level.
90
* Indicates how the value of an variable can be accessed (read/write) and if it contains current
91
* and/or historic data.
92
* @see https://reference.opcfoundation.org/Core/Part3/v104/docs/8.57
93
*/
94
enum class
AccessLevel
: uint8_t {
95
// clang-format off
96
None
= 0U,
97
CurrentRead
= 1U << 0U,
98
CurrentWrite
= 1U << 1U,
99
HistoryRead
= 1U << 2U,
100
HistoryWrite
= 1U << 3U,
101
SemanticChange
= 1U << 4U,
102
StatusWrite
= 1U << 5U,
103
TimestampWrite
= 1U << 6U,
104
// clang-format on
105
};
106
107
template
<>
108
struct
IsBitmaskEnum
<
AccessLevel
> : std::true_type {};
109
110
/**
111
* Write mask.
112
* Indicates which attributes of a node a writeable.
113
* @see https://reference.opcfoundation.org/Core/Part3/v105/docs/5.2.7
114
* @see https://reference.opcfoundation.org/Core/Part3/v105/docs/8.60
115
*/
116
enum class
WriteMask
: uint32_t {
117
// clang-format off
118
None
= 0U,
119
AccessLevel
= 1U << 0U,
120
ArrayDimensions
= 1U << 1U,
121
BrowseName
= 1U << 2U,
122
ContainsNoLoops
= 1U << 3U,
123
DataType
= 1U << 4U,
124
Description
= 1U << 5U,
125
DisplayName
= 1U << 6U,
126
EventNotifier
= 1U << 7U,
127
Executable
= 1U << 8U,
128
Historizing
= 1U << 9U,
129
InverseName
= 1U << 10U,
130
IsAbstract
= 1U << 11U,
131
MinimumSamplingInterval
= 1U << 12U,
132
NodeClass
= 1U << 13U,
133
NodeId
= 1U << 14U,
134
Symmetric
= 1U << 15U,
135
UserAccessLevel
= 1U << 16U,
136
UserExecutable
= 1U << 17U,
137
UserWriteMask
= 1U << 18U,
138
ValueRank
= 1U << 19U,
139
WriteMask
= 1U << 20U,
140
ValueForVariableType
= 1U << 21U,
141
DataTypeDefinition
= 1U << 22U,
142
RolePermissions
= 1U << 23U,
143
AccessRestrictions
= 1U << 24U,
144
AccessLevelEx
= 1U << 25U,
145
// clang-format on
146
};
147
148
template
<>
149
struct
IsBitmaskEnum
<
WriteMask
> : std::true_type {};
150
151
/**
152
* Value rank.
153
* Indicates whether the value attribute of the variable is an array and how many dimensions the
154
* array has.
155
* @see https://reference.opcfoundation.org/Core/Part3/v105/docs/5.6.2
156
*/
157
enum class
ValueRank
: int32_t {
158
// clang-format off
159
ScalarOrOneDimension
= -3,
// UA_VALUERANK_SCALAR_OR_ONE_DIMENSION
160
Any
= -2,
// UA_VALUERANK_ANY
161
Scalar
= -1,
// UA_VALUERANK_SCALAR
162
OneOrMoreDimensions
= 0,
// UA_VALUERANK_ONE_OR_MORE_DIMENSIONS
163
OneDimension
= 1,
// UA_VALUERANK_ONE_DIMENSION
164
TwoDimensions
= 2,
// UA_VALUERANK_TWO_DIMENSIONS
165
ThreeDimensions
= 3,
// UA_VALUERANK_THREE_DIMENSIONS
166
// clang-format on
167
};
168
169
/**
170
* Event notifier.
171
* Indicates if a node can be used to subscribe to events or read/write historic events.
172
* @see https://reference.opcfoundation.org/Core/Part3/v105/docs/8.59
173
*/
174
enum class
EventNotifier
: uint8_t {
175
// clang-format off
176
None
= 0,
177
SubscribeToEvents
= 1,
178
HistoryRead
= 4,
179
HistoryWrite
= 8,
180
// clang-format on
181
};
182
183
template
<>
184
struct
IsBitmaskEnum
<
EventNotifier
> : std::true_type {};
185
186
/**
187
* Modelling rules.
188
* @see https://reference.opcfoundation.org/Core/Part3/v105/docs/6.4.4
189
*/
190
enum class
ModellingRule
: uint16_t {
191
// clang-format off
192
Mandatory
= 78,
// UA_NS0ID_MODELLINGRULE_MANDATORY
193
Optional
= 80,
// UA_NS0ID_MODELLINGRULE_OPTIONAL
194
ExposesItsArray
= 83,
// UA_NS0ID_MODELLINGRULE_EXPOSESITSARRAY
195
OptionalPlaceholder
= 11508,
// UA_NS0ID_MODELLINGRULE_OPTIONALPLACEHOLDER
196
MandatoryPlaceholder
= 11510,
// UA_NS0ID_MODELLINGRULE_MANDATORYPLACEHOLDER
197
// clang-format on
198
};
199
200
}
// namespace opcua
bitmask.hpp
opcua::DataType
UA_DataType wrapper class.
Definition
datatype.hpp:108
opcua::NodeId
UA_NodeId wrapper class.
Definition
types.hpp:665
opcua
Definition
async.hpp:11
opcua::NamespaceIndex
uint16_t NamespaceIndex
Namespace index.
Definition
common.hpp:12
opcua::NodeClass
NodeClass
Node class.
Definition
common.hpp:71
opcua::NodeClass::View
@ View
opcua::NodeClass::Variable
@ Variable
opcua::NodeClass::Object
@ Object
opcua::NodeClass::Method
@ Method
opcua::NodeClass::VariableType
@ VariableType
opcua::NodeClass::Unspecified
@ Unspecified
opcua::NodeClass::ObjectType
@ ObjectType
opcua::NodeClass::ReferenceType
@ ReferenceType
opcua::AccessLevel
AccessLevel
Access level.
Definition
common.hpp:94
opcua::AccessLevel::SemanticChange
@ SemanticChange
opcua::AccessLevel::None
@ None
opcua::AccessLevel::CurrentRead
@ CurrentRead
opcua::AccessLevel::TimestampWrite
@ TimestampWrite
opcua::AccessLevel::CurrentWrite
@ CurrentWrite
opcua::AccessLevel::HistoryRead
@ HistoryRead
opcua::AccessLevel::HistoryWrite
@ HistoryWrite
opcua::AccessLevel::StatusWrite
@ StatusWrite
opcua::EventNotifier
EventNotifier
Event notifier.
Definition
common.hpp:174
opcua::EventNotifier::SubscribeToEvents
@ SubscribeToEvents
opcua::ValueRank
ValueRank
Value rank.
Definition
common.hpp:157
opcua::ValueRank::OneDimension
@ OneDimension
opcua::ValueRank::ThreeDimensions
@ ThreeDimensions
opcua::ValueRank::TwoDimensions
@ TwoDimensions
opcua::ValueRank::OneOrMoreDimensions
@ OneOrMoreDimensions
opcua::ValueRank::ScalarOrOneDimension
@ ScalarOrOneDimension
opcua::ValueRank::Any
@ Any
opcua::ValueRank::Scalar
@ Scalar
opcua::TypeIndex
uint16_t TypeIndex
Type index of the UA_TYPES array.
Definition
common.hpp:21
opcua::WriteMask
WriteMask
Write mask.
Definition
common.hpp:116
opcua::WriteMask::ValueForVariableType
@ ValueForVariableType
opcua::AttributeId
AttributeId
Attribute identifiers.
Definition
common.hpp:28
opcua::AttributeId::UserExecutable
@ UserExecutable
opcua::AttributeId::Historizing
@ Historizing
opcua::AttributeId::AccessRestrictions
@ AccessRestrictions
opcua::AttributeId::Executable
@ Executable
opcua::AttributeId::DisplayName
@ DisplayName
opcua::AttributeId::BrowseName
@ BrowseName
opcua::AttributeId::Value
@ Value
opcua::AttributeId::AccessLevelEx
@ AccessLevelEx
opcua::AttributeId::MinimumSamplingInterval
@ MinimumSamplingInterval
opcua::AttributeId::UserRolePermissions
@ UserRolePermissions
opcua::AttributeId::IsAbstract
@ IsAbstract
opcua::AttributeId::InverseName
@ InverseName
opcua::AttributeId::Description
@ Description
opcua::AttributeId::UserWriteMask
@ UserWriteMask
opcua::AttributeId::ArrayDimensions
@ ArrayDimensions
opcua::AttributeId::ContainsNoLoops
@ ContainsNoLoops
opcua::AttributeId::RolePermissions
@ RolePermissions
opcua::AttributeId::UserAccessLevel
@ UserAccessLevel
opcua::AttributeId::DataTypeDefinition
@ DataTypeDefinition
opcua::AttributeId::Symmetric
@ Symmetric
opcua::ModellingRule
ModellingRule
Modelling rules.
Definition
common.hpp:190
opcua::ModellingRule::OptionalPlaceholder
@ OptionalPlaceholder
opcua::ModellingRule::ExposesItsArray
@ ExposesItsArray
opcua::ModellingRule::MandatoryPlaceholder
@ MandatoryPlaceholder
opcua::ModellingRule::Mandatory
@ Mandatory
opcua::ModellingRule::Optional
@ Optional
opcua::IsBitmaskEnum
Trait to define an enum (class) as a bitmask and allow bitwise operations.
Definition
bitmask.hpp:44
opcua::Namespace
Namespace with index and URI.
Definition
common.hpp:15
opcua::Namespace::uri
std::string_view uri
Definition
common.hpp:17
opcua::Namespace::index
NamespaceIndex index
Definition
common.hpp:16
Generated by
1.9.8