#pragma once #include #include #include "../../data_stores" #include "util/uix.hpp" #include "util/string_lookup.hpp" #include "util/id_type.hpp" #include "util/result.hpp" template class base_dynamic_loader { public: using loader_id_type = ztu::id_type_for; explicit base_dynamic_loader(C enabled_components); [[nodiscard]] std::optional find_loader(std::string_view name); [[nodiscard]] static consteval std::optional find_loader_static(std::string_view name); template auto& get_loader(); protected: // TODO this seems like I modified this to something that does not make sense template ztu::result invoke_with_matching_loader(loader_id_type loader_id, F&& f); std::tuple m_loaders{}; ztu::string_lookup m_loader_id_lookup{}; C m_enabled_components{ 0 }; }; #define INCLUDE_BASE_DYNAMIC_LOADER_IMPLEMENTATION #include "../../data_loaders" #undef INCLUDE_BASE_DYNAMIC_LOADER_IMPLEMENTATION