|
open62541pp 0.21.0
C++ wrapper of open62541
|
services namespace as an alternative to the opcua::Node classUA_* types to prevent memory leakshandle() method of the wrapping classesUA_* typesThe latest stable open62541 release is integrated as a submodule. Depending on the value of the CMake flag UAPP_INTERNAL_OPEN62541, the submodule or an external open62541 installation is used. All open62541 releases since v1.0 are supported and tested in a CI pipeline with debug/release builds and as static/dynamic library.
The project is stable and used in production environments. Versioning remains at v0.x.x to preserve flexibility for API refinements based on user feedback. Breaking changes may occur in minor releases following a two-version deprecation path: deprecated features in v0.x.0 will be removed no earlier than v0.(x+2).0. Deprecated APIs are declared with the [[deprecated]] attribute and noted in the changelog.
Explore all examples in the examples/ directory.
Open62541pp provides automatic conversion between C++ types and OPC UA types, making it easy to work with familiar C++ constructs. Type conversion from and to native UA_* types are handled by the opcua::TypeConverter struct. Have a look at the typeconversion example.
Compile-time checks are used where possible:
You can add template specializations to add conversions for arbitrary types:
| Type | Type open62541 | Typedef | Wrapper | Conversions |
|---|---|---|---|---|
| Boolean | UA_Boolean | bool | ||
| SByte | UA_SByte | int8_t | ||
| Byte | UA_Byte | uint8_t | ||
| Int16 | UA_Int16 | int16_t | ||
| UInt16 | UA_UInt16 | uint16_t | ||
| Int32 | UA_Int32 | int32_t | ||
| UInt32 | UA_UInt32 | uint32_t | ||
| Int64 | UA_Int64 | int64_t | ||
| UInt64 | UA_UInt64 | uint64_t | ||
| Float | UA_Float | float | ||
| Double | UA_Double | double | ||
| String | UA_String | opcua::String | std::string, std::string_view, const char*, char[N] | |
| DateTime | UA_DateTime | int64_t | opcua::DateTime | std::chrono::time_point |
| Guid | UA_Guid | opcua::Guid | ||
| ByteString | UA_ByteString | UA_String | opcua::ByteString | |
| XmlElement | UA_XmlElement | UA_String | opcua::XmlElement | |
| NodeId | UA_NodeId | opcua::NodeId | ||
| ExpandedNodeId | UA_ExpandedNodeId | opcua::ExpandedNodeId | ||
| StatusCode | UA_StatusCode | uint32_t | opcua::StatusCode | |
| QualifiedName | UA_QualifiedName | opcua::QualifiedName | ||
| LocalizedText | UA_LocalizedText | opcua::LocalizedText | ||
| ExtensionObject | UA_ExtensionObject | opcua::ExtensionObject | ||
| DataValue | UA_DataValue | opcua::DataValue | ||
| Variant | UA_Variant | opcua::Variant | ||
| DiagnosticInfo | UA_DiagnosticInfo | opcua::DiagnosticInfo |
The library can be built, integrated and installed using CMake.
Please check out the open62541 build options here: https://www.open62541.org/doc/v1.4.14/building.html#build-options
Open62541pp provides additional build options:
UAPP_INTERNAL_OPEN62541: Use internal open62541 library if ON or search for installed open62541 library if OFFUAPP_BUILD_DOCUMENTATION: Build documentationUAPP_BUILD_EXAMPLES: Build examples for examples directoryUAPP_BUILD_TESTS: Build unit testsUAPP_ENABLE_COVERAGE: Enable coverage analysisUAPP_ENABLE_SANITIZER_ADDRESS/LEAK/UNDEFINED/THREAD: Enable sanitizersAdd it to your project as a Git submodule (git submodule add https://github.com/open62541pp/open62541pp.git) and link it with CMake:
If you build and install this package to your system, a open62541ppConfig.cmake file will be generated and installed to your system. The installed library can be found and linked within CMake:
The library is available through the following package managers:
vcpkg: Please refer to the vcpkg documentation how to use it within your project. You can easily use vcpkg to build and install open62541pp:
Contributions and feature requests are very welcome. Please have a look at the contribution guidelines.