CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
27 namespace catapult {
namespace utils {
45 const_cast<WeakContainer*>(
this)->pruneInternal();
50 void insert(
const std::weak_ptr<T>& pEntry) {
60 auto pSharedEntry = pEntry.lock();
72 m_entries.remove_if([](
const auto& pExistingEntry) {
return !pExistingEntry.lock(); });
consumer< T & > m_close
Definition: WeakContainer.h:76
size_t size() const
Gets the number of items in the container and removes all previously deleted items.
Definition: WeakContainer.h:43
std::list< std::weak_ptr< T > > m_entries
Definition: WeakContainer.h:77
Definition: SpinLock.h:31
void pruneInternal()
Definition: WeakContainer.h:71
void insert(const std::weak_ptr< T > &pEntry)
Adds pEntry to this container and removes all previously deleted items.
Definition: WeakContainer.h:50
A container of weak_ptr<T> pointing to closable items.
Definition: WeakContainer.h:31
WeakContainer()
Creates an empty container.
Definition: WeakContainer.h:34
void clear()
Closes and removes all items in this container.
Definition: WeakContainer.h:57
utils::SpinLock m_lock
Definition: WeakContainer.h:78
Definition: AddressExtractionExtension.cpp:28
WeakContainer(const consumer< T & > &close)
Creates an empty container with a custom close function (close).
Definition: WeakContainer.h:38
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
std::lock_guard< SpinLock > SpinLockGuard
A spin lock guard.
Definition: SpinLock.h:60