diff --git a/include/cserver/engine/components.hpp b/include/cserver/engine/components.hpp index 445625e..a4fcdd4 100644 --- a/include/cserver/engine/components.hpp +++ b/include/cserver/engine/components.hpp @@ -12,11 +12,11 @@ struct SeparatedComponent {}; template struct Options : utempl::TypeList {}; -template +template struct ComponentConfig { using Type = T; static constexpr auto kOptions = Options; - static constexpr auto kName = name; + static constexpr auto kName = Name; }; namespace impl { @@ -121,10 +121,43 @@ struct AsyncConditionVariable { bool flag; }; +template +struct ServiceContextForComponent { + T& context; + static constexpr auto kConfig = T::kConfig; + static constexpr auto kUtils = T::kUtils; + + template + constexpr auto FindComponent() -> decltype(this->context.template FindComponent()) { + return this->context.template FindComponent(); + }; + + template + constexpr auto FindComponent() -> decltype(FindComponent()) { + return this->FindComponent(); + }; + template