Static Public Member Functions | Public Member Functions | Public Attributes | List of all members
ObjectTrieNode< T > Class Template Reference

The node type contained in the object trie. More...

#include <ObjectTrie.hpp>

Static Public Member Functions

static ObjectAdder child (T &&value)
 Add a child of the child being added. More...
 
template<typename ... ObjectAdderT>
static ObjectAdder child (T &&value, ObjectAdderT &&... childAdder)
 Add a child of the child being added, plus descendants of the child. More...
 

Public Member Functions

template<typename ... ObjectAdderT>
ObjectTrieNode< T > & add (T &&value, ObjectAdderT &&... childAdder)
 Append a list of children to the node. More...
 
ObjectTrieNode< T > & add (std::vector< ObjectAdder > &&childAdders)
 Append a vector of children to the node. More...
 
ObjectTrieNode< T > & add (T &&value)
 Append a child containing the supplied data. More...
 
ObjectTrieNode< T > & add (const T &value)
 Append a child containing the supplied data. More...
 
ObjectTrieNode< T > & addAndReturnChild (const T &value)
 Append a child containing a copy of the supplied data. More...
 
ObjectTrieNode< T > & addAndReturnChild (T &&value)
 Append a child containing the supplied data. More...
 
ObjectTrieNode< T > & addOrReplace (T &&value)
 Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it. More...
 
ObjectTrieNode< T > & addOrReplace (const T &value)
 Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it. More...
 
template<typename CompareT >
ObjectTrieNode< T > & addOrReplace (T &&value, CompareT compare)
 Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it. More...
 
template<typename CompareT >
ObjectTrieNode< T > & addOrReplace (const T &value, CompareT compare)
 Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it. More...
 
template<typename CompareT , typename ReplaceT , ReplaceT replace>
ObjectTrieNode< T > & addOrReplace (T &&value, CompareT compare)
 Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it. More...
 
template<typename CompareT , typename ReplaceT >
ObjectTrieNode< T > & addOrReplace (const T &value, CompareT compare, ReplaceT replace)
 Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it. More...
 
ObjectTrieNode< T > & addOrReplaceAndReturnChild (const T &value)
 Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it. More...
 
ObjectTrieNode< T > & addOrReplaceAndReturnChild (T &&value)
 Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it. More...
 
template<typename CompareT >
ObjectTrieNode< T > & addOrReplaceAndReturnChild (const T &value, CompareT compare)
 Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it. More...
 
template<typename CompareT >
ObjectTrieNode< T > & addOrReplaceAndReturnChild (T &&value, CompareT compare)
 Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it. More...
 
template<typename CompareT , typename ReplaceT >
ObjectTrieNode< T > & addOrReplaceAndReturnChild (const T &value, CompareT compare, ReplaceT replace)
 Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it. More...
 
template<typename CompareT , typename ReplaceT >
ObjectTrieNode< T > & addOrReplaceAndReturnChild (T &&value, CompareT compare, ReplaceT replace)
 Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it. More...
 
ObjectTrieNode< T > * begin ()
 Get a depth iterator positioned at the beginning of the trie. More...
 
const ObjectTrieNode< T > * begin () const
 Get a const depth iterator positioned at the beginning of the trie. More...
 
size_t count () const
 Get the number of children in the node. More...
 
bool empty () const
 Returns true if the trie node is empty. More...
 
ObjectTrieNode< T > * end ()
 Get an iterator positioned at the end of the vector of children. More...
 
const ObjectTrieNode< T > * end () const
 Get a const iterator positioned at the end of the vector of children. More...
 
ObjectTrieNode< T > * find (const T &value)
 Locates the first child matching the supplied value or return nullptr if not found. More...
 
const ObjectTrieNode< T > * find (const T &value) const
 Locates the first child matching the supplied value or return nullptr if not found. More...
 
template<typename CompareT >
ObjectTrieNode< T > * find (const T &value, CompareT compare)
 Locates the first child matching the supplied value or return nullptr if not found. More...
 
template<typename CompareT >
const ObjectTrieNode< T > * find (const T &value, CompareT compare) const
 Locates the first child matching the supplied value or return nullptr if not found. More...
 
template<typename U , typename CompareT >
ObjectTrieNode< T > * find (const U &value, CompareT compare)
 Locates the first child matching the supplied value or return nullptr if not found. More...
 
template<typename U , typename CompareT >
const ObjectTrieNode< T > * find (const U &value, CompareT compare) const
 Locates the first child matching the supplied value or return nullptr if not found. More...
 
ObjectTrieNode< T > & findOrAddChild (const T &value)
 Locates the first child matching the supplied value or creates a one. More...
 
ObjectTrieNode< T > & findOrAddChild (T &&value)
 Locates the first child matching the supplied value or creates a one. More...
 
