mdds
Public Types | Static Public Member Functions | List of all members
mdds::trie::std_string_trait Struct Reference

#include <trie_map.hpp>

Public Types

typedef std::string key_type
 
typedef std::string key_buffer_type
 
typedef char key_unit_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

String trait that uses std::string as the key type. This trait can be used with mdds::trie_map or mdds::packed_trie_map.

Member Typedef Documentation

◆ key_buffer_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

type used to store a key value.

◆ key_unit_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()

static void mdds::trie::std_string_trait::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()

static void mdds::trie::std_string_trait::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()

static key_type mdds::trie::std_string_trait::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]

static key_buffer_type mdds::trie::std_string_trait::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.

◆ to_key_buffer() [2/2]

static key_buffer_type mdds::trie::std_string_trait::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.