solinject
1.0.0
C++17 Dependency Injection header-only library
|
Singleton DI service. More...
#include <SingletonService.hpp>
Public Types | |
using | Base = ServiceBase< TService > |
Base of the SingletonService class. | |
using | Container = typename Base::Container |
DI container. More... | |
using | ServicePtr = typename Base::ServicePtr |
Pointer to an instance of a service. More... | |
using | Factory = typename Base::Factory |
Factory function that accepts a reference to a DI container and returns a pointer to an instance of a service. More... | |
using | VoidPtr = typename IService::VoidPtr |
Pointer to void. More... | |
![]() | |
using | Base = IServiceTyped< TService > |
Base of the ServiceBase class. | |
using | ServicePtr = typename Base::ServicePtr |
Pointer to an instance of a service. More... | |
using | Factory = typename Base::Factory |
Factory function that accepts a reference to a DI container and returns a pointer to an instance of a service. More... | |
using | Container = typename Base::Container |
DI container. More... | |
![]() | |
using | ServicePtr = typename std::shared_ptr< TService > |
Pointer to an instance of a service. | |
using | Factory = typename std::function< ServicePtr(const Container &)> |
Factory function that accepts a reference to a DI container and returns a pointer to an instance of a service. | |
![]() | |
using | Container = sol::di::Container |
DI container. | |
using | VoidPtr = std::shared_ptr< void > |
Pointer to void. | |
![]() | |
using | Base = IServiceTyped< TServiceParents > |
Base of the ServiceBase class. | |
using | ServicePtr = typename Base::ServicePtr |
Pointer to an instance of a service. More... | |
using | Factory = typename Base::Factory |
Factory function that accepts a reference to a DI container and returns a pointer to an instance of a service. More... | |
using | Container = typename Base::Container |
DI container. More... | |
![]() | |
using | ServicePtr = typename std::shared_ptr< TServiceParents > |
Pointer to an instance of a service. | |
using | Factory = typename std::function< ServicePtr(const Container &)> |
Factory function that accepts a reference to a DI container and returns a pointer to an instance of a service. | |
Public Member Functions | |
SingletonService (ServicePtr service) | |
Constructor. More... | |
SingletonService (Factory factory) | |
Constructor. More... | |
![]() | |
virtual ServicePtr | GetService (const Container &container) |
Resolves the service and checks for circular dependencies. More... | |
![]() | |
virtual ServicePtr | GetService (const Container &container) |
Resolves the service and checks for circular dependencies. More... | |
Protected Member Functions | |
virtual VoidPtr | GetServiceAsVoidPtr (const Container &container) override |
Resolves a service. More... | |
Additional Inherited Members | |
![]() | |
bool | m_IsLocked |
Field that indicates if the DI service is "locked". More... | |
![]() | |
bool | m_IsLocked |
Field that indicates if the DI service is "locked". More... | |
Singleton DI service.
T | service type |
using sol::di::impl::SingletonService< TService, TServiceParents >::Container = typename Base::Container |
DI container.
using sol::di::impl::SingletonService< TService, TServiceParents >::Factory = typename Base::Factory |
Factory function that accepts a reference to a DI container and returns a pointer to an instance of a service.
using sol::di::impl::SingletonService< TService, TServiceParents >::ServicePtr = typename Base::ServicePtr |
Pointer to an instance of a service.
using sol::di::impl::SingletonService< TService, TServiceParents >::VoidPtr = typename IService::VoidPtr |
Pointer to void.
|
inline |
Constructor.
service | pointer to a service instance |
|
inline |
Constructor.
factory | factory function |
|
inlineoverrideprotectedvirtual |
Resolves a service.
container | DI container |
Implements sol::di::impl::IService.