forked from EvergreenCrypto/docker-finance
container: plugins: root: update example plugin
`dfi` API headers must be managed on an as-needed basis.
This commit is contained in:
@@ -20,8 +20,6 @@
|
|||||||
//! \note File intended to be loaded into ROOT.cern framework / Cling interpreter
|
//! \note File intended to be loaded into ROOT.cern framework / Cling interpreter
|
||||||
//! \since docker-finance 1.0.0
|
//! \since docker-finance 1.0.0
|
||||||
|
|
||||||
// NOTE: `dfi` API headers are included by default
|
|
||||||
|
|
||||||
//! \namespace dfi::plugin
|
//! \namespace dfi::plugin
|
||||||
//! \brief docker-finance plugins
|
//! \brief docker-finance plugins
|
||||||
//! \warning All plugins (repo/custom) must exist within this namespace
|
//! \warning All plugins (repo/custom) must exist within this namespace
|
||||||
@@ -47,30 +45,56 @@ namespace example
|
|||||||
//! \param arg String to pass to auto-loader (use-case is plugin-implementation defined)
|
//! \param arg String to pass to auto-loader (use-case is plugin-implementation defined)
|
||||||
void load(const std::string& arg = {})
|
void load(const std::string& arg = {})
|
||||||
{
|
{
|
||||||
|
namespace plugin = ::dfi::plugin;
|
||||||
|
namespace common = ::dfi::common;
|
||||||
|
|
||||||
// Any code can follow here: run example functions, etc.
|
// Any code can follow here: run example functions, etc.
|
||||||
// For this example, get absolute path of this plugin's implementation and load.
|
//
|
||||||
::dfi::plugin::common::PluginPath path("repo/example/internal/example.cc");
|
// For this example:
|
||||||
::dfi::common::load(path.absolute());
|
//
|
||||||
|
// 1. Load needed requirements for this plugin's impl
|
||||||
|
// 2. Get absolute path of plugin's impl and then load
|
||||||
|
//
|
||||||
|
const std::string src{common::get_root_path() + "src/"};
|
||||||
|
common::load(src + "hash.hh");
|
||||||
|
common::load(src + "random.hh");
|
||||||
|
// ...add as needed
|
||||||
|
|
||||||
|
plugin::common::PluginPath path("repo/example/internal/example.cc");
|
||||||
|
common::load(path.absolute());
|
||||||
|
|
||||||
// For this example, expect and pass a line of code to the interpreter after loading
|
// For this example, expect and pass a line of code to the interpreter after loading
|
||||||
// NOTE: the following arg code can utilize any code that was loaded/interpreted in load()
|
// NOTE: the following arg code can utilize any code that was loaded/interpreted in load()
|
||||||
if (!arg.empty())
|
if (!arg.empty())
|
||||||
::dfi::common::line(arg);
|
common::line(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \brief Example auto-unloader
|
//! \brief Example auto-unloader
|
||||||
//! \param arg String to pass to auto-unloader (use-case is plugin-implementation defined)
|
//! \param arg String to pass to auto-unloader (use-case is plugin-implementation defined)
|
||||||
void unload(const std::string& arg = {})
|
void unload(const std::string& arg = {})
|
||||||
{
|
{
|
||||||
|
namespace plugin = ::dfi::plugin;
|
||||||
|
namespace common = ::dfi::common;
|
||||||
|
|
||||||
// For this example, expect and pass a line of code to the interpreter before unloading.
|
// For this example, expect and pass a line of code to the interpreter before unloading.
|
||||||
// NOTE: the following arg code can utilize any code that was previously loaded/interpreted
|
// NOTE: the following arg code can utilize any code that was previously loaded/interpreted
|
||||||
if (!arg.empty())
|
if (!arg.empty())
|
||||||
::dfi::common::line(arg);
|
common::line(arg);
|
||||||
|
|
||||||
// Any code can follow here: run example functions, etc.
|
// Any code can follow here: run example functions, etc.
|
||||||
// For this example, get absolute path of this plugin's implementation and unload.
|
//
|
||||||
::dfi::plugin::common::PluginPath path("repo/example/internal/example.cc");
|
// For this example:
|
||||||
::dfi::common::unload(path.absolute());
|
//
|
||||||
|
// 1. Unload needed requirements for this plugin's impl
|
||||||
|
// 2. Get absolute path of plugin's impl and then unload
|
||||||
|
//
|
||||||
|
const std::string src{common::get_root_path() + "src/"};
|
||||||
|
common::unload(src + "hash.hh");
|
||||||
|
common::unload(src + "random.hh");
|
||||||
|
// ...add as needed
|
||||||
|
|
||||||
|
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.
|
// NOTE: to auto-reload this plugin, load()/unload() here or utilize one of the `dfi::plugin::reload()` functions.
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
//! \note File intended to be loaded into ROOT.cern framework / Cling interpreter
|
//! \note File intended to be loaded into ROOT.cern framework / Cling interpreter
|
||||||
//! \since docker-finance 1.1.0
|
//! \since docker-finance 1.1.0
|
||||||
|
|
||||||
// NOTE: `dfi` API headers are included by default
|
|
||||||
|
|
||||||
#include "./example.hh"
|
#include "./example.hh"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|||||||
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
// NOTE: `dfi` API headers are included by default
|
|
||||||
|
|
||||||
namespace dfi::plugin::example
|
namespace dfi::plugin::example
|
||||||
{
|
{
|
||||||
//! \brief An example plugin implementation class
|
//! \brief An example plugin implementation class
|
||||||
|
|||||||
Reference in New Issue
Block a user