YAP
|
Template for a cache of weak_ptr's to objects. More...
#include <WeakPtrCache.h>
Public Types | |
helper types | |
using | type = T |
object_type | |
using | shared_ptr_type = std::shared_ptr< T > |
std::shared_ptr to T More... | |
using | weak_ptr_type = std::weak_ptr< T > |
std::weak_ptr to T More... | |
using | cache_type = std::set< weak_ptr_type, std::owner_less< weak_ptr_type > > |
A std::set of weak_ptr_type. More... | |
Public Member Functions | |
virtual bool | equal (const shared_ptr_type &A, const shared_ptr_type &B) const =0 |
override to implement equality checking | |
weak_ptr_type | find (shared_ptr_type t) const |
shared_ptr_type | operator[] (shared_ptr_type t) |
bool | empty () const |
size_t | size () const |
size_t | count_expired () const |
void | removeExpired () |
remove expired Cache_ elements | |
virtual std::ostream & | print (std::ostream &os) const |
stream the cache elements as a table | |
constructors and assignment operators | |
WeakPtrCache ()=default | |
Default constructor (defaulted) | |
WeakPtrCache (const WeakPtrCache &)=default | |
copy constructor (defaulted) | |
WeakPtrCache (WeakPtrCache &&)=default | |
move constructor (defaulted) | |
WeakPtrCache (std::vector< shared_ptr_type > V) | |
Construct cache from vector. | |
virtual | ~WeakPtrCache ()=default |
virtual desctructor (defaulted) | |
WeakPtrCache & | operator= (const WeakPtrCache &)=default |
copy assignment operator (defaulted) | |
WeakPtrCache & | operator= (WeakPtrCache &&)=default |
move assignment operator (defaulted) | |
access to cache | |
cache_type::iterator | begin () |
cache_type::const_iterator | begin () const |
cache_type::iterator | end () |
cache_type::const_iterator | end () const |
Protected Member Functions | |
virtual void | addToCache (shared_ptr_type t) |
add element to cache | |
Private Attributes | |
cache_type | Cache_ |
set of weak pointers to objects | |
Template for a cache of weak_ptr's to objects.
using cache_type = std::set<weak_ptr_type, std::owner_less<weak_ptr_type> > |
A std::set of weak_ptr_type.
cache storage type
using shared_ptr_type = std::shared_ptr<T> |
std::shared_ptr to T
shared_ptr_type
using weak_ptr_type = std::weak_ptr<T> |
std::weak_ptr to T
weak_ptr_type
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
check if cache contains element equating to t
t | shared_ptr to object to search for equivalent of |
|
inline |
t | Shared ptr to object to retrieve from or add to cache |
|
inline |