capydi
Loading...
Searching...
No Matches
capy::di Namespace Reference

Namespaces

namespace  implementation_details_

Classes

struct  Decorator
struct  ActionArgMatcher
struct  ActionArgMatcher< Type & >
struct  ActionArgMatcher< DynamicResolver< Type > >
struct  DiAction
class  DynamicResolver
class  OnObjectCreated
struct  IsChainableConfig
 Type trait that checks if a type is a ChainableConfig. More...
struct  IsCreationalConfig
 Type trait that checks if a type is a CreationalConfig. More...
struct  IsConstexprReference
struct  IsConstexprReference< meta::ConstexprRef< T, Ref > >
struct  Constleton
class  Singleton
class  Transient
struct  DecoratableConfig
struct  DecoratableChainableConfig
struct  DependencyTags
struct  Interface
struct  Tag
struct  TagFilter
struct  NoInputStub
class  RequiredFieldUsageObserver
class  RequiredFieldsUsageValidator
class  RequiredField
class  ValidatableInputBase
struct  TagInput
class  ResolutionOverrides
class  DI
 Primary dependency injection container managing configurations and resolution. More...
class  ChainableConfigDispatcher
class  CreationalConfigDispatcher
struct  ResolutionFlags
struct  ResolutionContext

Concepts

concept  MaybeLike
concept  ChainableConfig
 Concept for configuration objects that transform/decorate dependencies.
concept  CreationalConfig
 Concept for configurations that handle dependency creation and instantiation.
concept  DiConfig
 Master concept for all valid DI configurations.
concept  ConstexprReference
concept  Creatable
concept  Resolution

Typedefs

template<typename DiAction_>
using di_action_return_t = typename DiAction_::ReturnType
template<typename DiAction_>
using di_action_args_pack_t = typename DiAction_::ArgsPack
template<ChainableConfig Config>
using get_related_entity_t = typename Config::RelatedEntity
 Helper alias to extract the entity type from a ChainableConfig.
template<ChainableConfig Config>
using get_related_keys_pack_t = typename Config::RelatedKeysPack
 Helper alias to extract the key type from a ChainableConfig.
template<CreationalConfig Config>
using central_type_t = typename Config::CentralType
 Helper alias to extract the central type from a CreationalConfig.
template<CreationalConfig Config>
using resolution_keys_pack_t = typename Config::ResolutionKeysPack
 Helper alias to extract the resolution keys from a CreationalConfig.
template<CreationalConfig Config>
using dependencies_pack_t = typename Config::DependenciesPack
using DependencyTagPair = std::pair<std::size_t, tag_t>
using tag_t = const char*

Enumerations

enum class  DiActionError { DI_ACTION_UNABLE_TO_RESOLVE_ARGS , DI_ACTION_EXECUTION_ERROR }
enum class  ConfigType : unsigned char { CREATIONAL , DECORATIVE , CHAINABLE , SIZE }
 Categorization of configuration strategies in the DI container. More...
enum class  Error {
  CANNOT_BE_RESOLVED , DEPENDENCY_CANNOT_BE_RESOLVED , CONSTLETON_ERROR , UNRECOGNIZED_CONFIG_INPUT ,
  TAG_CONFIG_EXPECTED , TAG_MISMATCH , NOT_ALL_INPUTS_RETRIEVED , OBSERVER_COULD_NOT_RESOLVE_TYPE ,
  OBSERVER_ACTION_EXECUTION_FAILURE , INVALID_DECORATOR_CONFIG , INVALID_DECORATOR_DEPENDENCIES
}
 Enumeration of possible errors during dependency injection resolution. More...

Functions

template<typename DiAction_>
auto execute_di_action (DiAction_ const &di_action, auto &context)
template<template< typename > typename Predicate, typename... Configs>
constexpr auto filter_configs (meta::UnaryMetaFunction< Predicate > &&predicates, Configs &... configs) noexcept

Variables

template<typename T>
constexpr bool is_constexpr_reference_v = IsConstexprReference<std::remove_cvref_t<T>>::value

Typedef Documentation

◆ central_type_t

