capydi
Loading...
Searching...
No Matches
Container.hpp File Reference

Core dependency injection container for managing creational and chainable configurations. More...

Include dependency graph for Container.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  capy::di::DI< Configs >
 Primary dependency injection container managing configurations and resolution. More...

Namespaces

namespace  capy
namespace  capy::di

Detailed Description

Core dependency injection container for managing creational and chainable configurations.

The DI container is the heart of the Capydi framework. It orchestrates both creational and chainable configuration dispatchers to resolve dependencies with compile-time safety and runtime efficiency. The container separates dependencies into two categories:

  • Creational configs: Instantiate and manage object creation
  • Chainable configs: Decorate and transform objects through a pipeline (e.g., Decorators)

Architecture

The DI container uses a two-dispatcher pattern:

dot_inline_dotgraph_1.png

Usage Example

// Create a container with both creational and chainable configs
auto di = DI(
CreationalConfig<MyService>{},
Decorator<MyDecorator>{}
);
// Resolve a dependency with optional decoration
auto result = di.resolve<MyKey>();