#include "lib/depend.hpp"
template<class OBJ>
class lib::DependencyFactory< OBJ >
Helper to abstract creation and lifecycle of a dependency.
Holds a configurable constructor function and optionally an automatically invoked deleter function.
- Note
- DependencyFactory can be declared friend to indicate the expected way to invoke an otherwise private ctor. This is a classical idiom for singletons.
- See also
- lib::Depend
-
lib::DependInject
Definition at line 125 of file depend.hpp.
|
template<typename FUN > |
void | atDestruction (FUN &&additionalAction) |
|
OBJ * | buildTarget () |
|
template<typename FUN > |
void | defineCreator (FUN &&ctor) |
|
template<typename FUN > |
void | defineCreatorAndManage (FUN &&ctor) |
|
void | disable () |
|
void | transferDefinition (DependencyFactory &&source) |
|
|
using | Creator = std::function< OBJ *()> |
|
using | Deleter = std::function< void()> |
|
|
template<class X , typename = decltype(X())> |
static std::true_type | __try_instantiate (int) |
|
template<class > |
static std::false_type | __try_instantiate (...) |
|
template<class TAR > |
static meta::enable_if< canDefaultConstruct< TAR >, TAR *> | buildInstance () |
|
template<class ABS > |
static meta::enable_if< std::is_abstract< ABS >, ABS *> | buildInstance () |
|
template<class ABS > |
static meta::disable_if< std::__or_< std::is_abstract< ABS >, canDefaultConstruct< ABS > >, ABS *> | buildInstance () |
|
|
Creator | creator_ |
|
Deleter | deleter_ |
|
The documentation for this class was generated from the following file: