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

An implementation of trie. More...

#include <trie.hpp>

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

Classes

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

Public Member Functions

 trie_impl ()
 Creates an implementation of trie.
 
 trie_impl (std::vector< std::pair< std::string_view, std::any > > elements, const building_observer_set_type &building_observer_set, std::size_t double_array_density_factor)
 Creates a trie.
 
 trie_impl (std::vector< std::pair< std::string, std::any > > elements, const building_observer_set_type &building_observer_set, std::size_t double_array_density_factor)
 Creates a trie.
 
 trie_impl (std::unique_ptr< storage > &&p_storage)
 Creates a trie.
 
 trie_impl (std::unique_ptr< double_array > &&p_double_array)
 Creates a trie.
 
 trie_impl (trie_impl &&another) noexcept
 Moves a trie.
 
 ~trie_impl ()
 Destroys an implementation of trie.
 
bool empty () const
 Returns true when the trie is empty.
 
std::size_t size () const
 Returns the size of the trie.
 
bool contains (const std::string_view &key) const
 Returns true when the trie contains the given key.
 
const std::any * find (const std::string_view &key) const
 Finds the value object correspoinding the given key.
 
trie_iterator_impl begin () const
 Returns the first iterator.
 
trie_iterator_impl end () const
 Returns the last iterator.
 
std::unique_ptr< trie_implsubtrie (const std::string_view &key_prefix) const
 Returns a subtrie.
 
const storageget_storage () const
 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_double_array_density_factor ()
 Returns the default double array density factor.
 

Detailed Description

An implementation of trie.

Constructor & Destructor Documentation

◆ trie_impl() [1/5]

tetengo::trie::trie_impl::trie_impl ( std::vector< std::pair< std::string_view, std::any > >  elements,
const building_observer_set_type building_observer_set,
std::size_t  double_array_density_factor 
)

Creates a trie.

Parameters
elementsInitial elements.
building_observer_setA building observer set.
double_array_density_factorA double array density factor.

◆ trie_impl() [2/5]

tetengo::trie::trie_impl::trie_impl ( std::vector< std::pair< std::string, std::any > >  elements,
const building_observer_set_type building_observer_set,
std::size_t  double_array_density_factor 
)

Creates a trie.

Parameters
elementsInitial elements.
building_observer_setA building observer set.
double_array_density_factorA double array density factor.

◆ trie_impl() [3/5]

tetengo::trie::trie_impl::trie_impl ( std::unique_ptr< storage > &&  p_storage)
explicit

Creates a trie.

Parameters
p_storageA unique pointer to a storage.

◆ trie_impl() [4/5]

tetengo::trie::trie_impl::trie_impl ( std::unique_ptr< double_array > &&  p_double_array)
explicit

Creates a trie.

Parameters
p_double_arrayA unique pointer to a double array.

◆ trie_impl() [5/5]

tetengo::trie::trie_impl::trie_impl ( trie_impl &&  another)
noexcept

Moves a trie.

Parameters
anotherAnother trie.

Member Function Documentation

◆ begin()

trie_iterator_impl tetengo::trie::trie_impl::begin ( ) const

Returns the first iterator.

Returns
The first iterator.

◆ contains()

bool tetengo::trie::trie_impl::contains ( const std::string_view &  key) const

Returns true when the trie contains the given key.

Parameters
keyA key.
Return values
trueWhen the trie contains the given key.
falseOtherwise.

◆ default_double_array_density_factor()

static std::size_t tetengo::trie::trie_impl::default_double_array_density_factor ( )
static

Returns the default double array density factor.

Returns
The default double array density factor.

◆ empty()

bool tetengo::trie::trie_impl::empty ( ) const

Returns true when the trie is empty.

Return values
trueWhen the trie is empty.
falseOtherwise.

◆ end()

trie_iterator_impl tetengo::trie::trie_impl::end ( ) const

Returns the last iterator.

Returns
The last iterator.

◆ find()

const std::any * tetengo::trie::trie_impl::find ( const std::string_view &  key) const

Finds the value object correspoinding the given key.

Parameters
keyA key.
Returns
A pointer to the value object. Or nullptr when the trie does not have the given key.

◆ get_storage()

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

Returns the storage.

Returns
The storage.

◆ null_building_observer_set()

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

Returns the null building observer set.

Returns
The null bulding observer set.

◆ size()

std::size_t tetengo::trie::trie_impl::size ( ) const

Returns the size of the trie.

Returns
The size.

◆ subtrie()

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

Returns a subtrie.

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

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