Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
Public Member Functions
ext::VararyNode< Data, Base > Class Template Reference

Varary node is tree node that can hold any number of children. More...

#include <tree_base.hpp>

Inheritance diagram for ext::VararyNode< Data, Base >:
[legend]
Collaboration diagram for ext::VararyNode< Data, Base >:
[legend]

Public Member Functions

 VararyNode ()=default
 Default constructor. Sets the vector of children to empty vector. More...
 
 VararyNode (ext::ptr_vector< Data > c)
 Constructor from vector of child nodes. More...
 
 ~VararyNode () noexcept override=default
 Destructor of the class. More...
 
 VararyNode (const VararyNode &other)
 Copy constructor of the class. More...
 
 VararyNode (VararyNode &&other) noexcept
 Move constructor of the class. More...
 
VararyNodeoperator= (const VararyNode &other)
 Copy operator of assignment. More...
 
VararyNodeoperator= (VararyNode &&other) noexcept
 Move operator of assignment. More...
 
const ext::ptr_vector< Data > & getChildren () &
 Getter of the vector of children. More...
 
const ext::ptr_vector< Data > & getChildren () const &
 Getter of the vector of children. More...
 
ext::ptr_vector< Data > && getChildren () &&
 Getter of the child nodes. More...
 
void setChildren (ext::ptr_vector< Data > c)
 Setter of the vector of children. More...
 
Data & getChild (size_t index)
 Getter of the child at given index. More...
 
const Data & getChild (size_t index) const
 Getter of the child at given index. More...
 
template<class PositionIterator >
void setChild (const Data &d, PositionIterator it)
 Setter of the single child of the node. More...
 
template<class PositionIterator >
void setChild (Data &&d, PositionIterator it)
 Setter of the single child of the node. More...
 
void setChild (const Data &d, size_t index)
 Setter of the single child of the node. More...
 
void setChild (Data &&d, size_t index)
 Setter of the single child of the node. More...
 
ext::ptr_vector< Data >::reverse_iterator insert (typename ext::ptr_vector< Data >::reverse_iterator it, const Data &d)
 Inserts a new child at position specified by iterator. More...
 
ext::ptr_vector< Data >::reverse_iterator insert (typename ext::ptr_vector< Data >::const_reverse_iterator it, const Data &d)
 Inserts a new child at position specified by iterator. More...
 
ext::ptr_vector< Data >::iterator insert (typename ext::ptr_vector< Data >::iterator it, const Data &d)
 Inserts a new child at position specified by iterator. More...
 
ext::ptr_vector< Data >::iterator insert (typename ext::ptr_vector< Data >::const_iterator it, const Data &d)
 Inserts a new child at position specified by iterator. More...
 
ext::ptr_vector< Data >::reverse_iterator insert (typename ext::ptr_vector< Data >::reverse_iterator it, Data &&d)
 Inserts a new child at position specified by iterator. More...
 
ext::ptr_vector< Data >::reverse_iterator insert (typename ext::ptr_vector< Data >::const_reverse_iterator it, Data &&d)
 Inserts a new child at position specified by iterator. More...
 
ext::ptr_vector< Data >::iterator insert (typename ext::ptr_vector< Data >::iterator it, Data &&d)
 Inserts a new child at position specified by iterator. More...
 
ext::ptr_vector< Data >::iterator insert (typename ext::ptr_vector< Data >::const_iterator it, Data &&d)
 Inserts a new child at position specified by iterator. More...
 
template<class InputIterator >
ext::ptr_vector< Data >::reverse_iterator insert (typename ext::ptr_vector< Data >::const_reverse_iterator it, InputIterator first, InputIterator last)
 Inserts a new children from a given range at position specified by iterator. More...
 
template<class InputIterator >
ext::ptr_vector< Data >::reverse_iterator insert (typename ext::ptr_vector< Data >::reverse_iterator it, InputIterator first, InputIterator last)
 Inserts a new children from a given range at position specified by iterator. More...
 
template<class InputIterator >
ext::ptr_vector< Data >::iterator insert (typename ext::ptr_vector< Data >::const_iterator it, InputIterator first, InputIterator last)
 Inserts a new children from a given range at position specified by iterator. More...
 
template<class InputIterator >
ext::ptr_vector< Data >::iterator insert (typename ext::ptr_vector< Data >::iterator it, InputIterator first, InputIterator last)
 Inserts a new children from a given range at position specified by iterator. More...
 
ext::ptr_vector< Data >::reverse_iterator erase (typename ext::ptr_vector< Data >::reverse_iterator it)
 Erases a child specified by an iterator. More...
 
