diff --git a/container/plugins/root/example/example.cc b/container/plugins/root/example/example.cc index da77750..3fee883 100644 --- a/container/plugins/root/example/example.cc +++ b/container/plugins/root/example/example.cc @@ -20,8 +20,6 @@ //! \note File intended to be loaded into ROOT.cern framework / Cling interpreter //! \since docker-finance 1.0.0 -// NOTE: `dfi` API headers are included by default - //! \namespace dfi::plugin //! \brief docker-finance plugins //! \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) void load(const std::string& arg = {}) { + namespace plugin = ::dfi::plugin; + namespace common = ::dfi::common; + // 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"); - ::dfi::common::load(path.absolute()); + // + // For this example: + // + // 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 // NOTE: the following arg code can utilize any code that was loaded/interpreted in load() if (!arg.empty()) - ::dfi::common::line(arg); + common::line(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 = {}) { + namespace plugin = ::dfi::plugin; + namespace common = ::dfi::common; + // 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 if (!arg.empty()) - ::dfi::common::line(arg); + common::line(arg); // 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"); - ::dfi::common::unload(path.absolute()); + // + // For this example: + // + // 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. diff --git a/container/plugins/root/example/internal/example.cc b/container/plugins/root/example/internal/example.cc index 73f81c6..e810166 100644 --- a/container/plugins/root/example/internal/example.cc +++ b/container/plugins/root/example/internal/example.cc @@ -20,8 +20,6 @@ //! \note File intended to be loaded into ROOT.cern framework / Cling interpreter //! \since docker-finance 1.1.0 -// NOTE: `dfi` API headers are included by default - #include "./example.hh" #include diff --git a/container/plugins/root/example/internal/example.hh b/container/plugins/root/example/internal/example.hh index e11bca6..d93e8d7 100644 --- a/container/plugins/root/example/internal/example.hh +++ b/container/plugins/root/example/internal/example.hh @@ -25,8 +25,6 @@ #include -// NOTE: `dfi` API headers are included by default - namespace dfi::plugin::example { //! \brief An example plugin implementation class