![]() |
mutable
A Database System for Research and Fast Prototyping
|
The PODPool
implements an implicitly garbage-collected set of pooled (or internalized) POD struct entities.
More...
#include <Pool.hpp>
Public Types | |
using | counter_type = std::conditional_t< ThreadSafe, std::atomic< uint32_t >, uint32_t > |
using | table_type = std::unordered_map< T, counter_type, Hash, KeyEqual > |
using | pooled_type = T |
using | proxy_type = Pooled< T, PODPool, false > |
using | proxy_optional_type = Pooled< T, PODPool, true > |
using | hasher = Hash |
using | key_equal = KeyEqual |
using | copy = Copy |
using | const_iterator = table_type::const_iterator |
Public Member Functions | |
PODPool ()=default | |
PODPool (std::size_t initial_capacity) | |
virtual | ~PODPool () |
std::size_t | size () const |
Returns the number of elements in the pool. | |
const_iterator | begin () |
const_iterator | end () |
const_iterator | cbegin () const |
const_iterator | cend () const |
template<typename U > | |
proxy_type | operator() (U &&u) |
Returns the pooled. | |
Static Public Attributes | |
static constexpr bool | is_thread_safe = ThreadSafe |
Private Member Functions | |
template<bool CanBeNone> | |
bool | erase (const Pooled< T, PODPool, CanBeNone > &pooled) |
Erases the pooled entity from the pool. | |
Static Private Member Functions | |
template<bool CanBeNone> | |
static const T & | Get (const Pooled< T, PODPool, CanBeNone > &pooled) |
Returns a reference to the value referenced by. | |
Private Attributes | |
table_type | table_ |
OptField< ThreadSafe, reader_writer_mutex > | table_mutex_ |
Friends | |
template<typename , typename , bool > | |
struct | Pooled |
The PODPool
implements an implicitly garbage-collected set of pooled (or internalized) POD struct entities.
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::const_iterator = table_type::const_iterator |
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::copy = Copy |
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::counter_type = std::conditional_t<ThreadSafe, std::atomic<uint32_t>, uint32_t> |
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::hasher = Hash |
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::key_equal = KeyEqual |
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::pooled_type = T |
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::table_type = std::unordered_map<T, counter_type, Hash, KeyEqual> |
|
default |
|
inline |
|
inlinevirtual |
Definition at line 49 of file Pool.hpp.
References M_insist, and m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::table_.
|
inline |
Definition at line 59 of file Pool.hpp.
References m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::table_.
|
inline |
Definition at line 61 of file Pool.hpp.
References m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::table_.
|
inline |
Definition at line 62 of file Pool.hpp.
References m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::table_.
|
inline |
Definition at line 60 of file Pool.hpp.
References m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::table_.
|
private |
Erases the pooled entity from the pool.
Requires that the reference count is 0
.
Definition at line 357 of file Pool.hpp.
References M_insist, and m::Pooled< T, Pool, CanBeNone >::ref_.
|
staticprivate |
Returns a reference to the value referenced by.
pooled. |
Definition at line 374 of file Pool.hpp.
References M_insist, m::Pooled< T, Pool, CanBeNone >::ref_, and m::T().
PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::proxy_type m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::operator() | ( | U && | u | ) |
Returns the pooled.
u. |
Definition at line 333 of file Pool.hpp.
References m::reader_writer_lock::lock_read(), and M_insist.
|
inline |
Returns the number of elements in the pool.
Definition at line 57 of file Pool.hpp.
References m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::table_.
|
staticconstexpr |
|
private |
Definition at line 39 of file Pool.hpp.
Referenced by m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::begin(), m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::cbegin(), m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::cend(), m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::end(), m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::size(), and m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::~PODPool().
|
mutableprivate |