Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
DelStash Class Reference

#include "lib/del-stash.hpp"

Description

Manage a collection of deleter functions.

This component can memorise addresses and deleter functions and trigger deletion of single objects, or delete all objects on demand or automatically on shutdown.

Warning
clients must not add a given object more than once

Definition at line 56 of file del-stash.hpp.

Classes

class  Killer
 

Public Member Functions

 DelStash (size_t elms_to_reserve=0)
 
 ~DelStash ()
 
size_t size () const
 
template<typename TY >
void manage (TY *obj)
 
template<typename TY >
void manage (TY &obj)
 
void manage (void *obj, KillFun *customDeleter)
 
template<typename TY >
void kill (TY *obj)
 
template<typename TY >
void kill (TY &obj)
 
void killAll ()
 

Private Types

typedef void KillFun(void *)
 
typedef std::vector< KillerKillers
 

Private Member Functions

bool isRegistered (const void *objAddress)
 
Killers::iterator findEntry (const void *obj)
 
void triggerKill (void *objAddress)
 
- Private Member Functions inherited from NonCopyable
 ~NonCopyable ()=default
 
 NonCopyable ()=default
 
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Static Private Member Functions

template<typename X >
static void how_to_kill (void *subject)
 trampoline function to invoke destructor of the specific target type
 

Private Attributes

Killers killers_
 

Constructor & Destructor Documentation

◆ DelStash()

DelStash ( size_t  elms_to_reserve = 0)
inline

Definition at line 104 of file del-stash.hpp.

References DelStash::killers_.

◆ ~DelStash()

~DelStash ( )
inline

Definition at line 113 of file del-stash.hpp.

References DelStash::killAll().

+ Here is the call graph for this function:

Member Typedef Documentation

◆ KillFun

typedef void KillFun(void *)
private

Definition at line 60 of file del-stash.hpp.

◆ Killers

typedef std::vector<Killer> Killers
private

Definition at line 98 of file del-stash.hpp.

Member Function Documentation

◆ size()

size_t size ( ) const
inline

Definition at line 124 of file del-stash.hpp.

References DelStash::killers_.

Referenced by DelStash_test::checkAutoKill(), DelStash_test::checkCustomKill(), DelStash_test::checkMassKill(), and DelStash_test::checkSingleKill().

+ Here is the caller graph for this function:

◆ manage() [1/3]

template<typename TY >
void manage ( TY *  obj)
inline

Definition at line 138 of file del-stash.hpp.

References DelStash::isRegistered(), and DelStash::killers_.

Referenced by DelStash_test::checkAutoKill(), DelStash_test::checkCustomKill(), DelStash_test::checkSingleKill(), lib::test::anonymous_namespace{del-stash-test.cpp}::feedViktim(), and AdviceSystem::manageAdviceData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ manage() [2/3]

template<typename TY >
void manage ( TY &  obj)
inline

Definition at line 147 of file del-stash.hpp.

References DelStash::isRegistered(), and DelStash::killers_.

+ Here is the call graph for this function:

◆ manage() [3/3]

void manage ( void *  obj,
KillFun customDeleter 
)
inline

Definition at line 154 of file del-stash.hpp.

References DelStash::isRegistered(), and DelStash::killers_.

+ Here is the call graph for this function:

◆ kill() [1/2]

template<typename TY >
void kill ( TY *  obj)
inline

Definition at line 164 of file del-stash.hpp.

References DelStash::triggerKill().

Referenced by DelStash_test::checkAutoKill(), DelStash_test::checkCustomKill(), DelStash_test::checkSingleKill(), and AdviceSystem::discardEntry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kill() [2/2]

template<typename TY >
void kill ( TY &  obj)
inline

Definition at line 172 of file del-stash.hpp.

References DelStash::triggerKill().

+ Here is the call graph for this function:

◆ killAll()

void killAll ( )
inline

Definition at line 178 of file del-stash.hpp.

References DelStash::killers_.

Referenced by DelStash::~DelStash(), and DelStash_test::checkMassKill().

+ Here is the caller graph for this function:

◆ how_to_kill()

template<typename X >
static void how_to_kill ( void *  subject)
inlinestaticprivate

trampoline function to invoke destructor of the specific target type

Definition at line 191 of file del-stash.hpp.

◆ isRegistered()

bool isRegistered ( const void *  objAddress)
inlineprivate

Definition at line 199 of file del-stash.hpp.

References DelStash::findEntry(), and DelStash::killers_.

Referenced by DelStash::manage(), DelStash::manage(), DelStash::manage(), and DelStash::triggerKill().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findEntry()

Killers::iterator findEntry ( const void *  obj)
inlineprivate

Definition at line 206 of file del-stash.hpp.

References std::find(), and DelStash::killers_.

Referenced by DelStash::isRegistered(), and DelStash::triggerKill().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ triggerKill()

void triggerKill ( void *  objAddress)
inlineprivate

Definition at line 213 of file del-stash.hpp.

References DelStash::findEntry(), DelStash::isRegistered(), and DelStash::killers_.

Referenced by DelStash::kill(), and DelStash::kill().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ killers_

+ Inheritance diagram for DelStash:
+ Collaboration diagram for DelStash:

The documentation for this class was generated from the following file: