capydi
Loading...
Searching...
No Matches
/capydi/core/root/include/capydi/configs/concepts/CreationalConfig.hpp
class MyFactory {
using CentralType = MyService;
using ResolutionKeysPack = meta::Pack<ServiceKey, MyService>;
static constexpr ConfigType CONFIG_TYPE = ConfigType::CREATIONAL;
std::expected<RuntimeRef<MyService>, Error> do_resolve(ServiceKey key) const {
return RuntimeRef(create_service(key));
}
};
See also
ConfigType
ChainableConfig
#ifndef CREATIONAL_CONFIG_HPP_
#define CREATIONAL_CONFIG_HPP_
namespace capy::di
{
template<typename Config>
concept CreationalConfig = requires() {
typename Config::CentralType;
typename Config::ResolutionKeysPack;
Config::CONFIG_TYPE;
}
&& std::same_as<std::remove_cv_t<decltype(Config::CONFIG_TYPE)>, ConfigType>
&& Config::CONFIG_TYPE == ConfigType::CREATIONAL;
template<typename Config>
struct IsCreationalConfig
{
static constexpr bool value = CreationalConfig<Config>;
};
template<CreationalConfig Config>
using central_type_t = typename Config::CentralType;
template<CreationalConfig Config>
using resolution_keys_pack_t = typename Config::ResolutionKeysPack;
template<CreationalConfig Config>
using dependencies_pack_t = typename Config::DependenciesPack;
}
#endif // !CREATIONAL_CONFIG_HPP_
Configuration type enumeration for the dependency injection system.
Compile-time type pack utilities and metaprogramming foundations.
Definition Decorator.hpp:19
typename Config::DependenciesPack dependencies_pack_t
Definition CreationalConfig.hpp:82
typename Config::ResolutionKeysPack resolution_keys_pack_t
Helper alias to extract the resolution keys from a CreationalConfig.
Definition CreationalConfig.hpp:79
ConfigType
Categorization of configuration strategies in the DI container.
Definition ConfigType.hpp:24
@ CREATIONAL
Creational configs handle object instantiation and factory patterns. These are responsible for creati...
Definition ConfigType.hpp:27
typename Config::CentralType central_type_t
Helper alias to extract the central type from a CreationalConfig.
Definition CreationalConfig.hpp:75
static constexpr bool value
Definition CreationalConfig.hpp:70