CatapultServer  v0.5.0.1 (Elephant)
catapult::utils::WeakContainer< T > Class Template Reference

A container of weak_ptr<T> pointing to closable items. More...

Collaboration diagram for catapult::utils::WeakContainer< T >:

Public Member Functions

 WeakContainer ()
 Creates an empty container. More...
 
 WeakContainer (const consumer< T & > &close)
 Creates an empty container with a custom close function (close). More...
 
size_t size () const
 Gets the number of items in the container and removes all previously deleted items. More...
 
void insert (const std::weak_ptr< T > &pEntry)
 Adds pEntry to this container and removes all previously deleted items. More...
 
void clear ()
 Closes and removes all items in this container. More...
 

Private Member Functions

void pruneInternal ()
 

Private Attributes

consumer< T & > m_close
 
std::list< std::weak_ptr< T > > m_entries
 
utils::SpinLock m_lock
 

Detailed Description

template<typename T>
class catapult::utils::WeakContainer< T >

A container of weak_ptr<T> pointing to closable items.

Constructor & Destructor Documentation

◆ WeakContainer() [1/2]

template<typename T >
catapult::utils::WeakContainer< T >::WeakContainer ( )
inline

Creates an empty container.

◆ WeakContainer() [2/2]

template<typename T >
catapult::utils::WeakContainer< T >::WeakContainer ( const consumer< T & > &  close)
inline

Creates an empty container with a custom close function (close).

Member Function Documentation

◆ clear()

template<typename T >
void catapult::utils::WeakContainer< T >::clear ( )
inline

Closes and removes all items in this container.

◆ insert()

template<typename T >
void catapult::utils::WeakContainer< T >::insert ( const std::weak_ptr< T > &  pEntry)
inline

Adds pEntry to this container and removes all previously deleted items.

Here is the call graph for this function:

◆ pruneInternal()

template<typename T >
void catapult::utils::WeakContainer< T >::pruneInternal ( )
inlineprivate
Here is the caller graph for this function:

◆ size()

template<typename T >
size_t catapult::utils::WeakContainer< T >::size ( ) const
inline

Gets the number of items in the container and removes all previously deleted items.

Member Data Documentation

◆ m_close

template<typename T >
consumer<T&> catapult::utils::WeakContainer< T >::m_close
private

◆ m_entries

template<typename T >
std::list<std::weak_ptr<T> > catapult::utils::WeakContainer< T >::m_entries
private

◆ m_lock

template<typename T >
utils::SpinLock catapult::utils::WeakContainer< T >::m_lock
mutableprivate

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