tetengo 1.8.1
A multipurpose library set
Loading...
Searching...
No Matches
tetengo::trie::double_array Class Reference

A double array. More...

#include <double_array.hpp>

+ Inheritance diagram for tetengo::trie::double_array:
+ Collaboration diagram for tetengo::trie::double_array:

Classes

struct  building_observer_set_type
 The building observer set type. More...
 

Public Member Functions

 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.
 
 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.
 
template<typename InputIterator >
 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.
 
 double_array (std::unique_ptr< storage > &&p_storage, std::size_t root_base_check_index)
 Creates a double array.
 
 ~double_array ()
 Destroys the double array.
 
std::optional< std::int32_t > find (const std::string_view &key) const
 Finds the value correspoinding the given key.
 
double_array_iterator begin () const
 Returns a first iterator.
 
double_array_iterator end () const
 Returns a last iterator.
 
std::unique_ptr< double_arraysubtrie (const std::string_view &key_prefix) const
 Returns a subtrie.
 
const storageget_storage () const
 Returns the storage.
 
storageget_storage ()
 Returns the storage.
 

Static Public Member Functions

static const building_observer_set_typenull_building_observer_set ()
 Returns the null building observer set.
 
static std::size_t default_density_factor ()
 Returns the default density factor.
 
static char key_terminator ()
 Returns the key terminator.
 
static std::uint8_t vacant_check_value ()
 Returns the check value for a vacant element.
 

Detailed Description

A double array.

Constructor & Destructor Documentation

◆ double_array() [1/4]

tetengo::trie::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() 
)
explicit

Creates a double array.

Parameters
elementsInitial elements.
building_observer_setA building observer set.
density_factorA density factor. Must be greater than 0.
Exceptions
std::invalid_argumentWhen density_factor is 0.

◆ double_array() [2/4]

tetengo::trie::double_array::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() 
)
explicit

Creates a double array.

Parameters
elementsInitial elements.
building_observer_setA building observer set.
density_factorA density factor. Must be greater than 0.
Exceptions
std::invalid_argumentWhen density_factor is 0.

◆ double_array() [3/4]

template<typename InputIterator >
tetengo::trie::double_array::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() 
)
inline

Creates a double array.

Template Parameters
InputIteratorAn input iterator type.
Parameters
firstAn iterator to the first element.
lastAn iterator to the last element.
building_observer_setA building observer set.
density_factorA density factor. Must be greater than 0.
Exceptions
std::invalid_argumentWhen density_factor is 0.

◆ double_array() [4/4]

tetengo::trie::double_array::double_array ( std::unique_ptr< storage > &&  p_storage,
std::size_t  root_base_check_index 
)

Creates a double array.

Parameters
p_storageA unique pointer to a storage.
root_base_check_indexA root base-check index.

Member Function Documentation

◆ begin()

double_array_iterator tetengo::trie::double_array::begin ( ) const

Returns a first iterator.

Returns
A first double array iterator.

◆ default_density_factor()

static std::size_t tetengo::trie::double_array::default_density_factor ( )
static

Returns the default density factor.

Returns
The default density factor.

◆ end()

double_array_iterator tetengo::trie::double_array::end ( ) const

Returns a last iterator.

Returns
A last double array iterator.

◆ find()

std::optional< std::int32_t > tetengo::trie::double_array::find ( const std::string_view &  key) const

Finds the value correspoinding the given key.

Parameters
keyA key.
Returns
The value. Or std::nullpot when the double array does not have the given key.

◆ get_storage() [1/2]

storage & tetengo::trie::double_array::get_storage ( )

Returns the storage.

Returns
The storage.

◆ get_storage() [2/2]

const storage & tetengo::trie::double_array::get_storage ( ) const

Returns the storage.

Returns
The storage.

◆ key_terminator()

static char tetengo::trie::double_array::key_terminator ( )
static

Returns the key terminator.

Returns
The key terminator.

◆ null_building_observer_set()

static const building_observer_set_type & tetengo::trie::double_array::null_building_observer_set ( )
static

Returns the null building observer set.

Returns
The null bulding observer set.

◆ subtrie()

std::unique_ptr< double_array > tetengo::trie::double_array::subtrie ( const std::string_view &  key_prefix) const

Returns a subtrie.

Parameters
key_prefixA key prefix.
Returns
A unique pointer to a double array of the subtrie. Or nullptr when the double array does not have the given key prefix.

◆ vacant_check_value()

static std::uint8_t tetengo::trie::double_array::vacant_check_value ( )
static

Returns the check value for a vacant element.

Returns
The check value for a vacant element.

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