open62541pp 0.19.0
C++ wrapper of open62541
|
#include <datatype.hpp>
Builder to create DataType definitions of custom types.
The attributes memSize
, padding
, pointerFree
, isArray
and isOptional
are automatically deduced from the types itself.
Definition at line 251 of file datatype.hpp.
Public Member Functions | |
template<auto U::* field> | |
auto & | addField (std::string_view fieldName, const UA_DataType &fieldType) |
template<auto U::* field> | |
auto & | addField (std::string_view fieldName) |
template<typename TMember > | |
auto & | addField (std::string_view fieldName, size_t offset, const UA_DataType &fieldType) |
template<typename TMember > | |
auto & | addField (std::string_view fieldName, size_t offset) |
template<size_t U::* fieldSize, auto U::* fieldArray> | |
auto & | addField (std::string_view fieldName, const UA_DataType &fieldType) |
template<size_t U::* fieldSize, auto U::* fieldArray> | |
auto & | addField (std::string_view fieldName) |
template<typename TArray > | |
auto & | addField (std::string_view fieldName, size_t offsetSize, size_t offsetArray, const UA_DataType &fieldType) |
template<typename TArray > | |
auto & | addField (std::string_view fieldName, size_t offsetSize, size_t offsetArray) |
template<auto U::* memberUnion, typename TField > | |
auto & | addUnionField (std::string_view fieldName, const UA_DataType &fieldType) |
template<auto U::* memberUnion, typename TField > | |
auto & | addUnionField (std::string_view fieldName) |
DataType | build () |
Static Public Member Functions | |
static auto | createEnum (std::string_view typeName, NodeId typeId, NodeId binaryEncodingId) |
static auto | createStructure (std::string_view typeName, NodeId typeId, NodeId binaryEncodingId) |
static auto | createUnion (std::string_view typeName, NodeId typeId, NodeId binaryEncodingId) |
Friends | |
template<typename , typename , typename > | |
class | DataTypeBuilder |
|
inline |
Add a structure field (derive DataType from field
).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 297 of file datatype.hpp.
|
inline |
Add a structure array field (derive DataType from fieldArray
).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 346 of file datatype.hpp.
|
inline |
Add a structure field.
The offset is derived from the member pointer.
field | Member pointer, e.g. &S::value |
fieldName | Human-readable field name |
fieldType | Member data type |
Definition at line 287 of file datatype.hpp.
|
inline |
Add a structure array field.
Arrays must consists of two fields: its size (of type size_t
) and the pointer to the data. No padding allowed between the size field and the array field. The offset is derived from the member pointer.
fieldSize | Member pointer to the size field, e.g. &S::length |
fieldArray | Member pointer to the array field, e.g. &S::data |
fieldName | Human-readable field name |
fieldType | Member data type |
Definition at line 331 of file datatype.hpp.
|
inline |
Add a structure field with a manual offset (derive DataType from TMember
).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 316 of file datatype.hpp.
auto & opcua::DataTypeBuilder< T, Tag, U >::addField | ( | std::string_view | fieldName, |
size_t | offset, | ||
const UA_DataType & | fieldType | ||
) |
Add a structure field with a manual offset.
TMember | Type of the member, e.g. opcua::String |
fieldName | Human-readable field name |
offset | Offset of the member in the structure |
fieldType | Member data type |
Definition at line 470 of file datatype.hpp.
|
inline |
Add a structure array field with a manual offset (derive DataType from TArray
).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 371 of file datatype.hpp.
auto & opcua::DataTypeBuilder< T, Tag, U >::addField | ( | std::string_view | fieldName, |
size_t | offsetSize, | ||
size_t | offsetArray, | ||
const UA_DataType & | fieldType | ||
) |
Add a structure array field with a manual offset.
TArray | Type of the array field, e.g. opcua::String |
fieldName | Human-readable field name |
offsetSize | Offset of the size field in the structure |
offsetArray | Offset of the array field in the structure |
fieldType | Array field data type |
Definition at line 496 of file datatype.hpp.
|
inline |
Add a union field (derive DataType from TField
).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 392 of file datatype.hpp.
auto & opcua::DataTypeBuilder< T, Tag, U >::addUnionField | ( | std::string_view | fieldName, |
const UA_DataType & | fieldType | ||
) |
Add a union field.
memberUnion | Member pointer to the union, e.g. &S::Uni |
TField | Type of the union field |
fieldName | Human-readable field name |
fieldType | Data type of the union field |
Definition at line 529 of file datatype.hpp.
DataType opcua::DataTypeBuilder< T, Tag, U >::build | ( | ) |
Create the actual DataType.
Definition at line 556 of file datatype.hpp.
|
static |
Build a DataType definition for an enum.
typeName | Human-readable type name |
typeId | NodeId of the type |
binaryEncodingId | NodeId of data type when encoded as binary |
Definition at line 421 of file datatype.hpp.
|
static |
Build a DataType definition for a structure.
A structure may have optional fields (pointers).
typeName | Human-readable type name |
typeId | NodeId of the type |
binaryEncodingId | NodeId of data type when encoded as binary |
Definition at line 437 of file datatype.hpp.
|
static |
Build a DataType definition for an union.
Union type consist of a switch field and the actual union.
typeName | Human-readable type name |
typeId | NodeId of the type |
binaryEncodingId | NodeId of data type when encoded as binary |
Definition at line 453 of file datatype.hpp.
|
friend |
Definition at line 403 of file datatype.hpp.