ext::ptr_vector< Data >::reverse_iterator erase (typename ext::ptr_vector< Data >::const_reverse_iterator it)
 Erases a child specified by an iterator. More...
 
ext::ptr_vector< Data >::iterator erase (typename ext::ptr_vector< Data >::iterator it)
 Erases a child specified by an iterator. More...
 
ext::ptr_vector< Data >::iterator erase (typename ext::ptr_vector< Data >::const_iterator it)
 Erases a child specified by an iterator. More...
 
ext::ptr_vector< Data >::reverse_iterator erase (typename ext::ptr_vector< Data >::reverse_iterator first, typename ext::ptr_vector< Data >::reverse_iterator last)
 Erases a range of children specified by an iterator. More...
 
ext::ptr_vector< Data >::reverse_iterator erase (typename ext::ptr_vector< Data >::const_reverse_iterator first, typename ext::ptr_vector< Data >::const_reverse_iterator last)
 Erases a range of children specified by an iterator. More...
 
ext::ptr_vector< Data >::iterator erase (typename ext::ptr_vector< Data >::iterator first, typename ext::ptr_vector< Data >::iterator last)
 Erases a range of children specified by an iterator. More...
 
ext::ptr_vector< Data >::iterator erase (typename ext::ptr_vector< Data >::const_iterator first, typename ext::ptr_vector< Data >::const_iterator last)
 Erases a range of children specified by an iterator. More...
 
void clear ()
 Erases all children. More...
 
void pushBackChild (const Data &d)
 Appends a new child at the end of the child vector. More...
 
void pushBackChild (Data &&d)
 Appends a new child at the end of the child vector. More...
 
ext::ptr_vector< Data >::iterator begin ()
 Getter of an iterator to the begining of children vector. More...
 
ext::ptr_vector< Data >::const_iterator begin () const
 Getter of an iterator to the begining of children vector. More...
 
ext::ptr_vector< Data >::reverse_iterator rbegin ()
 Getter of an iterator to the begining of children vector. More...
 
ext::ptr_vector< Data >::const_reverse_iterator rbegin () const
 Getter of an iterator to the begining of children vector. More...
 
ext::ptr_vector< Data >::iterator end ()
 Getter of an iterator to the end of children vector. More...
 
ext::ptr_vector< Data >::const_iterator end () const
 Getter of an iterator to the end of children vector. More...
 
ext::ptr_vector< Data >::reverse_iterator rend ()
 Getter of an iterator to the end of children vector. More...
 
ext::ptr_vector< Data >::const_reverse_iterator rend () const
 Getter of an iterator to the end of children vector. More...
 

Detailed Description

template<class Data, class Base = Data>
class ext::VararyNode< Data, Base >

Varary node is tree node that can hold any number of children.

Template Parameters
Datathe base class of the actual tree nodes hierarchy on top of this one
Basethe actual class from the actual tree nodes hierarchy

Constructor & Destructor Documentation

◆ VararyNode() [1/4]

template<class Data , class Base = Data>
ext::VararyNode< Data, Base >::VararyNode ( )
default

Default constructor. Sets the vector of children to empty vector.

◆ VararyNode() [2/4]

template<class Data , class Base = Data>
ext::VararyNode< Data, Base >::VararyNode ( ext::ptr_vector< Data >  c)
inline

Constructor from vector of child nodes.

Parameters
cthe vector of child nodes

◆ ~VararyNode()

template<class Data , class Base = Data>
ext::VararyNode< Data, Base >::~VararyNode ( )
overridedefaultnoexcept

Destructor of the class.

◆ VararyNode() [3/4]

template<class Data , class Base = Data>
ext::VararyNode< Data, Base >::VararyNode ( const VararyNode< Data, Base > &  other)
inline

Copy constructor of the class.

Parameters
otherthe other instance

◆ VararyNode() [4/4]

template<class Data , class Base = Data>
ext::VararyNode< Data, Base >::VararyNode ( VararyNode< Data, Base > &&  other)
inlinenoexcept

Move constructor of the class.

Parameters
otherthe other instance

Member Function Documentation

◆ begin() [1/2]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::iterator ext::VararyNode< Data, Base >::begin ( )
inline

Getter of an iterator to the begining of children vector.

Returns
begin iterator
Here is the call graph for this function:

◆ begin() [2/2]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::const_iterator ext::VararyNode< Data, Base >::begin ( ) const
inline

Getter of an iterator to the begining of children vector.

