solinject
1.0.0
C++17 Dependency Injection header-only library
|
Go to the documentation of this file.
27 namespace sol::di::impl
33 template<
class TService,
class...TServiceParents>
40 "The TServiceParents types must be derived from the TService type"
74 if (instancePtr !=
nullptr)
76 return std::static_pointer_cast<void>(instancePtr);
80 ServicePtr newInstancePtr = m_Factory(container);
85 return std::static_pointer_cast<void>(newInstancePtr);
Dependency Injection container.
Definition: Container.hpp:48
typename Base::Container Container
DI container.
Definition: ServiceBase.hpp:48
typename Base::ServicePtr ServicePtr
Pointer to an instance of a service.
Definition: SharedService.hpp:50
Shared DI service.
Definition: SharedService.hpp:34
#define solinject_req_assert(expression)
Required assert, which is disabled only when the assert() macro from assert.h is disabled.
Definition: Defines.hpp:41
typename Base::ServicePtr ServicePtr
Pointer to an instance of a service.
Definition: ServiceBase.hpp:42
Base for the DI service classes.
Definition: ServiceBase.hpp:35
std::weak_ptr< TService > ServiceWeakPtr
std::weak_ptr to a service instance
Definition: SharedService.hpp:56
std::shared_ptr< void > VoidPtr
Pointer to void.
Definition: IService.hpp:38
virtual VoidPtr GetServiceAsVoidPtr(const Container &container) override
Resolves a service.
Definition: SharedService.hpp:70
SharedService(Factory factory)
Constructor.
Definition: SharedService.hpp:65
typename Base::Factory Factory
Factory function that accepts a reference to a DI container and returns a pointer to an instance of a...
Definition: ServiceBase.hpp:45
typename Base::Factory Factory
Factory function that accepts a reference to a DI container and returns a pointer to an instance of a...
Definition: SharedService.hpp:53