container: plugins: root: rewrite example plugin
- Reorganizes to utilize new pluggable framework - Refactors, adds/updates documentation
This commit is contained in:
68
container/plugins/root/example/internal/example.hh
Normal file
68
container/plugins/root/example/internal/example.hh
Normal file
@@ -0,0 +1,68 @@
|
||||
// docker-finance | modern accounting for the power-user
|
||||
//
|
||||
// Copyright (C) 2024-2025 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
|
||||
// the Free Software Foundation either version 3 of the License or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//! \file
|
||||
//! \author Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
//! \note File intended to be loaded into ROOT.cern framework / Cling interpreter
|
||||
//! \since docker-finance 1.1.0
|
||||
|
||||
#ifndef CONTAINER_PLUGINS_ROOT_EXAMPLE_INTERNAL_EXAMPLE_HH_
|
||||
#define CONTAINER_PLUGINS_ROOT_EXAMPLE_INTERNAL_EXAMPLE_HH_
|
||||
|
||||
#include <string>
|
||||
|
||||
// NOTE: `dfi` API headers are included by default
|
||||
|
||||
namespace dfi::plugin::example
|
||||
{
|
||||
//! \brief An example plugin implementation class
|
||||
//!
|
||||
//! \warning When implementing pluggables, prefer member functions with
|
||||
//! definitions within source file(s) over certain lambdas to prevent
|
||||
//! root segfaults. TODO(afiore): investigate.
|
||||
//!
|
||||
//! \note For demonstration purposes only
|
||||
//!
|
||||
//! \ingroup cpp_plugin_impl
|
||||
//! \since docker-finance 1.1.0
|
||||
class Example
|
||||
{
|
||||
public:
|
||||
//! \brief Example plugin function 1
|
||||
//! \details Directly access docker-finance crypto abstractions and
|
||||
//! print a handful of SHA2-256 libsodium-generated hashes of
|
||||
//! Crypto++-generated cryptographically secure random numbers
|
||||
void example1();
|
||||
|
||||
//! \brief Example plugin function 2
|
||||
//! \details Directly access underlying docker-finance shell environment
|
||||
void example2();
|
||||
|
||||
//! \brief Example plugin function 3
|
||||
//! \details Execute docker-finance shell commands
|
||||
void example3();
|
||||
|
||||
protected:
|
||||
std::string make_cmd(const std::string& base, const std::string& arg);
|
||||
void exec_cmd(const std::string& cmd);
|
||||
void print_env(const std::string& env);
|
||||
};
|
||||
} // namespace dfi::plugin::example
|
||||
|
||||
#endif // CONTAINER_PLUGINS_ROOT_EXAMPLE_INTERNAL_EXAMPLE_HH_
|
||||
|
||||
// # vim: sw=2 sts=2 si ai et
|
||||
Reference in New Issue
Block a user