7#if !defined(TETENGO_TRIE_DOUBLEARRAY_HPP)
8#define TETENGO_TRIE_DOUBLEARRAY_HPP
20#include <boost/core/noncopyable.hpp>
47 std::function<void(
const std::pair<std::string_view, std::int32_t>& element)>
adding;
52 std::function<void()>
done;
104 const std::vector<std::pair<std::string_view, std::int32_t>>& elements,
118 const std::vector<std::pair<std::string, std::int32_t>>& elements,
134 template <
typename InputIterator>
140 double_array{ std::vector<typename InputIterator::value_type>{ first, last },
141 building_observer_set,
151 double_array(std::unique_ptr<storage>&& p_storage, std::size_t root_base_check_index);
168 [[nodiscard]] std::optional<std::int32_t>
find(
const std::string_view& key)
const;
192 [[nodiscard]] std::unique_ptr<double_array>
subtrie(
const std::string_view& key_prefix)
const;
217 const std::unique_ptr<impl> m_p_impl;
A double array iterator.
Definition double_array_iterator.hpp:32
A double array.
Definition double_array.hpp:34
std::optional< std::int32_t > find(const std::string_view &key) const
Finds the value correspoinding the given key.
static char key_terminator()
Returns the key terminator.
static std::uint8_t vacant_check_value()
Returns the check value for a vacant element.
double_array(const std::vector< std::pair< std::string, std::int32_t > > &elements, const building_observer_set_type &building_observer_set=null_building_observer_set(), std::size_t density_factor=default_density_factor())
Creates a double array.
double_array_iterator end() const
Returns a last iterator.
static const building_observer_set_type & null_building_observer_set()
Returns the null building observer set.
const storage & get_storage() const
Returns the storage.
std::unique_ptr< double_array > subtrie(const std::string_view &key_prefix) const
Returns a subtrie.
static std::size_t default_density_factor()
Returns the default density factor.
double_array(std::unique_ptr< storage > &&p_storage, std::size_t root_base_check_index)
Creates a double array.
double_array_iterator begin() const
Returns a first iterator.
double_array(InputIterator first, InputIterator last, const building_observer_set_type &building_observer_set=null_building_observer_set(), std::size_t density_factor=default_density_factor())
Creates a double array.
Definition double_array.hpp:135
~double_array()
Destroys the double array.
storage & get_storage()
Returns the storage.
double_array()
Creates a double array.
double_array(const std::vector< std::pair< std::string_view, std::int32_t > > &elements, const building_observer_set_type &building_observer_set=null_building_observer_set(), std::size_t density_factor=default_density_factor())
Creates a double array.
A storage.
Definition storage.hpp:28
The building observer set type.
Definition double_array.hpp:40
std::function< void(const std::pair< std::string_view, std::int32_t > &element)> adding
Called when a key is adding.
Definition double_array.hpp:47
std::function< void()> done
Called when the building is done.
Definition double_array.hpp:52