template<typename U , typename CompareT >
ObjectTrieNode< T > & findOrAddChild (const U &value, CompareT compare)
 Locates the first child matching the supplied value or creates one. More...
 
template<typename U , typename CompareT , typename Create >
ObjectTrieNode< T > & findOrAddChild (const U &value, CompareT compare, Create create)
 Locates the first child matching the supplied value or creates one. More...
 
ObjectTrieNode< T > & operator[] (size_t index)
 Get a reference to the specified child. More...
 
const ObjectTrieNode< T > & operator[] (size_t index) const
 Get a const reference to the specified child. More...
 

Public Attributes

value
 The publicly accessible data contained in the node. More...
 

Detailed Description

template<typename T>
class Balau::Container::ObjectTrieNode< T >

The node type contained in the object trie.

The data type stored in nodes must have a default constructor.

Nodes are exposed by the trie via the root() method, and from within the node type itself via the getChild() method.

Node manipulation is not exposed outside of the trie implementation.

Member Function Documentation

◆ add() [1/4]

ObjectTrieNode<T>& add ( T &&  value,
ObjectAdderT &&...  childAdder 
)
inline

Append a list of children to the node.

Returns
the current node, allowing chaining calls to be made

◆ add() [2/4]

ObjectTrieNode<T>& add ( std::vector< ObjectAdder > &&  childAdders)
inline

Append a vector of children to the node.

Returns
the current node, allowing chaining calls to be made

◆ add() [3/4]

ObjectTrieNode<T>& add ( T &&  value)
inline

Append a child containing the supplied data.

The data is moved into the new value.

Parameters
valuethe value that will be added
Returns
the current node, allowing chaining calls to be made

◆ add() [4/4]

ObjectTrieNode<T>& add ( const T &  value)
inline

Append a child containing the supplied data.

The data is copied into the new value.

Parameters
valuethe value that will be added
Returns
the current node, allowing chaining calls to be made

◆ addAndReturnChild() [1/2]

ObjectTrieNode<T>& addAndReturnChild ( const T &  value)
inline

Append a child containing a copy of the supplied data.

This is an alternative form of the add() method, that returns the newly created child instead of the current node.

The data is copied into the new value.

Parameters
valuethe value that will be added
Returns
the newly created node

◆ addAndReturnChild() [2/2]

ObjectTrieNode<T>& addAndReturnChild ( T &&  value)
inline

Append a child containing the supplied data.

This is an alternative form of the add() method, that returns the newly created child instead of the current node.

The data is moved into the new value.

Parameters
valuethe value that will be added
Returns
the newly created node

◆ addOrReplace() [1/6]

ObjectTrieNode<T>& addOrReplace ( T &&  value)
inline

Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it.

The operator == method is used to compare values.

The operator = method is used to assign the supplied value to the existing one when a matching value is is found.

The data is moved into the new or existing value.

Parameters
valuethe value that will be added or will replace
Returns
the current node, allowing chaining calls to be made

◆ addOrReplace() [2/6]

ObjectTrieNode<T>& addOrReplace ( const T &  value)
inline

Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it.

The operator == method is used to compare values.

The operator = method is used to assign the supplied value to the existing one when a matching value is is found.

The data is copied into the new or existing value.

Parameters
valuethe value that will be added or will replace
Returns
the current node, allowing chaining calls to be made

◆ addOrReplace() [3/6]

ObjectTrieNode<T>& addOrReplace ( T &&  value,
CompareT  compare 
)
inline

Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it.

The supplied comparator is used to compare values.

The operator = method is used to assign the supplied value to the existing one when a matching value is is found.

The data is moved into the new or existing value.

Template Parameters
CompareTthe type of the comparison function
Parameters
valuethe value that will be added or will replace
comparethe comparison function
Returns
the current node, allowing chaining calls to be made

◆ addOrReplace() [4/6]

ObjectTrieNode<T>& addOrReplace ( const T &  value,
CompareT  compare 
)
inline

Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it.

The supplied comparator is used to compare values.

The operator = method is used to assign the supplied value to the existing one when a matching value is is found.

The data is copied into the new or existing value.

Template Parameters
CompareTthe type of the comparison function
Parameters
valuethe value that will be added or will replace
comparethe comparison function
Returns
the current node, allowing chaining calls to be made

◆ addOrReplace() [5/6]

ObjectTrieNode<T>& addOrReplace ( T &&  value,
CompareT  compare 
)
inline

Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it.

The supplied comparator is used to compare values.

The supplied replacer is used to perform assignment of the values when a match is found.

The operator = method is used to assign the supplied value to the existing one when a matching value is is found.

The data is moved into the new or existing value.

Template Parameters
CompareTthe type of the comparison function
ReplaceTthe type of the replacer function
Parameters
replacethe replacer function
valuethe value that will be added or will replace
comparethe comparison function
Returns
the current node, allowing chaining calls to be made

