![]() |
Lumiera 0.pre.04~rc.1
»edit your freedom«
|
#include "lib/lazy-init.hpp"
Mix-in for lazy/delayed initialisation of an embedded functor.
This allows to keep the overall object (initially) copyable, while later preventing copy once the functor was »engaged«. Initially, only a »trap« is installed into the functor, invoking an initialisation closure on first use.
Definition at line 206 of file lazy-init.hpp.
Classes | |
| struct | MarkDisabled |
Public Member Functions | |
| template<class SIG , class INI , typename... ARGS> | |
| LazyInit (std::function< SIG > &targetFunctor, INI &&initialiser, ARGS &&...parentCtorArgs) | |
| prepare an initialiser to be activated on first use | |
| LazyInit (LazyInit const &ref) | |
| LazyInit (LazyInit &&rref) | |
| LazyInit & | operator= (LazyInit const &ref) |
| LazyInit & | operator= (LazyInit &&rref) |
| bool | isInit () const |
| template<class SIG > | |
| void | installEmptyInitialiser () |
| template<class SIG , class INI > | |
| void | installInitialiser (std::function< SIG > &targetFunctor, INI &&initialiser) |
Protected Member Functions | |
| template<typename... ARGS> | |
| LazyInit (MarkDisabled, ARGS &&...parentCtorArgs) | |
Private Types | |
| template<class SIG > | |
| using | DelegateType = std::function< std::function< SIG > &(RawAddr)> |
| using | PlaceholderType = DelegateType< void(void)> |
| using | HeapStorage = InPlaceBuffer< PlaceholderType > |
| using | PendingInit = std::shared_ptr< HeapStorage > |
Private Member Functions | |
| PendingInit const & | __trapLocked (PendingInit const &init) |
| PendingInit && | __trapLocked (PendingInit &&init) |
| template<class SIG > | |
| DelegateType< SIG > | emptyInitialiser () |
| template<class SIG , class INI > | |
| PendingInit | prepareInitialiser (std::function< SIG > &targetFunctor, INI &&initialiser) |
| template<class SIG , class INI > | |
| DelegateType< SIG > | buildInitialiserDelegate (std::function< SIG > &targetFunctor, INI &&initialiser) |
Static Private Member Functions | |
| template<class SIG > | |
| static DelegateType< SIG > * | getPointerToDelegate (HeapStorage &buffer) |
| template<class SIG > | |
| static std::function< SIG > | maybeInvoke (PendingInit const &pendingInit, RawAddr location) |
Private Attributes | |
| PendingInit | pendingInit_ |
| manage heap storage for a pending initialisation closure | |
|
inlineprotected |
allows derived classes to leave the initialiser deliberately disabled
Definition at line 247 of file lazy-init.hpp.
|
inline |
prepare an initialiser to be activated on first use
Definition at line 256 of file lazy-init.hpp.
References LazyInit< PAR >::installInitialiser().
Here is the call graph for this function:Definition at line 264 of file lazy-init.hpp.
Definition at line 269 of file lazy-init.hpp.
| struct lib::LazyInit::MarkDisabled |
Collaboration diagram for LazyInit< PAR >::MarkDisabled:
|
private |
Definition at line 210 of file lazy-init.hpp.
|
private |
Definition at line 212 of file lazy-init.hpp.
|
private |
Definition at line 213 of file lazy-init.hpp.
|
private |
Definition at line 214 of file lazy-init.hpp.
|
inlineprivate |
Definition at line 221 of file lazy-init.hpp.
Referenced by LazyInit< PAR >::operator=(), and LazyInit< PAR >::operator=().
Here is the caller graph for this function:
|
inlineprivate |
Definition at line 231 of file lazy-init.hpp.
Definition at line 275 of file lazy-init.hpp.
References LazyInit< PAR >::__trapLocked(), util::isSameObject(), and LazyInit< PAR >::pendingInit_.
Here is the call graph for this function:Definition at line 286 of file lazy-init.hpp.
References LazyInit< PAR >::__trapLocked(), util::isSameObject(), and LazyInit< PAR >::pendingInit_.
Here is the call graph for this function:
|
inline |
Definition at line 298 of file lazy-init.hpp.
References LazyInit< PAR >::pendingInit_.
Referenced by LazyInit< PAR >::prepareInitialiser(), and LazyInit_test::verify_complexUsageWithCopy().
Here is the caller graph for this function:
|
inline |
Definition at line 305 of file lazy-init.hpp.
References LazyInit< PAR >::pendingInit_.
|
inline |
Definition at line 312 of file lazy-init.hpp.
References LazyInit< PAR >::pendingInit_, and LazyInit< PAR >::prepareInitialiser().
Referenced by LazyInit_test::LazyDemo::LazyDemo(), LazyInit_test::LazyDemo::LazyDemo(), LazyInit< PAR >::LazyInit(), and LazyInit_test::LazyDemo::attach().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprivate |
Definition at line 321 of file lazy-init.hpp.
|
inlineprivate |
Definition at line 333 of file lazy-init.hpp.
References LazyInit< PAR >::buildInitialiserDelegate(), TrojanFun< SIG >::generateTrap(), and LazyInit< PAR >::isInit().
Referenced by LazyInit< PAR >::installInitialiser().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestaticprivate |
Definition at line 352 of file lazy-init.hpp.
|
inlinestaticprivate |
Definition at line 359 of file lazy-init.hpp.
|
inlineprivate |
Definition at line 369 of file lazy-init.hpp.
References LazyInit< PAR >::pendingInit_.
Referenced by LazyInit< PAR >::prepareInitialiser().
Here is the caller graph for this function:
|
private |
manage heap storage for a pending initialisation closure
Definition at line 217 of file lazy-init.hpp.
Referenced by LazyInit< PAR >::buildInitialiserDelegate(), LazyInit< PAR >::installEmptyInitialiser(), LazyInit< PAR >::installInitialiser(), LazyInit< PAR >::isInit(), LazyInit< PAR >::operator=(), and LazyInit< PAR >::operator=().
Inheritance diagram for LazyInit< PAR >:
Collaboration diagram for LazyInit< PAR >: