pstore2
Classes | Public Types | Public Member Functions | List of all members
pstore::index::hamt_set< KeyType, Hash, KeyEqual > Class Template Reference
Inheritance diagram for pstore::index::hamt_set< KeyType, Hash, KeyEqual >:
Inheritance graph
[legend]
Collaboration diagram for pstore::index::hamt_set< KeyType, Hash, KeyEqual >:
Collaboration graph
[legend]

Public Types

using key_type = KeyType
 
using value_type = key_type
 
using key_equal = KeyEqual
 
using hasher = Hash
 
using reference = value_type &
 
using const_reference = value_type const &
 
using const_iterator = set_iterator< typename hamt_map< value_type, details::empty_class, hasher, key_equal >::const_iterator >
 
using iterator = const_iterator
 

Public Member Functions

 hamt_set (database const &db, typed_address< header_block > ip=typed_address< header_block >::null(), hasher const &hash=hasher())
 
template<typename OtherKeyType , typename = typename std::enable_if< serialize::is_compatible<KeyType, OtherKeyType>::value>::type>
std::pair< iterator, bool > insert (transaction_base &transaction, OtherKeyType const &key)
 Inserts an element into the container, if the container doesn't already contain an element with an equivalent key. More...
 
template<typename OtherKeyType , typename = typename std::enable_if< serialize::is_compatible<KeyType, OtherKeyType>::value>::type>
const_iterator find (database const &db, OtherKeyType const &key) const
 Find the element with a specific key. More...
 
typed_address< header_blockflush (transaction_base &transaction, unsigned generation)
 Flush any modified index nodes to the store. More...
 
Iterators
range< database, hamt_set, iterator > make_range (database &db)
 
range< database const, hamt_set const, const_iterator > make_range (database const &db) const
 
iterator begin (database &db)
 
const_iterator begin (database const &db) const
 
const_iterator cbegin (database const &db) const
 
iterator end (database &db)
 
const_iterator end (database const &db) const
 
const_iterator cend (database const &db) const
 
Capacity
bool empty () const
 Checks whether the container is empty.
 
std::size_t size () const
 Returns the number of elements in the container.
 
Accessors

Provide access to index internals.

value_type load_leaf_node (database const &db, address const addr) const
 Read a leaf node from a store.
 
index_pointer root () const
 

Member Function Documentation

◆ find()

template<typename KeyType , typename Hash , typename KeyEqual >
template<typename OtherKeyType , typename = typename std::enable_if< serialize::is_compatible<KeyType, OtherKeyType>::value>::type>
const_iterator pstore::index::hamt_set< KeyType, Hash, KeyEqual >::find ( database const &  db,
OtherKeyType const &  key 
) const
inline

Find the element with a specific key.

Finds an element with key equivalent to key.

Template Parameters
OtherKeyTypeA type whose serialized representation is compatible with KeyType.
Parameters
dbA database to which the index belongs.
keyThe key value of the element to search for.
Returns
Iterator an an element with key equivalent to key. If no such element is found, the past-the-end iterator is returned.

◆ flush()

template<typename KeyType , typename Hash , typename KeyEqual >
typed_address<header_block> pstore::index::hamt_set< KeyType, Hash, KeyEqual >::flush ( transaction_base transaction,
unsigned  generation 
)
inline

Flush any modified index nodes to the store.

Parameters
transactionThe transaction to which the set will be written.
generationThe generation number to which the set will be written.
Returns
The address of the index root node.

◆ insert()

template<typename KeyType , typename Hash , typename KeyEqual >
template<typename OtherKeyType , typename = typename std::enable_if< serialize::is_compatible<KeyType, OtherKeyType>::value>::type>
std::pair<iterator, bool> pstore::index::hamt_set< KeyType, Hash, KeyEqual >::insert ( transaction_base transaction,
OtherKeyType const &  key 
)
inline

Inserts an element into the container, if the container doesn't already contain an element with an equivalent key.

Template Parameters
OtherKeyTypeA type whose serialized representation is compatible with KeyType.
Parameters
transactionThe transaction into which the new value element will be inserted.
keyElement value to insert.
Returns
A pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool value set to true if the insertion took place.

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