ROSE 0.11.145.147
|
A 1:N tree edge from parent to children.
This edge type points to a variable number of children and acts like an std::vector
.
#include <Sawyer/Tree.h>
Classes | |
class | Iterator |
Public Types | |
using | Child = T |
Type of children being pointed to. | |
using | ChildPtr = std::shared_ptr< Child > |
Type of pointers to children. | |
using | value_type = Edge< Child > |
using | size_type = typename Vector::size_type |
using | difference_type = typename Vector::difference_type |
using | reference = value_type & |
using | const_reference = const value_type & |
using | iterator = Iterator< typename Vector::iterator > |
Public Member Functions | |
~EdgeVector () | |
Destructor clears children's parents. | |
EdgeVector (UserBase &parent) | |
Construct a child edge that belongs to the specified parent. | |
bool | empty () const |
Test whether vector is empty. | |
size_t | size () const override |
Number of child edges. | |
void | reserve (size_t n) |
Reserve space so the child edge vector can grow without being reallocated. | |
size_t | capacity () const |
Reserved capacity. | |
void | push_back (const ChildPtr &elmt) |
Insert a child pointer at the end of this vertex. | |
void | pop_back () |
Erase a child edge from the end of this vertex. | |
iterator | begin () |
Return an iterator to the first edge. | |
iterator | end () |
Return an iterator to one past the last edge. | |
boost::signals2::connection | beforeResize (const typename ResizeSignal::slot_type &slot) |
Functors to call before the vector size is changed. | |
boost::signals2::connection | afterResize (const typename ResizeSignal::slot_type &slot) |
Functors to call after the vector size is changed. | |
const Edge< Child > & | at (size_t i) const |
Return the i'th edge. | |
Edge< Child > & | at (size_t i) |
Return the i'th edge. | |
const Edge< Child > & | operator[] (size_t i) const |
Return the i'th edge. | |
Edge< Child > & | operator[] (size_t i) |
Return the i'th edge. | |
const Edge< Child > & | front () const |
Return the first edge. | |
Edge< Child > & | front () |
Return the first edge. | |
const Edge< Child > & | back () const |
Return the last edge. | |
Edge< Child > & | back () |
Return the last edge. | |
Protected Member Functions | |
UserBasePtr | pointer (size_t i) const override |
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::ChildPtr = std::shared_ptr<Child> |
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::value_type = Edge<Child> |
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::size_type = typename Vector::size_type |
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::difference_type = typename Vector::difference_type |
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::reference = value_type& |
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::const_reference = const value_type& |
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::iterator = Iterator<typename Vector::iterator> |
|
inline |
|
explicit |
Construct a child edge that belongs to the specified parent.
When constructing a class containing a data member of this type (i.e., a tree edge that points to a child of this vertex), the data member must be initialized by passing *this
as the argument. See the example in this class documentation.
|
inline |
Test whether vector is empty.
Returns true if this vertex contains no child edges, null or otherwise.
Definition at line 726 of file Tree.h.
Referenced by Sawyer::Tree::Vertex< B >::EdgeVector< T >::back(), Sawyer::Tree::Vertex< B >::EdgeVector< T >::back(), Sawyer::Tree::Vertex< B >::EdgeVector< T >::front(), and Sawyer::Tree::Vertex< B >::EdgeVector< T >::front().
|
inlineoverride |
Number of child edges.
Returns the number of children edges, null or otherwise.
Definition at line 733 of file Tree.h.
Referenced by Sawyer::Tree::Vertex< B >::EdgeVector< T >::back(), and Sawyer::Tree::Vertex< B >::EdgeVector< T >::back().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return the i'th edge.
Definition at line 772 of file Tree.h.
Referenced by Sawyer::Tree::Vertex< B >::EdgeVector< T >::back(), Sawyer::Tree::Vertex< B >::EdgeVector< T >::back(), Sawyer::Tree::Vertex< B >::EdgeVector< T >::front(), Sawyer::Tree::Vertex< B >::EdgeVector< T >::front(), Sawyer::Tree::Vertex< B >::EdgeVector< T >::operator[](), and Sawyer::Tree::Vertex< B >::EdgeVector< T >::operator[]().
|
inline |
|
inline |
Return the i'th edge.
Definition at line 780 of file Tree.h.
References Sawyer::Tree::Vertex< B >::EdgeVector< T >::at().
|
inline |
Return the i'th edge.
Definition at line 783 of file Tree.h.
References Sawyer::Tree::Vertex< B >::EdgeVector< T >::at().
|
inline |
Return the first edge.
Definition at line 791 of file Tree.h.
References Sawyer::Tree::Vertex< B >::EdgeVector< T >::at(), and Sawyer::Tree::Vertex< B >::EdgeVector< T >::empty().
|
inline |
Return the first edge.
Definition at line 795 of file Tree.h.
References Sawyer::Tree::Vertex< B >::EdgeVector< T >::at(), and Sawyer::Tree::Vertex< B >::EdgeVector< T >::empty().
|
inline |
Return the last edge.
Definition at line 804 of file Tree.h.
References Sawyer::Tree::Vertex< B >::EdgeVector< T >::at(), Sawyer::Tree::Vertex< B >::EdgeVector< T >::empty(), and Sawyer::Tree::Vertex< B >::EdgeVector< T >::size().
|
inline |
Return the last edge.
Definition at line 808 of file Tree.h.
References Sawyer::Tree::Vertex< B >::EdgeVector< T >::at(), Sawyer::Tree::Vertex< B >::EdgeVector< T >::empty(), and Sawyer::Tree::Vertex< B >::EdgeVector< T >::size().
|
inline |
|
inline |
|
inline |
Functors to call before the vector size is changed.
The first argument is the change in size of the vector (1 for a push_back call, or -1 for a pop_back call), and the second argument is the pointer being pushed or popped. If any of the callbacks throw an exception then the push or pop operation is aborted without making any changes.
|
inline |
Functors to call after the vector size is changed.
The first argument is the change in size of the vector (1 for a push_back call, or -1 for a pop_back call), and the second argument is the pointer being pushed or popped. Since these callbacks occur after the push or pop operation, they do not affect its behavior.
|
inlineoverrideprotected |