◆ addOrReplace() [6/6]

ObjectTrieNode<T>& addOrReplace ( const T &  value,
CompareT  compare,
ReplaceT  replace 
)
inline

Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it.

The supplied comparator is used to compare values.

The supplied replacer is used to perform assignment of the values when a match is found.

The operator = method is used to assign the supplied value to the existing one when a matching value is is found.

The data is copied into the new or existing value.

Template Parameters
CompareTthe type of the comparison function
ReplaceTthe type of the replacer function
Parameters
valuethe value that will be added or will replace
comparethe comparison function
replacethe replacer function
Returns
the current node, allowing chaining calls to be made

◆ addOrReplaceAndReturnChild() [1/6]

ObjectTrieNode<T>& addOrReplaceAndReturnChild ( const T &  value)
inline

Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it.

This is an alternative form of the add() method, that returns the newly created child instead of the current node.

The operator == method is used to compare values.

The operator = method is used to assign the supplied value to the existing one when a matching value is is found.

The data is copied into the new or existing value.

Parameters
valuethe value that will be added or will replace
Returns
the newly created or modified node

◆ addOrReplaceAndReturnChild() [2/6]

ObjectTrieNode<T>& addOrReplaceAndReturnChild ( T &&  value)
inline

Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it.

This is an alternative form of the add() method, that returns the newly created child instead of the current node.

The operator == method is used to compare values.

The operator = method is used to assign the supplied value to the existing one when a matching value is is found.

The data is moved into the new or existing value.

Parameters
valuethe value that will be added or will replace
Returns
the newly created or modified node

◆ addOrReplaceAndReturnChild() [3/6]

ObjectTrieNode<T>& addOrReplaceAndReturnChild ( const T &  value,
CompareT  compare 
)
inline

Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it.

This is an alternative form of the add() method, that returns the newly created child instead of the current node.

The supplied comparator is used to compare values.

The operator = method is used to assign the supplied value to the existing one when a matching value is is found.

The data is copied into the new or existing value.

Template Parameters
CompareTthe type of the comparison function
Parameters
valuethe value that will be added or will replace
comparethe comparison function
Returns
the newly created or modified node

◆ addOrReplaceAndReturnChild() [4/6]

ObjectTrieNode<T>& addOrReplaceAndReturnChild ( T &&  value,
CompareT  compare 
)
inline

Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it.

This is an alternative form of the add() method, that returns the newly created child instead of the current node.

The supplied comparator is used to compare values.

The operator = method is used to assign the supplied value to the existing one when a matching value is is found.

The data is moved into the new or existing value.

Template Parameters
CompareTthe type of the comparison function
Parameters
valuethe value that will be added or will replace
comparethe comparison function
Returns
the newly created or modified node

◆ addOrReplaceAndReturnChild() [5/6]

ObjectTrieNode<T>& addOrReplaceAndReturnChild ( const T &  value,
CompareT  compare,
ReplaceT  replace 
)
inline

Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it.

This is an alternative form of the add() method, that returns the newly created child instead of the current node.

The supplied comparator is used to compare values.

The supplied replacer is used to perform assignment of the values when a match is found.

The operator = method is used to assign the supplied value to the existing one when a matching value is is found.

The data is copied into the new or existing value.

Template Parameters
CompareTthe type of the comparison function
ReplaceTthe type of the replacer function
Parameters
valuethe value that will be added or will replace
comparethe comparison function
replacethe replacer function
Returns
the newly created or modified node

◆ addOrReplaceAndReturnChild() [6/6]

ObjectTrieNode<T>& addOrReplaceAndReturnChild ( T &&  value,
CompareT  compare,
ReplaceT  replace 
)
inline

Append a child containing the supplied data if a child equal to the supplied value is not present, otherwise replace it.

This is an alternative form of the add() method, that returns the newly created child instead of the current node.

The supplied comparator is used to compare values.

The supplied replacer is used to perform assignment of the values when a match is found.

The operator = method is used to assign the supplied value to the existing one when a matching value is is found.

The data is moved into the new or existing value.

Template Parameters
CompareTthe type of the comparison function
ReplaceTthe type of the replacer function
Parameters
valuethe value that will be added or will replace
comparethe comparison function
replacethe replacer function
Returns
the newly created or modified node

◆ begin() [1/2]

ObjectTrieNode<T>* begin ( )
inline

Get a depth iterator positioned at the beginning of the trie.

◆ begin() [2/2]

const ObjectTrieNode<T>* begin ( ) const
inline

Get a const depth iterator positioned at the beginning of the trie.

◆ child() [1/2]

static ObjectAdder child ( T &&  value)
inlinestatic

Add a child of the child being added.

◆ child() [2/2]

