{"id":13766506,"url":"https://open62541pp.github.io/open62541pp/","last_synced_at":"2025-05-10T22:31:12.288Z","repository":{"id":45444412,"uuid":"207517734","full_name":"open62541pp/open62541pp","owner":"open62541pp","description":"C++ wrapper of the open62541 OPC UA library","archived":false,"fork":false,"pushed_at":"2025-05-05T12:29:32.000Z","size":123982,"stargazers_count":134,"open_issues_count":11,"forks_count":46,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-05T12:35:26.877Z","etag":null,"topics":["cpp","cpp17","opc-ua","opcua","open62541"],"latest_commit_sha":null,"homepage":"https://open62541pp.github.io","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/open62541pp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-09-10T09:27:36.000Z","updated_at":"2025-05-05T12:29:32.000Z","dependencies_parsed_at":"2023-10-31T17:32:07.156Z","dependency_job_id":"42850592-77c3-4aa5-8ce0-feb740058f01","html_url":"https://github.com/open62541pp/open62541pp","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open62541pp%2Fopen62541pp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open62541pp%2Fopen62541pp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open62541pp%2Fopen62541pp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open62541pp%2Fopen62541pp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/open62541pp","download_url":"https://codeload.github.com/open62541pp/open62541pp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253492529,"owners_count":21916959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpp17","opc-ua","opcua","open62541"],"created_at":"2024-08-03T16:00:56.283Z","updated_at":"2025-05-10T22:31:12.271Z","avatar_url":"https://github.com/open62541pp.png","language":"C++","funding_links":[],"categories":["Software"],"sub_categories":["SDKs and Libraries"],"readme":"\u003c!-- links to documentation --\u003e\n[doc-server]: https://open62541pp.github.io/open62541pp/classopcua_1_1Server.html\n[doc-client]: https://open62541pp.github.io/open62541pp/classopcua_1_1Client.html\n[doc-node]: https://open62541pp.github.io/open62541pp/classopcua_1_1Node.html\n[doc-typewrapper]: https://open62541pp.github.io/open62541pp/group__Wrapper.html\n[doc-services]: https://open62541pp.github.io/open62541pp/group__Services.html\n[doc-async-model]: https://open62541pp.github.io/open62541pp/async_model.html\n[ci]: https://github.com/open62541pp/open62541pp/actions/workflows/ci.yml\n[ci-compatibility]: https://github.com/open62541pp/open62541pp/actions/workflows/open62541-compatibility.yml\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eopen62541pp\u003c/h1\u003e\n\n  [![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-blue.svg)](https://github.com/open62541pp/open62541pp/blob/master/LICENSE)\n  [![CI](https://github.com/open62541pp/open62541pp/actions/workflows/ci.yml/badge.svg)][ci]\n  [![Compatibility](https://github.com/open62541pp/open62541pp/actions/workflows/open62541-compatibility.yml/badge.svg)][ci-compatibility]\n  [![Package](https://github.com/open62541pp/open62541pp/actions/workflows/package.yml/badge.svg)](https://github.com/open62541pp/open62541pp/actions/workflows/package.yml)\n  [![Documentation](https://github.com/open62541pp/open62541pp/actions/workflows/doc.yml/badge.svg)](https://github.com/open62541pp/open62541pp/actions/workflows/doc.yml)\n  [![Coverage](https://codecov.io/gh/open62541pp/open62541pp/branch/master/graph/badge.svg?token=P87N1WRXC4)](https://codecov.io/gh/open62541pp/open62541pp)\n\n  \u003ch3\u003eC++ wrapper of the amazing \u003ca href=\"https://open62541.org\"\u003eopen62541\u003c/a\u003e OPC UA library.\u003c/h3\u003e\n\n  \u003cem\u003eOpen source and free implementation licensed under the Mozilla Public License v2.0.\u003c/em\u003e\n\n  \u003cp\u003e\n    \u003cb\u003e\n      📖 \u003ca href=\"https://open62541pp.github.io/open62541pp\"\u003eDocumentation\u003c/a\u003e\n      •\n      📝 \u003ca href=\"https://github.com/open62541pp/open62541pp/tree/master/examples\"\u003eExamples\u003c/a\u003e\n    \u003c/b\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n## 🎯 Features and goals\n\n- High-level and easy to use classes similar to the [Python opcua/asyncua API](https://python-opcua.readthedocs.io):\n  - [`opcua::Server`][doc-server]\n  - [`opcua::Client`][doc-client]\n  - [`opcua::Node`][doc-node]\n- [Free functions in `services` namespace][doc-services] as an alternative to the [`opcua::Node` class][doc-node]\n- [Safe wrapper classes][doc-typewrapper] for open62541 `UA_*` types to prevent memory leaks\n- Native open62541 objects can be accessed using the `handle()` method of the wrapping classes\n- [Extensible type conversion system](#-type-conversion) to convert arbitrary types to/from native `UA_*` types\n- [Asynchronous model][doc-async-model] similar to (Boost) Asio\n- Cross-platform (tested on Windows, Linux and macOS)\n- Compatible with all stable open62541 versions ≥ v1.0\n- [Easy installation and integration with CMake](#-getting-started)\n- Use modern C++ (C++ 17) and best practices\n- Less hurdle to get started with OPC UA\n\nThe 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.\nAll open62541 releases since v1.0 are supported and tested in a [CI pipeline][ci-compatibility] with debug/release builds and as static/dynamic library.\n\nThe project is currently in `beta` stage but already used in production.\nVersion [`v1.0.0` is planned for 2025](https://github.com/open62541pp/open62541pp/milestone/1). No major breaking changes are expected.\n\nWhile in `v0.x.x`, breaking changes may occur in minor releases. This projects follows the *two-version deprecation path*: when a feature is marked as deprecated in `v0.x.0`, it may be removed as early as `v0.(x+2).0`. Deprecated APIs are declared with the `[[deprecated]]` attribute and noted in the changelog.\n\n## 📝 Examples\n\n[Explore all examples in the `examples/` directory](https://github.com/open62541pp/open62541pp/tree/master/examples).\n\n### Server\n\n\u003c!-- [[[cog\nfrom pathlib import Path\nimport cog\ncog.outl(\"```cpp\")\ncog.out(Path(\"examples/server_minimal.cpp\").read_text())\ncog.outl(\"```\")\n]]] --\u003e\n```cpp\n#include \u003copen62541pp/node.hpp\u003e\n#include \u003copen62541pp/server.hpp\u003e\n\nint main() {\n    opcua::Server server;\n\n    // Add a variable node to the Objects node\n    opcua::Node parentNode{server, opcua::ObjectId::ObjectsFolder};\n    opcua::Node myIntegerNode = parentNode.addVariable({1, 1000}, \"TheAnswer\");\n    // Write value attribute\n    myIntegerNode.writeValue(opcua::Variant{42});\n\n    server.run();\n}\n```\n\u003c!-- [[[end]]] --\u003e\n\n### Client\n\n\u003c!-- [[[cog\nfrom pathlib import Path\nimport cog\ncog.outl(\"```cpp\")\ncog.out(Path(\"examples/client_minimal.cpp\").read_text())\ncog.outl(\"```\")\n]]] --\u003e\n```cpp\n#include \u003ciostream\u003e\n\n#include \u003copen62541pp/client.hpp\u003e\n#include \u003copen62541pp/node.hpp\u003e\n\nint main() {\n    opcua::Client client;\n    client.connect(\"opc.tcp://localhost:4840\");\n\n    opcua::Node node{client, opcua::VariableId::Server_ServerStatus_CurrentTime};\n    const auto dt = node.readValue().to\u003copcua::DateTime\u003e();\n\n    std::cout \u003c\u003c \"Server date (UTC): \" \u003c\u003c dt.format(\"%Y-%m-%d %H:%M:%S\") \u003c\u003c std::endl;\n}\n```\n\u003c!-- [[[end]]] --\u003e\n\n## ⇆ Type conversion\n\nType conversion from and to native `UA_*` types are handled by the `opcua::TypeConverter` struct.\nHave a look at the [typeconversion example](https://github.com/open62541pp/open62541pp/blob/master/examples/typeconversion.cpp).\n\nCompile-time checks are used where possible:\n\n```cpp\nopcua::Variant var;\n\n// ✅ will compile\nint number = 5;\nvar.assign(\u0026number);\n\n// ❌ won't compile, because std::string can't be assigned without copy (conversion needed)\nstd::string str{\"test\"};\nvar.assign(\u0026str);\n\n// ✅ will compile\nvar.assign(str);\n```\n\nYou can add template specializations to add conversions for arbitrary types:\n\n```cpp\nnamespace opcua {\n\ntemplate \u003c\u003e\nstruct TypeConverter\u003cstd::byte\u003e {\n    using NativeType = UA_Byte;\n    [[nodiscard]] static std::byte fromNative(const UA_Byte\u0026 src) { /* ... */ }\n    [[nodiscard]] static UA_Byte toNative(const std::byte\u0026 src) { /* ... */ }\n};\n\n}  // namespace opcua\n```\n\n### Type map of built-in types\n\n| Type                     | Type open62541       | Typedef     | Wrapper                           | Conversions                                                 |\n| ------------------------ | -------------------- | ----------- | --------------------------------- | ----------------------------------------------------------- |\n| Boolean                  | `UA_Boolean`         | `bool`      |                                   |                                                             |\n| SByte                    | `UA_SByte`           | `int8_t`    |                                   |                                                             |\n| Byte                     | `UA_Byte`            | `uint8_t`   |                                   |                                                             |\n| Int16                    | `UA_Int16`           | `int16_t`   |                                   |                                                             |\n| UInt16                   | `UA_UInt16`          | `uint16_t`  |                                   |                                                             |\n| Int32                    | `UA_Int32`           | `int32_t`   |                                   |                                                             |\n| UInt32                   | `UA_UInt32`          | `uint32_t`  |                                   |                                                             |\n| Int64                    | `UA_Int64`           | `int64_t`   |                                   |                                                             |\n| UInt64                   | `UA_UInt64`          | `uint64_t`  |                                   |                                                             |\n| Float                    | `UA_Float`           | `float`     |                                   |                                                             |\n| Double                   | `UA_Double`          | `double`    |                                   |                                                             |\n| String                   | `UA_String`          |             | `opcua::String`                   | `std::string`, `std::string_view`, `const char*`, `char[N]` |\n| DateTime                 | `UA_DateTime`        | `int64_t`   | `opcua::DateTime`                 | `std::chrono::time_point`                                   |\n| Guid                     | `UA_Guid`            |             | `opcua::Guid`                     |                                                             |\n| ByteString               | `UA_ByteString`      | `UA_String` | `opcua::ByteString`               |                                                             |\n| XmlElement               | `UA_XmlElement`      | `UA_String` | `opcua::XmlElement`               |                                                             |\n| NodeId                   | `UA_NodeId`          |             | `opcua::NodeId`                   |                                                             |\n| ExpandedNodeId           | `UA_ExpandedNodeId`  |             | `opcua::ExpandedNodeId`           |                                                             |\n| StatusCode               | `UA_StatusCode`      | `uint32_t`  | `opcua::StatusCode`               |                                                             |\n| QualifiedName            | `UA_QualifiedName`   |             | `opcua::QualifiedName`            |                                                             |\n| LocalizedText            | `UA_LocalizedText`   |             | `opcua::LocalizedText`            |                                                             |\n| ExtensionObject          | `UA_ExtensionObject` |             | `opcua::ExtensionObject`          |                                                             |\n| DataValue                | `UA_DataValue`       |             | `opcua::DataValue`                |                                                             |\n| Variant                  | `UA_Variant`         |             | `opcua::Variant`                  |                                                             |\n| DiagnosticInfo           | `UA_DiagnosticInfo`  |             | `opcua::DiagnosticInfo`           |                                                             |\n\n## 🚀 Getting started\n\nThe library can be built, integrated and installed using [CMake](https://cmake.org/runningcmake/).\n\nPlease check out the open62541 build options here: https://www.open62541.org/doc/1.3/building.html#build-options\n\nOpen62541pp provides additional build options:\n\n- `UAPP_INTERNAL_OPEN62541`: Use internal open62541 library if `ON` or search for installed open62541 library if `OFF`\n- `UAPP_ENABLE_NODESETLOADER`: Enable nodeset loader to load `NodeSet2.xml` files at runtime\n- `UAPP_BUILD_DOCUMENTATION`: Build documentation\n- `UAPP_BUILD_EXAMPLES`: Build examples for `examples` directory\n- `UAPP_BUILD_TESTS`: Build unit tests\n- `UAPP_ENABLE_COVERAGE`: Enable coverage analysis\n- `UAPP_ENABLE_CLANG_TIDY`: Enable static code analysis with [Clang-Tidy](https://clang.llvm.org/extra/clang-tidy/)\n- `UAPP_ENABLE_SANITIZER_ADDRESS/LEAK/UNDEFINED/THREAD`: Enable sanitizers\n\n### Integrate as an embedded (in-source) dependency\n\nAdd it to your project as a Git submodule (`git submodule add https://github.com/open62541pp/open62541pp.git`) and link it with CMake:\n\n```cmake\nadd_subdirectory(extern/open62541pp)  # the submodule directory\ntarget_link_libraries(myexecutable PRIVATE open62541pp::open62541pp)\n```\n\n### Integrate as a pre-compiled library\n\nIf you build and install this package to your system, a `open62541ppConfig.cmake` file will be generated and installed to your system.\nThe installed library can be found and linked within CMake:\n\n```cmake\nfind_package(open62541pp CONFIG REQUIRED)\ntarget_link_libraries(myexecutable PRIVATE open62541pp::open62541pp)\n```\n\n### Integrate via package managers\n\nThe library is available through the following package managers:\n\n- [**vcpkg**](https://vcpkg.io): Please refer to the [vcpkg documentation](https://vcpkg.io/en/getting-started) how to use it within your project.\n  You can easily use vcpkg to build and install open62541pp:\n\n  ```shell\n  vcpkg install open62541pp\n  ```\n\n### Build and install\n\n```shell\n# clone repository\ngit clone --recursive https://github.com/open62541pp/open62541pp.git\ncd open62541pp\n\n# build\nmkdir build\ncd build\ncmake -DCMAKE_BUILD_TYPE=Release -DUAPP_BUILD_EXAMPLES=ON -DUAPP_BUILD_TESTS=ON ..\ncmake --build .                   # single-configuration generator like Make or Ninja\ncmake --build . --config Release  # multi-configuration generator like Visual Studio, Xcode\n\n# run tests\nctest --output-on-failure\n\n# install to system\ncmake --install .\n```\n\n### Dependencies\n\n- [open62541](https://github.com/open62541/open62541) as integrated submodule or external dependency\n- [catch2](https://github.com/catchorg/Catch2) for tests\n\n## 🤝 Contribute\n\nContributions and feature requests are very welcome.\nPlease have a look at the [contribution guidelines](https://github.com/open62541pp/open62541pp/blob/master/CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/open62541pp.github.io%2Fopen62541pp%2F","html_url":"https://awesome.ecosyste.ms/projects/open62541pp.github.io%2Fopen62541pp%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/open62541pp.github.io%2Fopen62541pp%2F/lists"}