MySQL 8.0.40
Source Code Documentation
concurrent_map< Key, Value, Hash > Class Template Reference

Basic Concurrent Map. More...

#include <connection_container.h>

Classes

class  Bucket
 

Public Types

using key_type = Key
 
using mapped_type = Value
 
using hash_type = Hash
 
using value_type = typename std::map< Key, Value >::value_type
 

Public Member Functions

 concurrent_map (unsigned num_buckets=kDefaultNumberOfBucket, const Hash &hasher=Hash())
 
 concurrent_map (const concurrent_map &other)=delete
 
concurrent_mapoperator= (const concurrent_map &other)=delete
 
template<typename Predicate >
void for_one (const Key &key, Predicate &p)
 
template<typename Predicate >
void for_each (Predicate p)
 
void put (const Key &key, Value &&value)
 
void erase (const Key &key)
 
std::size_t size () const
 
bool empty () const
 

Private Member Functions

Bucketget_bucket (const Key &key)
 
const Bucketget_bucket (const Key &key) const
 

Private Attributes

std::vector< Bucketbuckets_
 
Hash hasher_
 

Static Private Attributes

static const unsigned kDefaultNumberOfBucket = 127
 

Detailed Description

template<typename Key, typename Value, typename Hash = std::hash<Key>>
class concurrent_map< Key, Value, Hash >

Basic Concurrent Map.

The concurrent_map is a hash-map, with fixed number of buckets. The number of buckets can be specified in constructor parameter (num_buckets), by default is set to 23.

Member Typedef Documentation

◆ hash_type

template<typename Key , typename Value , typename Hash = std::hash<Key>>
using concurrent_map< Key, Value, Hash >::hash_type = Hash

◆ key_type

template<typename Key , typename Value , typename Hash = std::hash<Key>>
using concurrent_map< Key, Value, Hash >::key_type = Key

◆ mapped_type

template<typename Key , typename Value , typename Hash = std::hash<Key>>
using concurrent_map< Key, Value, Hash >::mapped_type = Value

◆ value_type

template<typename Key , typename Value , typename Hash = std::hash<Key>>
using concurrent_map< Key, Value, Hash >::value_type = typename std::map<Key, Value>::value_type

Constructor & Destructor Documentation

◆ concurrent_map() [1/2]

template<typename Key , typename Value , typename Hash = std::hash<Key>>
concurrent_map< Key, Value, Hash >::concurrent_map ( unsigned  num_buckets = kDefaultNumberOfBucket,
const Hash &  hasher = Hash() 
)
inline

◆ concurrent_map() [2/2]

template<typename Key , typename Value , typename Hash = std::hash<Key>>
concurrent_map< Key, Value, Hash >::concurrent_map ( const concurrent_map< Key, Value, Hash > &  other)
delete

Member Function Documentation

◆ empty()

template<typename Key , typename Value , typename Hash = std::hash<Key>>
bool concurrent_map< Key, Value, Hash >::empty ( ) const
inline

◆ erase()

template<typename Key , typename Value , typename Hash = std::hash<Key>>
void concurrent_map< Key, Value, Hash >::erase ( const Key &  key)
inline

◆ for_each()

template<typename Key , typename Value , typename Hash = std::hash<Key>>
template<typename Predicate >
void concurrent_map< Key, Value, Hash >::for_each ( Predicate  p)
inline

◆ for_one()

template<typename Key , typename Value , typename Hash = std::hash<Key>>
template<typename Predicate >
void concurrent_map< Key, Value, Hash >::for_one ( const Key &  key,
Predicate p 
)
inline

◆ get_bucket() [1/2]

template<typename Key , typename Value , typename Hash = std::hash<Key>>
Bucket & concurrent_map< Key, Value, Hash >::get_bucket ( const Key &  key)
inlineprivate

◆ get_bucket() [2/2]

template<typename Key , typename Value , typename Hash = std::hash<Key>>
const Bucket & concurrent_map< Key, Value, Hash >::get_bucket ( const Key &  key) const
inlineprivate

◆ operator=()

template<typename Key , typename Value , typename Hash = std::hash<Key>>
concurrent_map & concurrent_map< Key, Value, Hash >::operator= ( const concurrent_map< Key, Value, Hash > &  other)
delete

◆ put()

template<typename Key , typename Value , typename Hash = std::hash<Key>>
void concurrent_map< Key, Value, Hash >::put ( const Key &  key,
Value &&  value 
)
inline

◆ size()

template<typename Key , typename Value , typename Hash = std::hash<Key>>
std::size_t concurrent_map< Key, Value, Hash >::size ( ) const
inline

Member Data Documentation

◆ buckets_

template<typename Key , typename Value , typename Hash = std::hash<Key>>
std::vector<Bucket> concurrent_map< Key, Value, Hash >::buckets_
private

◆ hasher_

template<typename Key , typename Value , typename Hash = std::hash<Key>>
Hash concurrent_map< Key, Value, Hash >::hasher_
private

◆ kDefaultNumberOfBucket

template<typename Key , typename Value , typename Hash = std::hash<Key>>
const unsigned concurrent_map< Key, Value, Hash >::kDefaultNumberOfBucket = 127
staticprivate

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