Returns
begin iterator
Here is the call graph for this function:

◆ clear()

template<class Data , class Base = Data>
void ext::VararyNode< Data, Base >::clear ( )
inline

Erases all children.

Here is the call graph for this function:

◆ end() [1/2]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::iterator ext::VararyNode< Data, Base >::end ( )
inline

Getter of an iterator to the end of children vector.

Returns
end iterator
Here is the call graph for this function:

◆ end() [2/2]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::const_iterator ext::VararyNode< Data, Base >::end ( ) const
inline

Getter of an iterator to the end of children vector.

Returns
end iterator
Here is the call graph for this function:

◆ erase() [1/8]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::iterator ext::VararyNode< Data, Base >::erase ( typename ext::ptr_vector< Data >::const_iterator  first,
typename ext::ptr_vector< Data >::const_iterator  last 
)
inline

Erases a range of children specified by an iterator.

Parameters
firstthe position where to insert
lastthe position where to insert
Returns
the updated iterator to node after the last erased one
Here is the call graph for this function:

◆ erase() [2/8]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::iterator ext::VararyNode< Data, Base >::erase ( typename ext::ptr_vector< Data >::const_iterator  it)
inline

Erases a child specified by an iterator.

Parameters
itthe position where to insert
Returns
the updated iterator to node after the erased one
Here is the call graph for this function:

◆ erase() [3/8]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::reverse_iterator ext::VararyNode< Data, Base >::erase ( typename ext::ptr_vector< Data >::const_reverse_iterator  first,
typename ext::ptr_vector< Data >::const_reverse_iterator  last 
)
inline

Erases a range of children specified by an iterator.

Parameters
firstthe position where to insert
lastthe position where to insert
Returns
the updated iterator to node after the last erased one
Here is the call graph for this function:

◆ erase() [4/8]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::reverse_iterator ext::VararyNode< Data, Base >::erase ( typename ext::ptr_vector< Data >::const_reverse_iterator  it)
inline

Erases a child specified by an iterator.

Parameters
itthe position where to insert
Returns
the updated iterator to node after the erased one
Here is the call graph for this function:

◆ erase() [5/8]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::iterator ext::VararyNode< Data, Base >::erase ( typename ext::ptr_vector< Data >::iterator  first,
typename ext::ptr_vector< Data >::iterator  last 
)
inline

Erases a range of children specified by an iterator.

Parameters
firstthe position where to insert
lastthe position where to insert
Returns
the updated iterator to node after the last erased one
Here is the call graph for this function:

◆ erase() [6/8]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::iterator ext::VararyNode< Data, Base >::erase ( typename ext::ptr_vector< Data >::iterator  it)
inline

Erases a child specified by an iterator.

Parameters
itthe position where to insert
Returns
the updated iterator to node after the erased one
Here is the call graph for this function:

◆ erase() [7/8]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::reverse_iterator ext::VararyNode< Data, Base >::erase ( typename ext::ptr_vector< Data >::reverse_iterator  first,
typename ext::ptr_vector< Data >::reverse_iterator  last 
)
inline

Erases a range of children specified by an iterator.

Parameters
firstthe position where to insert
lastthe position where to insert
Returns
the updated iterator to node after the last erased one
Here is the call graph for this function:

◆ erase() [8/8]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::reverse_iterator ext::VararyNode< Data, Base >::erase ( typename ext::ptr_vector< Data >::reverse_iterator  it)
inline

Erases a child specified by an iterator.

Parameters
itthe position where to insert
Returns
the updated iterator to node after the erased one
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChild() [1/2]

template<class Data , class Base = Data>
Data & ext::VararyNode< Data, Base >::getChild ( size_t  index)
inline

Getter of the child at given index.

Parameters
indexthe index to retrieve
Returns
reference to the child at given index
Here is the caller graph for this function:

◆ getChild() [2/2]

template<class Data , class Base = Data>
const Data & ext::VararyNode< Data, Base >::getChild ( size_t  index) const
inline

Getter of the child at given index.

Parameters
indexthe index to retrieve
Returns
reference to the child at given index

◆ getChildren() [1/3]

template<class Data , class Base = Data>
const ext::ptr_vector< Data > & ext::VararyNode< Data, Base >::getChildren ( ) &
inline

Getter of the vector of children.

Returns
the child nodes
Here is the caller graph for this function:

◆ getChildren() [2/3]

template<class Data , class Base = Data>
ext::ptr_vector< Data > && ext::VararyNode< Data, Base >::getChildren ( ) &&
inline

