HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_ARTMap< T > Class Template Reference

#include <UT_ARTMap.h>

Public Types

using iterator = UT_ARTIterator< T >
 
using key_type = UT_StringHolder
 
using mapped_type = T
 
using const_iterator = const iterator
 Returns the beginning of an iterator used to traverse the full tree. More...
 

Public Member Functions

 UT_ARTMap ()
 Initialize an empty map. More...
 
 UT_NON_COPYABLE (UT_ARTMap)
 
 ~UT_ARTMap ()
 
std::pair< iterator, bool > insert (const UT_StringHolder &name, const T &data, bool allow_partial=false)
 
std::pair< iterator, bool > insert (const UT_StringHolder &name, T &&value, bool allow_partial=false)
 
template<typename... Args>
std::pair< iterator, bool > emplace (const UT_StringHolder &name, Args &&...args)
 
std::enable_if_t
< std::is_default_constructible_v
< T >, T & > 
operator[] (const UT_StringHolder &key)
 
std::enable_if_t
< std::is_default_constructible_v
< T >, T & > 
operator[] (UT_StringHolder &&key)
 
SYS_NO_DISCARD_RESULT iterator find (UT_StringView prefix) const
 Find the node based on the provided prefix. More...
 
SYS_NO_DISCARD_RESULT bool contains (const UT_StringHolder &prefix) const
 Check if the tree contains the provided string. More...
 
void debug (UT_WorkBuffer &wbuf) const
 Write out the tree into the work buffer. This is pretty printed. More...
 
bool erase (const UT_StringRef &prefix)
 
void clear ()
 Clear out the tree. More...
 
SYS_NO_DISCARD_RESULT bool isEmpty () const
 Returns true if the map has no items currently inserted. More...
 
SYS_NO_DISCARD_RESULT
const_iterator 
begin () const
 
SYS_NO_DISCARD_RESULT iterator begin ()
 Returns the beginning of an iterator used to traverse the full tree. More...
 
SYS_NO_DISCARD_RESULT
const_iterator 
end () const
 
SYS_NO_DISCARD_RESULT iterator end ()
 
SYS_NO_DISCARD_RESULT
const_iterator 
cbegin () const
 
SYS_NO_DISCARD_RESULT
const_iterator 
cend () const
 

Detailed Description

template<typename T>
class UT_ARTMap< T >

A basic adaptive radix tree implementation using node4, node16, node48, and node256 for space and performance.

Definition at line 99 of file UT_ARTMap.h.

Member Typedef Documentation

template<typename T >
using UT_ARTMap< T >::const_iterator = const iterator

Returns the beginning of an iterator used to traverse the full tree.

Definition at line 937 of file UT_ARTMap.h.

template<typename T >
using UT_ARTMap< T >::iterator = UT_ARTIterator<T>

Definition at line 733 of file UT_ARTMap.h.

template<typename T >
using UT_ARTMap< T >::key_type = UT_StringHolder

Definition at line 734 of file UT_ARTMap.h.

template<typename T >
using UT_ARTMap< T >::mapped_type = T

Definition at line 735 of file UT_ARTMap.h.

Constructor & Destructor Documentation

template<typename T >
UT_ARTMap< T >::UT_ARTMap ( )
inline

Initialize an empty map.

Definition at line 746 of file UT_ARTMap.h.

template<typename T >
UT_ARTMap< T >::~UT_ARTMap ( )
inline

Definition at line 754 of file UT_ARTMap.h.

Member Function Documentation

template<typename T >
SYS_NO_DISCARD_RESULT const_iterator UT_ARTMap< T >::begin ( void  ) const
inline

Definition at line 938 of file UT_ARTMap.h.

template<typename T >
SYS_NO_DISCARD_RESULT iterator UT_ARTMap< T >::begin ( void  )
inline

Returns the beginning of an iterator used to traverse the full tree.

Definition at line 944 of file UT_ARTMap.h.

template<typename T >
SYS_NO_DISCARD_RESULT const_iterator UT_ARTMap< T >::cbegin ( ) const
inline

Returns the end of an iterator used with begin() to traverse the full tree.

