diff --git a/include/cserver/engine/components.hpp b/include/cserver/engine/components.hpp index 0470451..b89453b 100644 --- a/include/cserver/engine/components.hpp +++ b/include/cserver/engine/components.hpp @@ -134,7 +134,7 @@ inline constexpr auto InitComponents(T& ccontext) -> void { for(auto* flag : dependencies) { co_await flag->AsyncWait(); }; - Get(context.storage).emplace(utempl::Wrapper(T::kNames)>{}, context); + Get(context.storage).emplace(utempl::Wrapper(T::kUtils.kNames)>{}, context); auto& componentInitFlag = GetInitFlagFor(ioContext); componentInitFlag.NotifyAll(); if constexpr(requires{Get(context.storage)->Run();}) { @@ -144,6 +144,49 @@ inline constexpr auto InitComponents(T& ccontext) -> void { }(std::make_index_sequence>()); }; +template +struct DependenciesUtils { + static constexpr utempl::TypeList kTypeList; + static constexpr auto kOptions = utempl::Tuple{Ts::kOptions...}; + static constexpr auto kNames = utempl::Tuple{Ts::kName...}; + static constexpr utempl::TypeList kComponentConfigs; + template + static consteval auto GetIndexByType() -> std::size_t { + return utempl::Find>(kTypeList); + }; + + template + static consteval auto GetIndexByName(const utempl::ConstexprString& name) -> std::size_t { + return utempl::Find(kNames, name); + }; + + template