Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/depend-inject.hpp"
Configuration handle to expose a service implementation through the Depend<SRV>
front-end.
This non-copyable (but movable) handle shall be planted within the context operating the service to be exposed. It will immediately create (in RAII style) and manage a heap-allocated instance of the subclass IMP
and expose a baseclass pointer to this specific instance through Depend<SRV>
. Moreover, the implementation subclass can be accessed through this handle, which acts as smart-ptr. When the handle goes out of scope, the implementation instance is destroyed and the access through Depend<SRV>
is closed and inhibited, to prevent on-demand creation of a baseclass SRV
singleton.
IMP | concrete service implementation subclass to build, manage and expose. |
error::Logic | (LUMIERA_ERROR_LIFECYCLE) when the default factory has already been invoked at the point when calling this (re)configuration function. |
Definition at line 202 of file depend-inject.hpp.
Public Types | |
enum | StartMode { NOT_YET_STARTED } |
Public Member Functions | |
template<typename... ARGS> | |
ServiceInstance (ARGS &&...ctorArgs) | |
ServiceInstance (StartMode) | |
create in deactivated state. More... | |
template<typename... ARGS> | |
IMP & | createInstance (ARGS &&...ctorArgs) |
operator bool () const | |
IMP & | operator* () const |
IMP * | operator-> () const |
void | shutdown () noexcept |
Private Attributes | |
std::unique_ptr< IMP > | instance_ |
Additional Inherited Members | |
Private Member Functions inherited from MoveOnly | |
MoveOnly (MoveOnly &&)=default | |
MoveOnly (MoveOnly const &)=delete | |
MoveOnly & | operator= (MoveOnly &&)=delete |
MoveOnly & | operator= (MoveOnly const &)=delete |
|
inline |
create in deactivated state.
Can be activated later
Definition at line 219 of file depend-inject.hpp.