Getter of the child nodes.

Returns
child nodes

◆ getChildren() [3/3]

template<class Data , class Base = Data>
const ext::ptr_vector< Data > & ext::VararyNode< Data, Base >::getChildren ( ) const &
inline

Getter of the vector of children.

Returns
the child nodes

◆ insert() [1/12]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::iterator ext::VararyNode< Data, Base >::insert ( typename ext::ptr_vector< Data >::const_iterator  it,
const Data &  d 
)
inline

Inserts a new child at position specified by iterator.

Parameters
itthe position where to insert
dthe new child to insert
Returns
the updated iterator to the inserted child
Here is the call graph for this function:

◆ insert() [2/12]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::iterator ext::VararyNode< Data, Base >::insert ( typename ext::ptr_vector< Data >::const_iterator  it,
Data &&  d 
)
inline

Inserts a new child at position specified by iterator.

Parameters
itthe position where to insert
dthe new child to insert
Returns
the updated iterator to the inserted child
Here is the call graph for this function:

◆ insert() [3/12]

template<class Data , class Base = Data>
template<class InputIterator >
ext::ptr_vector< Data >::iterator ext::VararyNode< Data, Base >::insert ( typename ext::ptr_vector< Data >::const_iterator  it,
InputIterator  first,
InputIterator  last 
)
inline

Inserts a new children from a given range at position specified by iterator.

Template Parameters
InputIteratortye type of iterators specifying the range of new children
Parameters
itthe position where to insert
firstthe begining of the children range
lastthe end of the children range
Returns
the updated iterator to the inserted child
Here is the call graph for this function:

◆ insert() [4/12]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::reverse_iterator ext::VararyNode< Data, Base >::insert ( typename ext::ptr_vector< Data >::const_reverse_iterator  it,
const Data &  d 
)
inline

Inserts a new child at position specified by iterator.

Parameters
itthe position where to insert
dthe new child to insert
Returns
the updated iterator to the inserted child
Here is the call graph for this function:

◆ insert() [5/12]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::reverse_iterator ext::VararyNode< Data, Base >::insert ( typename ext::ptr_vector< Data >::const_reverse_iterator  it,
Data &&  d 
)
inline

Inserts a new child at position specified by iterator.

Parameters
itthe position where to insert
dthe new child to insert
Returns
the updated iterator to the inserted child
Here is the call graph for this function:

◆ insert() [6/12]

template<class Data , class Base = Data>
template<class InputIterator >
ext::ptr_vector< Data >::reverse_iterator ext::VararyNode< Data, Base >::insert ( typename ext::ptr_vector< Data >::const_reverse_iterator  it,
InputIterator  first,
InputIterator  last 
)
inline

Inserts a new children from a given range at position specified by iterator.

Template Parameters
InputIteratortye type of iterators specifying the range of new children
Parameters
itthe position where to insert
firstthe begining of the children range
lastthe end of the children range
Returns
the updated iterator to the inserted child
Here is the call graph for this function:

◆ insert() [7/12]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::iterator ext::VararyNode< Data, Base >::insert ( typename ext::ptr_vector< Data >::iterator  it,
const Data &  d 
)
inline

Inserts a new child at position specified by iterator.

Parameters
itthe position where to insert
dthe new child to insert
Returns
the updated iterator to the inserted child
Here is the call graph for this function:

◆ insert() [8/12]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::iterator ext::VararyNode< Data, Base >::insert ( typename ext::ptr_vector< Data >::iterator  it,
Data &&  d 
)
inline

Inserts a new child at position specified by iterator.

Parameters
itthe position where to insert
dthe new child to insert
Returns
the updated iterator to the inserted child
Here is the call graph for this function:

◆ insert() [9/12]

template<class Data , class Base = Data>
template<class InputIterator >
ext::ptr_vector< Data >::iterator ext::VararyNode< Data, Base >::insert ( typename ext::ptr_vector< Data >::iterator  it,
InputIterator  first,
InputIterator  last 
)
inline

Inserts a new children from a given range at position specified by iterator.

Template Parameters
InputIteratortye type of iterators specifying the range of new children
Parameters
itthe position where to insert
firstthe begining of the children range
lastthe end of the children range
Returns
the updated iterator to the inserted child
Here is the call graph for this function:

◆ insert() [10/12]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::reverse_iterator ext::VararyNode< Data, Base >::insert ( typename ext::ptr_vector< Data >::reverse_iterator  it,
const Data &  d 
)
inline

Inserts a new child at position specified by iterator.