template<CreationalConfig Config>
using capy::di::central_type_t = typename Config::CentralType

Helper alias to extract the central type from a CreationalConfig.

Examples
/capydi/core/root/include/capydi/configs/concepts/CreationalConfig.hpp.

◆ dependencies_pack_t

template<CreationalConfig Config>
using capy::di::dependencies_pack_t = typename Config::DependenciesPack

◆ DependencyTagPair

using capy::di::DependencyTagPair = std::pair<std::size_t, tag_t>

◆ di_action_args_pack_t

template<typename DiAction_>
using capy::di::di_action_args_pack_t = typename DiAction_::ArgsPack

◆ di_action_return_t

template<typename DiAction_>
using capy::di::di_action_return_t = typename DiAction_::ReturnType

◆ get_related_entity_t

template<ChainableConfig Config>
using capy::di::get_related_entity_t = typename Config::RelatedEntity

Helper alias to extract the entity type from a ChainableConfig.

◆ get_related_keys_pack_t

template<ChainableConfig Config>
using capy::di::get_related_keys_pack_t = typename Config::RelatedKeysPack

Helper alias to extract the key type from a ChainableConfig.

◆ resolution_keys_pack_t

template<CreationalConfig Config>
using capy::di::resolution_keys_pack_t = typename Config::ResolutionKeysPack

Helper alias to extract the resolution keys from a CreationalConfig.

Examples
/capydi/core/root/include/capydi/configs/concepts/CreationalConfig.hpp.

◆ tag_t

using capy::di::tag_t = const char*

Enumeration Type Documentation

◆ ConfigType

enum class capy::di::ConfigType : unsigned char
strong

Categorization of configuration strategies in the DI container.

Each configuration must declare its type to enable the container to route it to the appropriate dispatcher and resolution strategy.

Enumerator
CREATIONAL 

Creational configs handle object instantiation and factory patterns. These are responsible for creating instances of requested types.

DECORATIVE 

Decorative configs wrap or augment created objects. (Alternative/deprecated term for CHAINABLE).

CHAINABLE 

Chainable configs form a pipeline of transformations applied after creation. Examples: proxies, interceptors, validators, caches.

SIZE 

Sentinel value for bounds checking and iteration.

Examples
/capydi/core/root/include/capydi/configs/concepts/CreationalConfig.hpp.

◆ DiActionError

enum class capy::di::DiActionError
strong
Enumerator
DI_ACTION_UNABLE_TO_RESOLVE_ARGS 
DI_ACTION_EXECUTION_ERROR 

◆ Error

enum class capy::di::Error
strong

Enumeration of possible errors during dependency injection resolution.

These errors are returned via std::expected to allow compile-time-aware error handling. Users can inspect the error and decide whether to recover, provide a default, or propagate.

Enumerator
CANNOT_BE_RESOLVED 

A dependency cannot be resolved because no suitable config was found.

DEPENDENCY_CANNOT_BE_RESOLVED 

A dependency required by another dependency cannot be resolved. This indicates a missing transitive dependency in the configuration graph.

CONSTLETON_ERROR 
UNRECOGNIZED_CONFIG_INPUT 
TAG_CONFIG_EXPECTED 
TAG_MISMATCH 
NOT_ALL_INPUTS_RETRIEVED 
OBSERVER_COULD_NOT_RESOLVE_TYPE 
OBSERVER_ACTION_EXECUTION_FAILURE 
INVALID_DECORATOR_CONFIG 
INVALID_DECORATOR_DEPENDENCIES 

Function Documentation

◆ execute_di_action()

template<typename DiAction_>
auto capy::di::execute_di_action ( DiAction_ const & di_action,
auto & context )
inline
Here is the caller graph for this function:

◆ filter_configs()

template<template< typename > typename Predicate, typename... Configs>
auto capy::di::filter_configs ( meta::UnaryMetaFunction< Predicate > && predicates,
Configs &... configs )
nodiscardconstexprnoexcept

Variable Documentation

◆ is_constexpr_reference_v

template<typename T>
bool capy::di::is_constexpr_reference_v = IsConstexprReference<std::remove_cvref_t<T>>::value
constexpr