Definition at line 956 of file UT_ARTMap.h.

template<typename T >
SYS_NO_DISCARD_RESULT const_iterator UT_ARTMap< T >::cend ( ) const
inline

Returns the end of an iterator used with begin() to traverse the full tree.

Definition at line 959 of file UT_ARTMap.h.

template<typename T >
void UT_ARTMap< T >::clear ( )
inline

Clear out the tree.

Definition at line 916 of file UT_ARTMap.h.

template<typename T >
SYS_NO_DISCARD_RESULT bool UT_ARTMap< T >::contains ( const UT_StringHolder prefix) const
inline

Check if the tree contains the provided string.

Definition at line 895 of file UT_ARTMap.h.

template<typename T >
void UT_ARTMap< T >::debug ( UT_WorkBuffer wbuf) const
inline

Write out the tree into the work buffer. This is pretty printed.

Definition at line 901 of file UT_ARTMap.h.

template<typename T >
template<typename... Args>
std::pair<iterator, bool> UT_ARTMap< T >::emplace ( const UT_StringHolder name,
Args &&...  args 
)
inline

Insert a node into the tree by emplacing its value. This function does not allow specifying partial matches as its meant to be equivalent to STL maps.

Definition at line 792 of file UT_ARTMap.h.

template<typename T >
SYS_NO_DISCARD_RESULT const_iterator UT_ARTMap< T >::end ( void  ) const
inline

Returns the end of an iterator used with begin() to traverse the full tree.

Definition at line 950 of file UT_ARTMap.h.

template<typename T >
SYS_NO_DISCARD_RESULT iterator UT_ARTMap< T >::end ( void  )
inline

Returns the end of an iterator used with begin() to traverse the full tree.

Definition at line 953 of file UT_ARTMap.h.

template<typename T >
bool UT_ARTMap< T >::erase ( const UT_StringRef prefix)
inline

Erase a given entry based on the prefix. Returns true if the item was removed from the tree.

Definition at line 910 of file UT_ARTMap.h.

template<typename T >
SYS_NO_DISCARD_RESULT iterator UT_ARTMap< T >::find ( UT_StringView  prefix) const
inline

Find the node based on the provided prefix.

Definition at line 836 of file UT_ARTMap.h.

template<typename T >
std::pair<iterator, bool> UT_ARTMap< T >::insert ( const UT_StringHolder name,
const T data,
bool  allow_partial = false 
)
inline

Insert a node with the additional option to specify if partial matches are allowed for this item. If you're using UT_ARTMap like a traditional map then partial matches arent something that needs to be considered.

Definition at line 768 of file UT_ARTMap.h.

template<typename T >
std::pair<iterator, bool> UT_ARTMap< T >::insert ( const UT_StringHolder name,
T &&  value,
bool  allow_partial = false 
)
inline

Insert a node by moving its values instead of copying it. This function additionally supports specifying if partial matches are allowed for this item. If you're using UT_ARTMap like a traditional map then partial matches arent something that needs to be considered.

Definition at line 780 of file UT_ARTMap.h.

template<typename T >
SYS_NO_DISCARD_RESULT bool UT_ARTMap< T >::isEmpty ( ) const
inline

Returns true if the map has no items currently inserted.

Definition at line 931 of file UT_ARTMap.h.

template<typename T >
std::enable_if_t<std::is_default_constructible_v<T>, T&> UT_ARTMap< T >::operator[] ( const UT_StringHolder key)
inline

Lookup an existing item based on the key. If no item is found a default constructible item is placed into the tree. This function does not support allowing partial matches.

Definition at line 804 of file UT_ARTMap.h.

template<typename T >
std::enable_if_t<std::is_default_constructible_v<T>, T&> UT_ARTMap< T >::operator[] ( UT_StringHolder &&  key)
inline

Lookup an existing item based on the key. If no item is found a default constructible item is placed into the tree. This function does not support allowing partial matches.

Definition at line 821 of file UT_ARTMap.h.

template<typename T >
UT_ARTMap< T >::UT_NON_COPYABLE ( UT_ARTMap< T )

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