Parameters
itthe position where to insert
dthe new child to insert
Returns
the updated iterator to the inserted child
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert() [11/12]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::reverse_iterator ext::VararyNode< Data, Base >::insert ( typename ext::ptr_vector< Data >::reverse_iterator  it,
Data &&  d 
)
inline

Inserts a new child at position specified by iterator.

Parameters
itthe position where to insert
dthe new child to insert
Returns
the updated iterator to the inserted child
Here is the call graph for this function:

◆ insert() [12/12]

template<class Data , class Base = Data>
template<class InputIterator >
ext::ptr_vector< Data >::reverse_iterator ext::VararyNode< Data, Base >::insert ( typename ext::ptr_vector< Data >::reverse_iterator  it,
InputIterator  first,
InputIterator  last 
)
inline

Inserts a new children from a given range at position specified by iterator.

Template Parameters
InputIteratortye type of iterators specifying the range of new children
Parameters
itthe position where to insert
firstthe begining of the children range
lastthe end of the children range
Returns
the updated iterator to the inserted child
Here is the call graph for this function:

◆ operator=() [1/2]

template<class Data , class Base = Data>
VararyNode & ext::VararyNode< Data, Base >::operator= ( const VararyNode< Data, Base > &  other)
inline

Copy operator of assignment.

Parameters
otherthe other instance

◆ operator=() [2/2]

template<class Data , class Base = Data>
VararyNode & ext::VararyNode< Data, Base >::operator= ( VararyNode< Data, Base > &&  other)
inlinenoexcept

Move operator of assignment.

Parameters
otherthe other instance
Here is the call graph for this function:

◆ pushBackChild() [1/2]

template<class Data , class Base = Data>
void ext::VararyNode< Data, Base >::pushBackChild ( const Data &  d)
inline

Appends a new child at the end of the child vector.

Parameters
dthe new child to add
Here is the call graph for this function:

◆ pushBackChild() [2/2]

template<class Data , class Base = Data>
void ext::VararyNode< Data, Base >::pushBackChild ( Data &&  d)
inline

Appends a new child at the end of the child vector.

Parameters
dthe new child to add
Here is the call graph for this function:

◆ rbegin() [1/2]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::reverse_iterator ext::VararyNode< Data, Base >::rbegin ( )
inline

Getter of an iterator to the begining of children vector.

Returns
begin iterator
Here is the call graph for this function:

◆ rbegin() [2/2]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::const_reverse_iterator ext::VararyNode< Data, Base >::rbegin ( ) const
inline

Getter of an iterator to the begining of children vector.

Returns
begin iterator
Here is the call graph for this function:

◆ rend() [1/2]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::reverse_iterator ext::VararyNode< Data, Base >::rend ( )
inline

Getter of an iterator to the end of children vector.

Returns
end iterator
Here is the call graph for this function:

◆ rend() [2/2]

template<class Data , class Base = Data>
ext::ptr_vector< Data >::const_reverse_iterator ext::VararyNode< Data, Base >::rend ( ) const
inline

Getter of an iterator to the end of children vector.

Returns
end iterator
Here is the call graph for this function:

◆ setChild() [1/4]

template<class Data , class Base = Data>
template<class PositionIterator >
void ext::VararyNode< Data, Base >::setChild ( const Data &  d,
PositionIterator  it 
)
inline

Setter of the single child of the node.

Parameters
dthe new child node
itthe position where to change the child
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setChild() [2/4]

template<class Data , class Base = Data>
void ext::VararyNode< Data, Base >::setChild ( const Data &  d,
size_t  index 
)
inline

Setter of the single child of the node.

Parameters
dthe new child node
indexthe position where to change the child
Here is the call graph for this function:

◆ setChild() [3/4]

template<class Data , class Base = Data>
template<class PositionIterator >
void ext::VararyNode< Data, Base >::setChild ( Data &&  d,
PositionIterator  it 
)
inline

Setter of the single child of the node.

Parameters
dthe new child node
itthe position where to change the child
Here is the call graph for this function:

◆ setChild() [4/4]

template<class Data , class Base = Data>
void ext::VararyNode< Data, Base >::setChild ( Data &&  d,
size_t  index 
)
inline

Setter of the single child of the node.

Parameters
dthe new child node
indexthe position where to change the child
Here is the call graph for this function:

◆ setChildren()

template<class Data , class Base = Data>
void ext::VararyNode< Data, Base >::setChildren ( ext::ptr_vector< Data >  c)
inline

Setter of the vector of children.

Parameters
cthe new child nodes in for of a vector

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