root: macro: utility: namespace refactor into common

This commit is contained in:
2024-07-20 22:00:48 -07:00
parent 8eda51c6bc
commit a0091423d1
5 changed files with 18 additions and 23 deletions

View File

@@ -38,10 +38,10 @@ namespace docker_finance
//! \since docker-finance 1.0.0
namespace macro
{
//! \namespace docker_finance::macro::internal
//! \brief ROOT macros for internal use only
//! \namespace docker_finance::macro::common
//! \brief Shared ROOT macro-related functionality
//! \since docker-finance 1.0.0
namespace internal
namespace common
{
//! \brief Wrapper to ROOT Cling commands
//! \ingroup cpp_macro_impl
@@ -84,11 +84,6 @@ class Command final
}
};
//! \namespace docker_finance::macro::internal::utility
//! \brief To help grease the wheels of the machine
//! \since docker-finance 1.0.0
namespace utility
{
//! \brief Get ROOT environment variable
//! \param var ROOT variable
//! \note ROOT environment variables include shell (and shell caller) environment
@@ -112,8 +107,7 @@ std::string make_timestamp()
std::strftime(time.data(), time.size(), "%FT%TZ", std::gmtime(&t));
return std::string{time.data()};
}
} // namespace utility
} // namespace internal
} // namespace common
//! \brief Load file by path
//! \ingroup cpp_macro
@@ -127,7 +121,7 @@ std::string make_timestamp()
//! \note Parent directory is `root/macro`
void load(const std::string& path)
{
internal::Command::load(path);
common::Command::load(path);
}
//! \brief Wrapper to load files by list of paths
@@ -143,7 +137,7 @@ void load(const std::string& path)
void load(const std::initializer_list<std::string>& paths)
{
for (const auto& path : paths)
internal::Command::load(path);
common::Command::load(path);
}
} // namespace macro
} // namespace docker_finance

View File

@@ -70,7 +70,7 @@ class Unit
if (!loaded)
{
internal::Command::load(paths);
common::Command::load(paths);
loaded = true;
}
@@ -107,7 +107,7 @@ class Benchmark
if (!loaded)
{
internal::Command::load(paths);
common::Command::load(paths);
loaded = true;
}

View File

@@ -343,8 +343,8 @@ class Random final
Random::fun_facts(c2, data);
});
namespace utility = ::docker_finance::macro::internal::utility;
const std::string timestamp{utility::make_timestamp()};
namespace common = ::docker_finance::macro::common;
const std::string timestamp{common::make_timestamp()};
data.title = "Botan_RNG_" + timestamp;
random(

View File

@@ -184,10 +184,10 @@ class Meta final
//! \param column Existing CSV metadata column
static void meta_sample(const std::string& column)
{
namespace utility = ::docker_finance::macro::internal::utility;
namespace common = ::docker_finance::macro::common;
// Import meta file
const std::string path{utility::get_env("global_conf_meta")};
const std::string path{common::get_env("global_conf_meta")};
auto csv =
std::make_shared<ROOT::RDataFrame>(ROOT::RDF::FromCSV(path.c_str()));
@@ -209,9 +209,9 @@ class Meta final
// Prepare canvas data
Meta::CanvasData data;
const std::string timestamp{utility::make_timestamp()},
parent{utility::get_env("global_parent_profile")},
child{utility::get_env("global_child_profile")};
const std::string timestamp{common::make_timestamp()},
parent{common::get_env("global_parent_profile")},
child{common::get_env("global_child_profile")};
data.column = column;
data.title.first = timestamp + "_meta_" + data.column;

View File

@@ -60,15 +60,16 @@ class Server final
//! \details Registers internal macros
static void register_commands()
{
namespace common = ::docker_finance::macro::common;
namespace internal = ::docker_finance::macro::internal;
internal::Command::load({"web/internal/crypto.C"});
common::Command::load({"web/internal/crypto.C"});
internal::g_HTTPServer->RegisterCommand(
"/rng_sample",
"::docker_finance::macro::web::internal::Random::rng_sample(\"%arg1%"
"\")");
internal::Command::load({"web/internal/meta.C"});
common::Command::load({"web/internal/meta.C"});
internal::g_HTTPServer->RegisterCommand(
"/meta_sample",
"::docker_finance::macro::web::internal::Meta::meta_sample(\"%arg1%"