6#include "vipra/logging/logging.hpp"
8#include "vipra/concepts/has_parameters.hpp"
9#include "vipra/random/random.hpp"
10#include "vipra/special_modules/parameters.hpp"
11#include "vipra/util/crtp.hpp"
13namespace VIPRA::Modules {
20template <
typename class_t>
35template <
typename class_t>
54template <
typename class_t>
58 "Module is missing VIPRA_REGISTER_PARAMS");
63 auto params = self().module_params();
65 if constexpr ( ! std::is_same_v<std::tuple<>, std::remove_cvref_t<
decltype(params)>> ) {
68 [&](
auto const& first,
auto const&... restArgs) {
69 auto regis = [&](
auto const& param) {
76 (regis(restArgs), ...);
91template <
typename class_t>
95 "Module is missing VIPRA_REGISTER_PARAMS");
100 auto const& params = self().module_params();
102 if constexpr ( ! std::is_same_v<std::tuple<>, std::remove_cvref_t<
decltype(params)>> ) {
105 [&](
auto const& first,
auto const&... restArgs) {
106 auto configure = [&](
auto const& param) {
107 using param_t = std::remove_cvref_t<
decltype(param.second)>;
109 static_cast<void*
>(¶m.second));
112 param.second = paramIn.
get_param<param_t>(
113 self().module_type(), self().module_name(), param.first, engine);
118 (configure(restArgs), ...);
132template <
typename class_t>
136 auto params = self().base_module_params();
138 if constexpr ( ! std::is_same_v<std::tuple<>, std::remove_cvref_t<
decltype(params)>> ) {
141 [&](
auto const& first,
auto const&... restArgs) {
142 auto regis = [&](
auto const& param) {
143 paramIn.
register_param(self().module_type(),
"Base", param.first);
148 (regis(restArgs), ...);
161template <
typename class_t>
165 auto const& params = self().base_module_params();
167 if constexpr ( ! std::is_same_v<std::tuple<>, std::remove_cvref_t<
decltype(params)>> ) {
170 [&](
auto const& first,
auto const&... restArgs) {
171 auto configure = [&](
auto const& param) {
172 using param_t = std::remove_cvref_t<
decltype(param.second)>;
174 static_cast<void*
>(¶m.second));
177 param.second = paramIn.
get_param<param_t>(self().module_type(),
"Base",
178 param.first, engine);
183 (configure(restArgs), ...);
static VIPRA_INLINE void debug(fmt::format_string< param_ts... > message, param_ts &&... params)
Calls the provided Logger with Level DEBUG.
Definition logging.hpp:85
VIPRA Module Base CRTP Class.
Definition module.hpp:21
void config_base(Parameters ¶mIn, VIPRA::Random::Engine &engine)
Loads in all parameters for the module.
Definition module.hpp:162
void register_base_params(Parameters ¶mIn)
Registers the modules parameters with the parameter reader.
Definition module.hpp:133
VIPRA Module Base CRTP Class.
Definition module.hpp:36
void config(Parameters ¶mIn, VIPRA::Random::Engine &engine)
Loads in all parameters for the module.
Definition module.hpp:92
void register_params(Parameters ¶mIn)
Registers the modules parameters with the parameter reader.
Definition module.hpp:55
auto get_param(Modules::Type module, std::string const &moduleName, std::string const ¶mName, Random::Engine &engine) const -> std::remove_cvref_t< data_t >
Returns the value of the parameter if it exists, otherwise throws an error.
Definition parameters.hpp:87
void register_param(Modules::Type module, std::string const &moduleName, std::string const ¶mName)
Registers a parameter for a module.
Definition parameters.cpp:28
Psuedo Random number engine.
Definition random.hpp:22
Definition has_parameters.hpp:7