static ObjectAdder child ( T &&  value,
ObjectAdderT &&...  childAdder 
)
inlinestatic

Add a child of the child being added, plus descendants of the child.

◆ count()

size_t count ( ) const
inline

Get the number of children in the node.

◆ empty()

bool empty ( ) const
inline

Returns true if the trie node is empty.

◆ end() [1/2]

ObjectTrieNode<T>* end ( )
inline

Get an iterator positioned at the end of the vector of children.

◆ end() [2/2]

const ObjectTrieNode<T>* end ( ) const
inline

Get a const iterator positioned at the end of the vector of children.

◆ find() [1/6]

ObjectTrieNode<T>* find ( const T &  value)
inline

Locates the first child matching the supplied value or return nullptr if not found.

Parameters
valuethe value to compare
Returns
the matching child or nullptr if no match was found.

◆ find() [2/6]

const ObjectTrieNode<T>* find ( const T &  value) const
inline

Locates the first child matching the supplied value or return nullptr if not found.

Parameters
valuethe value to compare
Returns
the matching child or nullptr if no match was found.

◆ find() [3/6]

ObjectTrieNode<T>* find ( const T &  value,
CompareT  compare 
)
inline

Locates the first child matching the supplied value or return nullptr if not found.

The supplied comparator is used to determine equality (true == equal).

Template Parameters
CompareTthe type of the comparison function
Parameters
valuethe value to compare
comparethe comparison function between type U and type T
Returns
the matching child or nullptr if no match was found.

◆ find() [4/6]

const ObjectTrieNode<T>* find ( const T &  value,
CompareT  compare 
) const
inline

Locates the first child matching the supplied value or return nullptr if not found.

The supplied comparator is used to determine equality (true == equal).

Template Parameters
CompareTthe type of the comparison function
Parameters
valuethe value to compare
comparethe comparison function between type U and type T
Returns
the matching child or nullptr if no match was found.

◆ find() [5/6]

ObjectTrieNode<T>* find ( const U &  value,
CompareT  compare 
)
inline

Locates the first child matching the supplied value or return nullptr if not found.

The supplied comparator is used to determine equality (true == equal).

Template Parameters
Uthe type of the value to compare
CompareTthe type of the comparison function
Parameters
valuethe value to compare
comparethe comparison function between type U and type T
Returns
the matching child or nullptr if no match was found.

◆ find() [6/6]

const ObjectTrieNode<T>* find ( const U &  value,
CompareT  compare 
) const
inline

Locates the first child matching the supplied value or return nullptr if not found.

The supplied comparator is used to determine equality (true == equal).

Template Parameters
Uthe type of the value to compare
CompareTthe type of the comparison function
Parameters
valuethe value to compare
comparethe comparison function between type U and type T
Returns
the matching child or nullptr if no match was found.

◆ findOrAddChild() [1/4]

ObjectTrieNode<T>& findOrAddChild ( const T &  value)
inline

Locates the first child matching the supplied value or creates a one.

The supplied value will be copied if no match was found and a new node is created.

Parameters
valuethe value to compare and copy if a new node is created
Returns
the matching child or the newly created one.

◆ findOrAddChild() [2/4]

ObjectTrieNode<T>& findOrAddChild ( T &&  value)
inline

Locates the first child matching the supplied value or creates a one.

The supplied value will be moved if no match was found and a new node is created.

Parameters
valuethe value to compare and move if a new node is created
Returns
the matching child or the newly created one.

◆ findOrAddChild() [3/4]

ObjectTrieNode<T>& findOrAddChild ( const U &  value,
CompareT  compare 
)
inline

Locates the first child matching the supplied value or creates one.

A new value will be created from the supplied value if no match was found and a new node is created.

Template Parameters
Uthe type of the value to compare
CompareTthe type of the comparison function
Parameters
valuethe value to compare
comparethe comparison function between type U and type T
Returns
the matching child or the newly created one.

◆ findOrAddChild() [4/4]

ObjectTrieNode<T>& findOrAddChild ( const U &  value,
CompareT  compare,
Create  create 
)
inline

Locates the first child matching the supplied value or creates one.

A new value will be created from the supplied value via the create function if no match was found and a new node is created.

Template Parameters
Uthe type of the value to compare
CompareTthe type of the comparison function
Createthe function used to create a new value
Parameters
valuethe value to compare
comparethe comparison function between type U and type T
Returns
the matching child or the newly created one.

◆ operator[]() [1/2]

ObjectTrieNode<T>& operator[] ( size_t  index)
inline

Get a reference to the specified child.

◆ operator[]() [2/2]

const ObjectTrieNode<T>& operator[] ( size_t  index) const
inline

Get a const reference to the specified child.

Member Data Documentation

◆ value

T value

The publicly accessible data contained in the node.


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