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"
80 if (m_ServicePtr ==
nullptr)
82 m_ServicePtr = m_Factory(container);
86 return std::static_pointer_cast<void>(m_ServicePtr);
Dependency Injection container.
Definition: Container.hpp:48
typename Base::Container Container
DI container.
Definition: ServiceBase.hpp:48
#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: SingletonService.hpp:50
Singleton DI service.
Definition: SingletonService.hpp:34
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
typename Base::Factory Factory
Factory function that accepts a reference to a DI container and returns a pointer to an instance of a...
Definition: SingletonService.hpp:53
SingletonService(ServicePtr service)
Constructor.
Definition: SingletonService.hpp:62
std::shared_ptr< void > VoidPtr
Pointer to void.
Definition: IService.hpp:38
typename std::shared_ptr< TService > ServicePtr
Pointer to an instance of a service.
Definition: IServiceTyped.hpp:36
typename std::function< ServicePtr(const Container &)> Factory
Factory function that accepts a reference to a DI container and returns a pointer to an instance of a...
Definition: IServiceTyped.hpp:42
virtual VoidPtr GetServiceAsVoidPtr(const Container &container) override
Resolves a service.
Definition: SingletonService.hpp:78
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
SingletonService(Factory factory)
Constructor.
Definition: SingletonService.hpp:70