mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
m::detail::_StringPool< ThreadSafe > Struct Template Reference

Explicit specialization of PODPool for strings (const char *). More...

#include <Pool.hpp>

Inheritance diagram for m::detail::_StringPool< ThreadSafe >:
[legend]
Collaboration diagram for m::detail::_StringPool< ThreadSafe >:
[legend]

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

 _StringPool ()=default
 
 _StringPool (std::size_t initial_capacity)
 
 ~_StringPool ()
 
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 Types

using super = PODPool< const char *, StrHash, StrEqual, StrClone, 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 TGet (const Pooled< T, PODPool, CanBeNone > &pooled)
 Returns a reference to the value referenced by.
 

Private Attributes

table_type table_
 
OptField< ThreadSafe, reader_writer_mutextable_mutex_
 

Detailed Description

template<bool ThreadSafe = false>
struct m::detail::_StringPool< ThreadSafe >

Explicit specialization of PODPool for strings (const char *).

Definition at line 446 of file Pool.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::const_iterator = table_type::const_iterator
inherited

Definition at line 44 of file Pool.hpp.

◆ copy

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::copy = Copy
inherited

Definition at line 31 of file Pool.hpp.

◆ counter_type

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::counter_type = std::conditional_t<ThreadSafe, std::atomic<uint32_t>, uint32_t>
inherited

Definition at line 24 of file Pool.hpp.

◆ hasher

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::hasher = Hash
inherited

Definition at line 29 of file Pool.hpp.

◆ key_equal

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::key_equal = KeyEqual
inherited

Definition at line 30 of file Pool.hpp.

◆ pooled_type

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::pooled_type = T
inherited

Definition at line 26 of file Pool.hpp.

◆ proxy_optional_type

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::proxy_optional_type = Pooled<T, PODPool, true>
inherited

Definition at line 28 of file Pool.hpp.

◆ proxy_type

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::proxy_type = Pooled<T, PODPool, false>
inherited

Definition at line 27 of file Pool.hpp.

◆ super

template<bool ThreadSafe = false>
using m::detail::_StringPool< ThreadSafe >::super = PODPool<const char*, StrHash, StrEqual, StrClone, ThreadSafe>
private

Definition at line 449 of file Pool.hpp.

◆ table_type

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
using m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::table_type = std::unordered_map<T, counter_type, Hash, KeyEqual>
inherited

Definition at line 25 of file Pool.hpp.

Constructor & Destructor Documentation

◆ _StringPool() [1/2]

template<bool ThreadSafe = false>
m::detail::_StringPool< ThreadSafe >::_StringPool ( )
default

◆ _StringPool() [2/2]

template<bool ThreadSafe = false>
m::detail::_StringPool< ThreadSafe >::_StringPool ( std::size_t  initial_capacity)
inline

Definition at line 453 of file Pool.hpp.

◆ ~_StringPool()

template<bool ThreadSafe = false>
m::detail::_StringPool< ThreadSafe >::~_StringPool ( )
inline

Definition at line 455 of file Pool.hpp.

Member Function Documentation

◆ begin()

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
const_iterator m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::begin ( )
inlineinherited

◆ cbegin()

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
const_iterator m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::cbegin ( ) const
inlineinherited

◆ cend()

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
const_iterator m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::cend ( ) const
inlineinherited

◆ end()

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
const_iterator m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::end ( )
inlineinherited

◆ erase()

template<typename T , typename Hash , typename KeyEqual , typename Copy , bool ThreadSafe>
template<bool CanBeNone>
bool m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::erase ( const Pooled< T, PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >, CanBeNone > &  pooled)
privateinherited

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_.

◆ Get()

template<typename T , typename Hash , typename KeyEqual , typename Copy , bool ThreadSafe>
template<bool CanBeNone>
const T & m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::Get ( const Pooled< T, PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >, CanBeNone > &  pooled)
staticprivateinherited

Returns a reference to the value referenced by.

Parameters
pooled.

Definition at line 374 of file Pool.hpp.

References M_insist, m::Pooled< T, Pool, CanBeNone >::ref_, and m::T().

◆ operator()()

template<typename T , typename Hash , typename KeyEqual , typename Copy , bool ThreadSafe>
template<typename U >
PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::proxy_type m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::operator() ( U &&  u)
inherited

Returns the pooled.

Parameters
u.

Definition at line 333 of file Pool.hpp.

References m::reader_writer_lock::lock_read(), and M_insist.

◆ size()

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
std::size_t m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::size ( ) const
inlineinherited

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_.

Field Documentation

◆ is_thread_safe

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
constexpr bool m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::is_thread_safe = ThreadSafe
staticconstexprinherited

Definition at line 36 of file Pool.hpp.

◆ table_

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
table_type m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::table_
privateinherited

◆ table_mutex_

template<typename T , typename Hash = std::hash<T>, typename KeyEqual = std::equal_to<T>, typename Copy = std::identity, bool ThreadSafe = false>
OptField<ThreadSafe, reader_writer_mutex> m::PODPool< T, Hash, KeyEqual, Copy, ThreadSafe >::table_mutex_
mutableprivateinherited

Definition at line 41 of file Pool.hpp.


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