19template <
class Data >
27 template <
class D,
class C >
29 template <
class D,
class C >
31 template <
class D,
class C >
33 template <
class D,
class C >
35 template <
class D, std::
size_t I,
class C >
37 template <
class D,
class C >
39 template <
class D,
class C >
48 Data * operator ->( ) {
49 return static_cast < Data *
> ( this );
58 const Data * operator ->( )
const {
59 return static_cast < const Data *
> ( this );
136template <
class Data, std::
size_t arity,
class Base = Data >
148 void setParents ( ) {
149 for ( Data & child : m_children )
150 child->parent =
this;
189 if (
this == & other )
192 this->m_children = other.m_children;
206 swap ( this->m_children, other.m_children );
240 return std::move ( m_children );
251 template <
size_t N >
253 return std::get < N > ( m_children );
264 template <
size_t N >
266 return std::get < N > ( m_children );
276 m_children = std::move ( c );
288 template <
size_t N >
290 m_children.
set ( m_children.
cbegin ( ) + N, d );
291 std::get < N > ( m_children )->parent =
this;
302 template <
size_t N >
304 m_children.
set ( m_children.
cbegin ( ) + N, std::move ( d ) );
305 std::get < N > ( m_children )->parent =
this;
315 return m_children.
begin ( );
325 return m_children.
begin ( );
335 return m_children.
end ( );
345 return m_children.
end ( );
357template <
class Data,
class Base = Data >
376template <
class Data,
class Base = Data >
404 return this->
template getChild < 0 > ( );
414 return this->
template getChild < 0 > ( );
430 this->
template setChild < 0 > ( c );
440 this->
template setChild < 0 > ( std::move ( c ) );
458template <
class Data,
class Base = Data >
488 return this->
template getChild < 0 > ( );
498 return this->
template getChild < 0 > ( );
508 this->
template setChild < 0 > ( l );
518 this->
template setChild < 0 > ( std::move ( l ) );
528 return this->
template getChild < 1 > ( );
538 return this->
template getChild < 1 > ( );
548 this->
template setChild < 1 > ( r );
558 this->
template setChild < 1 > ( std::move ( r ) );
570template <
class Data,
class Base = Data >
602 return this->
template getChild < 0 > ( );
612 return this->
template getChild < 0 > ( );
622 this->
template setChild < 0 > ( f );
632 this->
template setChild < 0 > ( std::move ( f ) );
642 return this->
template getChild < 1 > ( );
652 return this->
template getChild < 1 > ( );
662 this->
template setChild < 1 > ( s );
672 this->
template setChild < 1 > ( std::move ( s ) );
682 return this->
template getChild < 2 > ( );
692 return this->
template getChild < 2 > ( );
702 this->
template setChild < 2 > ( t );
712 this->
template setChild < 2 > ( std::move ( t ) );
724template <
class Data,
class Base = Data >
740 for ( Data & child : m_children )
752 template <
typename ... Types >
787 if (
this == & other )
790 this->m_children = other.m_children;
792 for ( Data & child : m_children )
807 swap ( this->m_children, other.m_children );
809 for ( Data & child : m_children )
842 return std::move ( m_children );
852 if ( c.
size ( ) != m_children.
size ( ) )
853 throw "Arity != size";
855 m_children = std::move ( c );
857 for ( Data & child : m_children )
858 child->parent =
this;
870 return m_children [ index ];
882 return m_children [ index ];
892 template <
class PositionIterator >
894 m_children.
set ( it, std::move ( d ) )->parent =
this;
904 template <
class PositionIterator >
905 void setChild (
const Data & d, PositionIterator it ) {
906 m_children.
set ( it, d )->parent =
this;
917 setChild ( d, m_children.
begin ( ) + index );
928 setChild ( std::move ( d ), m_children.
begin ( ) + index );
938 return m_children.
begin ( );
948 return m_children.
begin ( );
958 return m_children.
end ( );
968 return m_children.
end ( );
980template <
class Data,
class Base = Data >
1002 for ( Data & child : m_children )
1003 child.parent =
this;
1037 if (
this == & other )
1040 this->m_children = other.m_children;
1042 for ( Data & child : m_children )
1043 child.parent =
this;
1057 swap ( this->m_children, other.m_children );
1059 for ( Data & child : m_children )
1060 child.parent =
this;
1092 return std::move ( m_children );
1102 m_children = std::move ( c );
1104 for ( Data & child : m_children )
1105 child.parent =
this;
1117 return m_children [ index ];
1129 return m_children [ index ];
1139 template <
class PositionIterator >
1140 void setChild (
const Data & d, PositionIterator it ) {
1141 m_children.
set ( it, d )->parent =
this;
1151 template <
class PositionIterator >
1153 m_children.
set ( it, std::move ( d ) )->parent =
this;
1203 iter->parent =
this;
1233 iter->parent =
this;
1263 iter->parent =
this;
1293 iter->parent =
this;
1310 template <
class InputIterator >
1312 size_t size = std::distance ( first, last );
1316 for (
size_t i = 0;
i < size; ++
i ) {
1317 ( iter +
i )->parent =
this;
1335 template <
class InputIterator >
1352 template <
class InputIterator >
1354 size_t size = std::distance ( first, last );
1358 for (
size_t i = 0;
i < size; ++
i ) {
1359 ( iter +
i )->parent =
this;
1377 template <
class InputIterator >
1403 return m_children.
erase ( it );
1427 return m_children.
erase ( it );
1453 return m_children.
erase ( first, last );
1479 return m_children.
erase ( first, last );
1487 m_children.
clear ( );
1498 m_children [ m_children.
size ( ) - 1].parent =
this;
1508 m_children.
push_back ( std::move ( d ) );
1509 m_children [ m_children.
size ( ) - 1].parent =
this;
1519 return m_children.
begin ( );
1529 return m_children.
begin ( );
1539 return m_children.
rbegin ( );
1549 return m_children.
rbegin ( );
1559 return m_children.
end ( );
1569 return m_children.
end ( );
1579 return m_children.
rend ( );
1589 return m_children.
rend ( );
Tree node with any but fixed number of children.
Definition: tree_base.hpp:137
AnyaryNode & operator=(const AnyaryNode &other)
Copy operator of assignment.
Definition: tree_base.hpp:188
void setChildren(ext::ptr_array< Data, arity > c)
Setter of the child nodes.
Definition: tree_base.hpp:275
ext::ptr_array< Data, arity >::iterator begin()
Getter of an iterator to the begining of children array.
Definition: tree_base.hpp:314
const Data & getChild() const
Getter of the child node based on compile time index.
Definition: tree_base.hpp:252
const ext::ptr_array< Data, arity > & getChildren() &
Getter of the child nodes.
Definition: tree_base.hpp:219
const ext::ptr_array< Data, arity > & getChildren() const &
Getter of the child nodes.
Definition: tree_base.hpp:229
ext::ptr_array< Data, arity >::const_iterator end() const
Getter of an iterator to the end of children array.
Definition: tree_base.hpp:344
ext::ptr_array< Data, arity >::iterator end()
Getter of an iterator to the end of children array.
Definition: tree_base.hpp:334
AnyaryNode(AnyaryNode &&other) noexcept
Move constructor.
Definition: tree_base.hpp:181
Data & getChild()
Getter of the child node based on compile time index.
Definition: tree_base.hpp:265
void setChild(const Data &d)
Setter of the child node based on compile time index.
Definition: tree_base.hpp:289
AnyaryNode(ext::ptr_array< Data, arity > c)
Constructor based on array of child nodes.
Definition: tree_base.hpp:160
ext::ptr_array< Data, arity > && getChildren() &&
Getter of the child nodes.
Definition: tree_base.hpp:239
ext::ptr_array< Data, arity >::const_iterator begin() const
Getter of an iterator to the begining of children array.
Definition: tree_base.hpp:324
void setChild(Data &&d)
Setter of the child node based on compile time index.
Definition: tree_base.hpp:303
~AnyaryNode() noexcept override=default
Destructor of the class.
Base class for hierarchy of tree node types. The tree node types can be used to construct tree struct...
Definition: tree_base.hpp:20
BaseNode & operator=(const BaseNode &)
Copy assignment does not change the parent pointer.
Definition: tree_base.hpp:94
const Data * getParent() const
Getter of the parent of the node.
Definition: tree_base.hpp:122
Data * getParent()
Getter of the parent of the node.
Definition: tree_base.hpp:112
BaseNode(BaseNode &&) noexcept
Move construction does not copy the parent pointer.
Definition: tree_base.hpp:87
BaseNode()
Constructor of the tree hierarchy base class.
Definition: tree_base.hpp:67
virtual ~BaseNode() noexcept=default
Destructor of the tree hierarchy base class.
Binary node is specialisation of Anyary node to two children.
Definition: tree_base.hpp:459
void setLeft(Data &&l)
Setter of the first child of the node.
Definition: tree_base.hpp:517
void setRight(Data &&r)
Setter of the second child of the node.
Definition: tree_base.hpp:557
void setRight(const Data &r)
Setter of the second child of the node.
Definition: tree_base.hpp:547
const Data & getLeft() const
Getter of the first child of the node.
Definition: tree_base.hpp:497
BinaryNode(const Data &l, const Data &r)
Constructor of the class accepting the two child nodes.
Definition: tree_base.hpp:468
Data & getLeft()
Getter of the first child of the node.
Definition: tree_base.hpp:487
Data & getRight()
Getter of the second child of the node.
Definition: tree_base.hpp:527
const Data & getRight() const
Getter of the second child of the node.
Definition: tree_base.hpp:537
BinaryNode(Data &&l, Data &&r)
Constructor of the class accepting the two child nodes.
Definition: tree_base.hpp:478
void setLeft(const Data &l)
Setter of the first child of the node.
Definition: tree_base.hpp:507
Fixedary node is tree node that when initialized does not permit change of the number of its children...
Definition: tree_base.hpp:725
const ext::ptr_vector< Data > & getChildren() &
Getter of the vector of children.
Definition: tree_base.hpp:821
FixedaryNode(ext::ptr_vector< Data > c)
Constructor of the node from vector of children.
Definition: tree_base.hpp:739
ext::ptr_vector< Data > && getChildren() &&
Getter of the child nodes.
Definition: tree_base.hpp:841
FixedaryNode(Types &&... data)
Constructor of the node from pack of children.
Definition: tree_base.hpp:753
void setChildren(ext::ptr_vector< Data > c)
Setter of the vector of children.
Definition: tree_base.hpp:851
ext::ptr_vector< Data >::iterator end()
Getter of an iterator to the end of children vector.
Definition: tree_base.hpp:957
void setChild(Data &&d, size_t index)
Setter of the single child of the node.
Definition: tree_base.hpp:927
ext::ptr_vector< Data >::iterator begin()
Getter of an iterator to the begining of children vector.
Definition: tree_base.hpp:937
void setChild(const Data &d, size_t index)
Setter of the single child of the node.
Definition: tree_base.hpp:916
void setChild(Data &&d, PositionIterator it)
Setter of the single child of the node.
Definition: tree_base.hpp:893
FixedaryNode(FixedaryNode &&other) noexcept
Move constructor of the class.
Definition: tree_base.hpp:777
ext::ptr_vector< Data >::const_iterator end() const
Getter of an iterator to the end of children vector.
Definition: tree_base.hpp:967
Data & getChild(size_t index)
Getter of the child at given index.
Definition: tree_base.hpp:869
const Data & getChild(size_t index) const
Getter of the child at given index.
Definition: tree_base.hpp:881
~FixedaryNode() noexcept override=default
Destructor of the class.
ext::ptr_vector< Data >::const_iterator begin() const
Getter of an iterator to the begining of children vector.
Definition: tree_base.hpp:947
const ext::ptr_vector< Data > & getChildren() const &
Getter of the vector of children.
Definition: tree_base.hpp:831
void setChild(const Data &d, PositionIterator it)
Setter of the single child of the node.
Definition: tree_base.hpp:905
Nullary node is specialisation of Anyary node to no children.
Definition: tree_base.hpp:358
NullaryNode()
The default constructor of the class.
Definition: tree_base.hpp:364
Ternany node is specialisation of Anyary node to three children.
Definition: tree_base.hpp:571
Data & getFirst()
Getter of the first child of the node.
Definition: tree_base.hpp:601
TernaryNode(Data &&f, Data &&s, Data &&t)
Constructor of the class accepting the three child nodes.
Definition: tree_base.hpp:592
void setSecond(Data &&s)
Setter of the second child of the node.
Definition: tree_base.hpp:671
void setFirst(Data &&f)
Setter of the first child of the node.
Definition: tree_base.hpp:631
void setThird(Data &&t)
Setter of the third child of the node.
Definition: tree_base.hpp:711
const Data & getFirst() const
Getter of the first child of the node.
Definition: tree_base.hpp:611
const Data & getSecond() const
Getter of the second child of the node.
Definition: tree_base.hpp:651
void setFirst(const Data &f)
Setter of the first child of the node.
Definition: tree_base.hpp:621
TernaryNode(const Data &f, const Data &s, const Data &t)
Constructor of the class accepting the three child nodes.
Definition: tree_base.hpp:581
const Data & getThird() const
Getter of the third child of the node.
Definition: tree_base.hpp:691
Data & getSecond()
Getter of the second child of the node.
Definition: tree_base.hpp:641
void setThird(const Data &t)
Setter of the third child of the node.
Definition: tree_base.hpp:701
void setSecond(const Data &s)
Setter of the second child of the node.
Definition: tree_base.hpp:661
Data & getThird()
Getter of the third child of the node.
Definition: tree_base.hpp:681
Unary node is specialisation of Anyary node to one child.
Definition: tree_base.hpp:377
UnaryNode(Data &&c)
Constructor of the class accepting the child node.
Definition: tree_base.hpp:394
Data & getChild()
Getter of the child of the node.
Definition: tree_base.hpp:403
void setChild(const Data &c)
Setter of the child of the node.
Definition: tree_base.hpp:429
const Data & getChild() const
Getter of the child of the node.
Definition: tree_base.hpp:413
void setChild(Data &&c)
Setter of the child of the node.
Definition: tree_base.hpp:439
UnaryNode(const Data &c)
Constructor of the class accepting the child node.
Definition: tree_base.hpp:385
Varary node is tree node that can hold any number of children.
Definition: tree_base.hpp:981
void pushBackChild(const Data &d)
Appends a new child at the end of the child vector.
Definition: tree_base.hpp:1496
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.
Definition: tree_base.hpp:1353
const ext::ptr_vector< Data > & getChildren() const &
Getter of the vector of children.
Definition: tree_base.hpp:1081
ext::ptr_vector< Data >::const_reverse_iterator rend() const
Getter of an iterator to the end of children vector.
Definition: tree_base.hpp:1588
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.
Definition: tree_base.hpp:1200
VararyNode(ext::ptr_vector< Data > c)
Constructor from vector of child nodes.
Definition: tree_base.hpp:1001
void pushBackChild(Data &&d)
Appends a new child at the end of the child vector.
Definition: tree_base.hpp:1507
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.
Definition: tree_base.hpp:1452
VararyNode()=default
Default constructor. Sets the vector of children to empty vector.
ext::ptr_vector< Data >::const_iterator end() const
Getter of an iterator to the end of children vector.
Definition: tree_base.hpp:1568
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.
Definition: tree_base.hpp:1465
ext::ptr_vector< Data >::const_reverse_iterator rbegin() const
Getter of an iterator to the begining of children vector.
Definition: tree_base.hpp:1548
VararyNode & operator=(const VararyNode &other)
Copy operator of assignment.
Definition: tree_base.hpp:1036
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.
Definition: tree_base.hpp:1230
ext::ptr_vector< Data >::reverse_iterator erase(typename ext::ptr_vector< Data >::reverse_iterator it)
Erases a child specified by an iterator.
Definition: tree_base.hpp:1390
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.
Definition: tree_base.hpp:1187
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.
Definition: tree_base.hpp:1247
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.
Definition: tree_base.hpp:1290
void setChild(const Data &d, size_t index)
Setter of the single child of the node.
Definition: tree_base.hpp:1163
~VararyNode() noexcept override=default
Destructor of the class.
ext::ptr_vector< Data > && getChildren() &&
Getter of the child nodes.
Definition: tree_base.hpp:1091
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.
Definition: tree_base.hpp:1378
ext::ptr_vector< Data >::iterator end()
Getter of an iterator to the end of children vector.
Definition: tree_base.hpp:1558
ext::ptr_vector< Data >::reverse_iterator rbegin()
Getter of an iterator to the begining of children vector.
Definition: tree_base.hpp:1538
void setChildren(ext::ptr_vector< Data > c)
Setter of the vector of children.
Definition: tree_base.hpp:1101
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.
Definition: tree_base.hpp:1336
const ext::ptr_vector< Data > & getChildren() &
Getter of the vector of children.
Definition: tree_base.hpp:1071
const Data & getChild(size_t index) const
Getter of the child at given index.
Definition: tree_base.hpp:1128
ext::ptr_vector< Data >::reverse_iterator rend()
Getter of an iterator to the end of children vector.
Definition: tree_base.hpp:1578
ext::ptr_vector< Data >::const_iterator begin() const
Getter of an iterator to the begining of children vector.
Definition: tree_base.hpp:1528
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.
Definition: tree_base.hpp:1311
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.
Definition: tree_base.hpp:1478
ext::ptr_vector< Data >::iterator insert(typename ext::ptr_vector< Data >::iterator it, Data &&d)
Inserts a new child at position specified by iterator.
Definition: tree_base.hpp:1277
ext::ptr_vector< Data >::reverse_iterator erase(typename ext::ptr_vector< Data >::const_reverse_iterator it)
Erases a child specified by an iterator.
Definition: tree_base.hpp:1402
void setChild(Data &&d, PositionIterator it)
Setter of the single child of the node.
Definition: tree_base.hpp:1152
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.
Definition: tree_base.hpp:1217
void clear()
Erases all children.
Definition: tree_base.hpp:1486
Data & getChild(size_t index)
Getter of the child at given index.
Definition: tree_base.hpp:1116
ext::ptr_vector< Data >::iterator erase(typename ext::ptr_vector< Data >::iterator it)
Erases a child specified by an iterator.
Definition: tree_base.hpp:1414
void setChild(const Data &d, PositionIterator it)
Setter of the single child of the node.
Definition: tree_base.hpp:1140
void setChild(Data &&d, size_t index)
Setter of the single child of the node.
Definition: tree_base.hpp:1174
VararyNode(VararyNode &&other) noexcept
Move constructor of the class.
Definition: tree_base.hpp:1027
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.
Definition: tree_base.hpp:1439
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.
Definition: tree_base.hpp:1260
ext::ptr_vector< Data >::iterator begin()
Getter of an iterator to the begining of children vector.
Definition: tree_base.hpp:1518
ext::ptr_vector< Data >::iterator erase(typename ext::ptr_vector< Data >::const_iterator it)
Erases a child specified by an iterator.
Definition: tree_base.hpp:1426
Adaptor iterator to additionally call second dereference on the iterator dereference result.
Definition: iterator.hpp:556
Implementation of array storing dynamicaly allocated instances of given type. The class mimicks the i...
Definition: ptr_array.hpp:45
iterator set(const_iterator pos, R &&value)
Setter of value in the array on position specified by iterator specified by pos. The value is cloned ...
Definition: ptr_array.hpp:540
iterator begin() &noexcept
Iterator to the begining of the values range in the array.
Definition: ptr_array.hpp:328
iterator end() &noexcept
Iterator one past the last element of the values range in the array.
Definition: ptr_array.hpp:368
const_iterator cbegin() const noexcept
Iterator to the begining of the values range in the array.
Definition: ptr_array.hpp:358
size_type size() const noexcept
Getter of the array size.
Definition: ptr_array.hpp:514
Implementation of vector storing dynamicaly allocated instances of given type. The class mimicks the ...
Definition: ptr_vector.hpp:44
iterator end() &noexcept
Iterator one past the last element of the values range in the vector.
Definition: ptr_vector.hpp:422
void push_back(R &&value)
Appends a new value at the end of the container.
Definition: ptr_vector.hpp:1228
reverse_iterator rend() noexcept
Reverse iterator one past the last element of the reversed range of values in the vector.
Definition: ptr_vector.hpp:492
iterator begin() &noexcept
Iterator to the begining of the values range in the vector.
Definition: ptr_vector.hpp:382
reverse_iterator rbegin() noexcept
Reverse iterator to the begining of the reversed range of values in the vector.
Definition: ptr_vector.hpp:462
size_type size() const noexcept
Getter of the vector size.
Definition: ptr_vector.hpp:568
iterator erase(iterator pos)
Removes element from the container at position given by parameter pos.
Definition: ptr_vector.hpp:1119
void clear() noexcept
Removes all values from the vector.
Definition: ptr_vector.hpp:614
iterator set(iterator pos, R &&value)
Changes the value on position given by iterator pos.
Definition: ptr_vector.hpp:633
iterator insert(iterator pos, R &&value)
Inserts the value on position given by iterator pos.
Definition: ptr_vector.hpp:775
int i
Definition: AllEpsilonClosure.h:118
Definition: sigHandler.cpp:20
constexpr ptr_array< typename std::remove_reference< Base >::type, sizeof ...(Types)+1 > make_ptr_array(Base &&first, Types &&... other)
Array construction helper. Array is constructed from provided values, type of stored elements is dedu...
Definition: ptr_array.hpp:775
void swap(ext::linear_set< T, Compare, Alloc > &x, ext::linear_set< T, Compare, Alloc > &y)
Specialisation of swap for linear set.
Definition: linear_set.hpp:846
Definition: FordFulkerson.hpp:16
void swap(ext::managed_linear_set< T, Compare, Alloc > &x, ext::managed_linear_set< T, Compare, Alloc > &y)
Specialisation of swap for linear set.
Definition: managed_linear_set.hpp:864