mdds
Public Types | Static Public Member Functions | List of all members
mdds::trie::std_container_traits< ContainerT > Struct Template Reference

#include <trie_map.hpp>

Public Types

using key_type = ContainerT
 
using key_buffer_type = key_type
 
using key_unit_type = typename key_type::value_type
 

Static Public Member Functions

static key_buffer_type to_key_buffer (const key_unit_type *str, size_t length)
 
static key_buffer_type to_key_buffer (const key_type &key)
 
static const key_unit_typebuffer_data (const key_buffer_type &buf)
 
static size_t buffer_size (const key_buffer_type &buf)
 
static void push_back (key_buffer_type &buffer, key_unit_type c)
 
static void pop_back (key_buffer_type &buffer)
 
static key_type to_key (const key_buffer_type &buf)
 

Detailed Description

template<typename ContainerT>
struct mdds::trie::std_container_traits< ContainerT >

Template for a key type implemented using a typical STL container type.

Member Typedef Documentation

◆ key_buffer_type

template<typename ContainerT >
using mdds::trie::std_container_traits< ContainerT >::key_buffer_type = key_type

type used to build an intermediate key value, from which a final key value is to be created. It is expected to be an array structure whose content is contiguous in memory. Its elements must be of key_unit_type.

◆ key_type

template<typename ContainerT >
using mdds::trie::std_container_traits< ContainerT >::key_type = ContainerT

type used to store a key value.

◆ key_unit_type

template<typename ContainerT >
using mdds::trie::std_container_traits< ContainerT >::key_unit_type = typename key_type::value_type

type that represents a single character inside a key or a key buffer object. A key object is expected to store a series of elements of this type.

Member Function Documentation

◆ pop_back()

template<typename ContainerT >
static void mdds::trie::std_container_traits< ContainerT >::pop_back ( key_buffer_type buffer)
inlinestatic

Function called to remove a single character from the tail of an existing key buffer.

Parameters
bufferbuffer object to remove character from.

◆ push_back()

template<typename ContainerT >
static void mdds::trie::std_container_traits< ContainerT >::push_back ( key_buffer_type buffer,
key_unit_type  c 
)
inlinestatic

Function called to append a single character to the end of a key buffer.

Parameters
bufferbuffer object to append character to.
ccharacter to append to the buffer.

◆ to_key()

template<typename ContainerT >
static key_type mdds::trie::std_container_traits< ContainerT >::to_key ( const key_buffer_type buf)
inlinestatic

Function called to create a final string object from an existing buffer.

Parameters
bufbuffer object to create a final string object from.
Returns
string object whose content is created from the buffer object.

◆ to_key_buffer() [1/2]

template<typename ContainerT >
static key_buffer_type mdds::trie::std_container_traits< ContainerT >::to_key_buffer ( const key_type key)
inlinestatic

Function called to create and initialize a buffer object from a given initial key value.

Parameters
keykey value
Returns
buffer object containing the specified key value.

◆ to_key_buffer() [2/2]

template<typename ContainerT >
static key_buffer_type mdds::trie::std_container_traits< ContainerT >::to_key_buffer ( const key_unit_type str,
size_t  length 
)
inlinestatic

Function called to create and initialize a buffer object from a given initial key value.

Parameters
strpointer to the first character of the key value.
lengthlength of the key value.
Returns
buffer object containing the specified key value.