15#include <nlohmann/json.hpp>
18#include "SharedLibrary.hpp"
39 friend class Registry;
78 std::string
const & pluginConfig,
79 fs::path
const & basePath,
88 fs::path
const &
pluginPath() const noexcept {
return _path; }
92 nlohmann::json
const &
metadata() const noexcept {
return _metadata; }
96 std::string
name()
const {
return _metadata.value(
"name", std::string()); }
98 std::string
version()
const {
return _metadata.value(
"version", std::string()); }
119 nlohmann::json _metadata;
124 std::vector<std::string> _registeredTransportScheme;
125 std::vector<std::string> _registeredNodeType;
128using PluginPtr = std::unique_ptr<Plugin>;
Convenience macros to explicitly control copy and move semantics.
#define DFX_DISABLE_COPY_AND_MOVE(ClassName)
Disable both copy and move.
Definition CopyMoveControl.hpp:37
C-ABI for the dfx framework plugin system.
DFX_PLUGIN_VISIBLE_ATTR void dfx_deinit_plugin(dfx_env_api_t const *env, size_t env_size)
Cleanup entry point called before the plugin is unloaded.
std::string name() const
Access the human-readable name of the plugin from metadata.
Definition Plugin.hpp:96
static nlohmann::json const pluginMetadataSchema
JSON schema used to validate plugin metadata blobs.
Definition Plugin.hpp:43
static nlohmann::json readMetadataOfPluginAt(fs::path const &path)
Static helper to read metadata from a binary without fully loading it.
void loadAndInitPlugin(dfx_registration_api_t const ®, std::string const &pluginConfig, fs::path const &basePath, SharedLibrary::LoadFlags loadFlags=SharedLibrary::defaultLoadFlags)
Loads the shared library into memory and initializes the plugin.
Plugin(fs::path path)
Constructs a plugin object associated with a specific file path.
Plugin()=default
Default constructor for an uninitialized plugin.
nlohmann::json const & metadata() const noexcept
Access the metadata JSON extracted from the plugin's .dfx_metadata section.
Definition Plugin.hpp:92
std::string version() const
Access the version string of the plugin from metadata.
Definition Plugin.hpp:98
SharedLibraryPtr const & lib() const noexcept
Access the pointer to the underlying shared library wrapper.
Definition Plugin.hpp:90
~Plugin()
Destructor. Calls the plugin's deinit function (dfx_deinit_plugin) if it exists and unloads the share...
fs::path const & pluginPath() const noexcept
Access the filesystem path to the plugin binary.
Definition Plugin.hpp:88
std::vector< std::string > const & registeredTransportScheme() const noexcept
Access the list of transport schemes (e.g., "udp") registered by this plugin.
Definition Plugin.hpp:101
std::vector< std::string > const & registeredNodeType() const noexcept
Access the list of node types (e.g., "camera_input") registered by this plugin.
Definition Plugin.hpp:103
dfx_env_api_t & pluginEnv() noexcept
Access the environment API structure provided to this plugin.
Definition Plugin.hpp:83
dfx_env_api_t const & pluginEnv() const noexcept
Access the environment API structure provided to this plugin.
Definition Plugin.hpp:85
static constexpr LoadFlags defaultLoadFlags
Default flags for plugin loading: immediate resolution and local visibility.
Definition SharedLibrary.hpp:46
Definition MessageApi.hpp:16
std::unique_ptr< SharedLibrary > SharedLibraryPtr
Unique ownership pointer type for SharedLibrary.
Definition SharedLibrary.hpp:102
Host environment services provided to the plugin.
Definition PluginInterface.h:190
Transient registration context used during plugin discovery.
Definition PluginInterface.h:882