forked from EvergreenCrypto/docker-finance
root: macro: utility: namespace refactor into common
This commit is contained in:
@@ -38,10 +38,10 @@ namespace docker_finance
|
|||||||
//! \since docker-finance 1.0.0
|
//! \since docker-finance 1.0.0
|
||||||
namespace macro
|
namespace macro
|
||||||
{
|
{
|
||||||
//! \namespace docker_finance::macro::internal
|
//! \namespace docker_finance::macro::common
|
||||||
//! \brief ROOT macros for internal use only
|
//! \brief Shared ROOT macro-related functionality
|
||||||
//! \since docker-finance 1.0.0
|
//! \since docker-finance 1.0.0
|
||||||
namespace internal
|
namespace common
|
||||||
{
|
{
|
||||||
//! \brief Wrapper to ROOT Cling commands
|
//! \brief Wrapper to ROOT Cling commands
|
||||||
//! \ingroup cpp_macro_impl
|
//! \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
|
//! \brief Get ROOT environment variable
|
||||||
//! \param var ROOT variable
|
//! \param var ROOT variable
|
||||||
//! \note ROOT environment variables include shell (and shell caller) environment
|
//! \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));
|
std::strftime(time.data(), time.size(), "%FT%TZ", std::gmtime(&t));
|
||||||
return std::string{time.data()};
|
return std::string{time.data()};
|
||||||
}
|
}
|
||||||
} // namespace utility
|
} // namespace common
|
||||||
} // namespace internal
|
|
||||||
|
|
||||||
//! \brief Load file by path
|
//! \brief Load file by path
|
||||||
//! \ingroup cpp_macro
|
//! \ingroup cpp_macro
|
||||||
@@ -127,7 +121,7 @@ std::string make_timestamp()
|
|||||||
//! \note Parent directory is `root/macro`
|
//! \note Parent directory is `root/macro`
|
||||||
void load(const std::string& path)
|
void load(const std::string& path)
|
||||||
{
|
{
|
||||||
internal::Command::load(path);
|
common::Command::load(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \brief Wrapper to load files by list of paths
|
//! \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)
|
void load(const std::initializer_list<std::string>& paths)
|
||||||
{
|
{
|
||||||
for (const auto& path : paths)
|
for (const auto& path : paths)
|
||||||
internal::Command::load(path);
|
common::Command::load(path);
|
||||||
}
|
}
|
||||||
} // namespace macro
|
} // namespace macro
|
||||||
} // namespace docker_finance
|
} // namespace docker_finance
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class Unit
|
|||||||
|
|
||||||
if (!loaded)
|
if (!loaded)
|
||||||
{
|
{
|
||||||
internal::Command::load(paths);
|
common::Command::load(paths);
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ class Benchmark
|
|||||||
|
|
||||||
if (!loaded)
|
if (!loaded)
|
||||||
{
|
{
|
||||||
internal::Command::load(paths);
|
common::Command::load(paths);
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -343,8 +343,8 @@ class Random final
|
|||||||
Random::fun_facts(c2, data);
|
Random::fun_facts(c2, data);
|
||||||
});
|
});
|
||||||
|
|
||||||
namespace utility = ::docker_finance::macro::internal::utility;
|
namespace common = ::docker_finance::macro::common;
|
||||||
const std::string timestamp{utility::make_timestamp()};
|
const std::string timestamp{common::make_timestamp()};
|
||||||
|
|
||||||
data.title = "Botan_RNG_" + timestamp;
|
data.title = "Botan_RNG_" + timestamp;
|
||||||
random(
|
random(
|
||||||
|
|||||||
@@ -184,10 +184,10 @@ class Meta final
|
|||||||
//! \param column Existing CSV metadata column
|
//! \param column Existing CSV metadata column
|
||||||
static void meta_sample(const std::string& 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
|
// 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 =
|
auto csv =
|
||||||
std::make_shared<ROOT::RDataFrame>(ROOT::RDF::FromCSV(path.c_str()));
|
std::make_shared<ROOT::RDataFrame>(ROOT::RDF::FromCSV(path.c_str()));
|
||||||
|
|
||||||
@@ -209,9 +209,9 @@ class Meta final
|
|||||||
// Prepare canvas data
|
// Prepare canvas data
|
||||||
Meta::CanvasData data;
|
Meta::CanvasData data;
|
||||||
|
|
||||||
const std::string timestamp{utility::make_timestamp()},
|
const std::string timestamp{common::make_timestamp()},
|
||||||
parent{utility::get_env("global_parent_profile")},
|
parent{common::get_env("global_parent_profile")},
|
||||||
child{utility::get_env("global_child_profile")};
|
child{common::get_env("global_child_profile")};
|
||||||
|
|
||||||
data.column = column;
|
data.column = column;
|
||||||
data.title.first = timestamp + "_meta_" + data.column;
|
data.title.first = timestamp + "_meta_" + data.column;
|
||||||
|
|||||||
@@ -60,15 +60,16 @@ class Server final
|
|||||||
//! \details Registers internal macros
|
//! \details Registers internal macros
|
||||||
static void register_commands()
|
static void register_commands()
|
||||||
{
|
{
|
||||||
|
namespace common = ::docker_finance::macro::common;
|
||||||
namespace internal = ::docker_finance::macro::internal;
|
namespace internal = ::docker_finance::macro::internal;
|
||||||
|
|
||||||
internal::Command::load({"web/internal/crypto.C"});
|
common::Command::load({"web/internal/crypto.C"});
|
||||||
internal::g_HTTPServer->RegisterCommand(
|
internal::g_HTTPServer->RegisterCommand(
|
||||||
"/rng_sample",
|
"/rng_sample",
|
||||||
"::docker_finance::macro::web::internal::Random::rng_sample(\"%arg1%"
|
"::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(
|
internal::g_HTTPServer->RegisterCommand(
|
||||||
"/meta_sample",
|
"/meta_sample",
|
||||||
"::docker_finance::macro::web::internal::Meta::meta_sample(\"%arg1%"
|
"::docker_finance::macro::web::internal::Meta::meta_sample(\"%arg1%"
|
||||||
|
|||||||
Reference in New Issue
Block a user