container: plugins: root: example: support Pluggable entrypoint

This commit is contained in:
2026-01-08 14:26:09 -08:00
parent 8a277485ba
commit 31054b86ea

View File

@@ -1,6 +1,6 @@
// docker-finance | modern accounting for the power-user
//
// Copyright (C) 2024-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
// Copyright (C) 2024-2026 Aaron Fiore (Founder, Evergreen Crypto LLC)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -41,9 +41,25 @@ namespace dfi::plugin
//! \since docker-finance 1.1.0
namespace example
{
//! \brief Pluggable entrypoint
//! \ingroup cpp_plugin_impl
//! \since docker-finance 1.1.0
class example_cc
{
public:
example_cc() = default;
~example_cc() = default;
example_cc(const example_cc&) = default;
example_cc& operator=(const example_cc&) = default;
example_cc(example_cc&&) = default;
example_cc& operator=(example_cc&&) = default;
public:
//! \brief Example auto-loader
//! \param arg String to pass to auto-loader (use-case is plugin-implementation defined)
void load(const std::string& arg = {})
static void load(const std::string& arg = {})
{
namespace plugin = ::dfi::plugin;
namespace common = ::dfi::common;
@@ -71,7 +87,7 @@ void load(const std::string& arg = {})
//! \brief Example auto-unloader
//! \param arg String to pass to auto-unloader (use-case is plugin-implementation defined)
void unload(const std::string& arg = {})
static void unload(const std::string& arg = {})
{
namespace plugin = ::dfi::plugin;
namespace common = ::dfi::common;
@@ -96,9 +112,8 @@ void unload(const std::string& arg = {})
plugin::common::PluginPath path("repo/example/internal/example.cc");
common::unload(path.absolute());
}
// NOTE: to auto-reload this plugin, load()/unload() here or utilize one of the `dfi::plugin::reload()` functions.
};
} // namespace example
} // namespace dfi::plugin