open62541pp 0.16.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
pluginadapter.hpp
Go to the documentation of this file.
1#pragma once
2
3namespace opcua {
4
5/**
6 * Base class to implement plugin adapters.
7 *
8 * Plugin adapters will provide a different (modern) interface for open62541's native plugins.
9 * For example AccessControlBase is the plugin adapter for UA_AccessControl.
10 *
11 * The native plugin is created via the PluginAdapter::create function.
12 * Usually, the native plugin carries a `void* context` pointer which will refer back to the plugin
13 * adapter. Either move the adapter ownership to the plugin with `ownsAdapter = true` or make sure
14 * that the plugin adapter outlives the native plugin to avoid dangling pointers.
15 *
16 * @tparam T Type of the native plugin, e.g. UA_AccessControl
17 */
18template <typename T>
20public:
21 using PluginType = T;
22
23 PluginAdapter() = default;
24 virtual ~PluginAdapter() = default;
25
26 PluginAdapter(const PluginAdapter&) = default;
27 PluginAdapter(PluginAdapter&&) noexcept = default;
28 PluginAdapter& operator=(const PluginAdapter&) = default;
29 PluginAdapter& operator=(PluginAdapter&&) noexcept = default;
30
31 virtual T create(bool ownsAdapter) = 0;
32};
33
34} // namespace opcua
Base class to implement plugin adapters.
virtual T create(bool ownsAdapter)=0
PluginAdapter(PluginAdapter &&) noexcept=default
virtual ~PluginAdapter()=default
PluginAdapter(const PluginAdapter &)=default