ROSE 0.11.145.147
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
Sawyer::Tree::Vertex< B >::EdgeVector< T > Class Template Reference

Description

template<class B>
template<class T>
class Sawyer::Tree::Vertex< B >::EdgeVector< T >

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.

Definition at line 524 of file Tree.h.

#include <Sawyer/Tree.h>

Inheritance diagram for Sawyer::Tree::Vertex< B >::EdgeVector< T >:
Inheritance graph
[legend]
Collaboration diagram for Sawyer::Tree::Vertex< B >::EdgeVector< T >:
Collaboration graph
[legend]

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
 

Member Typedef Documentation

◆ Child

template<class B >
template<class T >
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::Child = T

Type of children being pointed to.

Definition at line 527 of file Tree.h.

◆ ChildPtr

template<class B >
template<class T >
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::ChildPtr = std::shared_ptr<Child>

Type of pointers to children.

Definition at line 530 of file Tree.h.

◆ value_type

template<class B >
template<class T >
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::value_type = Edge<Child>

Definition at line 537 of file Tree.h.

◆ size_type

template<class B >
template<class T >
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::size_type = typename Vector::size_type

Definition at line 538 of file Tree.h.

◆ difference_type

template<class B >
template<class T >
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::difference_type = typename Vector::difference_type

Definition at line 539 of file Tree.h.

◆ reference

template<class B >
template<class T >
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::reference = value_type&

Definition at line 540 of file Tree.h.

◆ const_reference

template<class B >
template<class T >
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::const_reference = const value_type&

Definition at line 541 of file Tree.h.

◆ iterator

template<class B >
template<class T >
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::iterator = Iterator<typename Vector::iterator>

Definition at line 650 of file Tree.h.

Constructor & Destructor Documentation

◆ ~EdgeVector()

template<class B >
template<class T >
Sawyer::Tree::Vertex< B >::EdgeVector< T >::~EdgeVector ( )
inline

Destructor clears children's parents.

Definition at line 713 of file Tree.h.

◆ EdgeVector()

template<class B >
template<class T >
Sawyer::Tree::Vertex< B >::EdgeVector< T >::EdgeVector ( UserBase parent)
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.

Definition at line 1316 of file Tree.h.

Member Function Documentation

◆ empty()

template<class B >
template<class T >
bool Sawyer::Tree::Vertex< B >::EdgeVector< T >::empty ( ) const
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().

◆ size()

template<class B >
template<class T >
size_t Sawyer::Tree::Vertex< B >::EdgeVector< T >::size ( ) const
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().

◆ reserve()

template<class B >
template<class T >
void Sawyer::Tree::Vertex< B >::EdgeVector< T >::reserve ( size_t  n)
inline

Reserve space so the child edge vector can grow without being reallocated.

Definition at line 738 of file Tree.h.

◆ capacity()

template<class B >
template<class T >
size_t Sawyer::Tree::Vertex< B >::EdgeVector< T >::capacity ( ) const
inline

Reserved capacity.

Definition at line 743 of file Tree.h.

◆ push_back()

template<class B >
template<class T >
void Sawyer::Tree::Vertex< B >::EdgeVector< T >::push_back ( const ChildPtr elmt)
inline

Insert a child pointer at the end of this vertex.

If the new element is non-null, then it must satisfy all the requirements for inserting a vertex as a child of another vertex, and its parent pointer will be adjusted automatically.

Definition at line 751 of file Tree.h.

◆ pop_back()

template<class B >
template<class T >
void Sawyer::Tree::Vertex< B >::EdgeVector< T >::pop_back ( )
inline

Erase a child edge from the end of this vertex.

If the edge being erased points to a child, then that child's parent pointer is reset.

Definition at line 761 of file Tree.h.

◆ at() [1/2]

template<class B >
template<class T >
const Edge< Child > & Sawyer::Tree::Vertex< B >::EdgeVector< T >::at ( size_t  i) const
inline

◆ at() [2/2]

template<class B >
template<class T >
Edge< Child > & Sawyer::Tree::Vertex< B >::EdgeVector< T >::at ( size_t  i)
inline

Return the i'th edge.

Definition at line 776 of file Tree.h.

◆ operator[]() [1/2]

template<class B >
template<class T >
const Edge< Child > & Sawyer::Tree::Vertex< B >::EdgeVector< T >::operator[] ( size_t  i) const
inline

Return the i'th edge.

Definition at line 780 of file Tree.h.

References Sawyer::Tree::Vertex< B >::EdgeVector< T >::at().

◆ operator[]() [2/2]

template<class B >
template<class T >
Edge< Child > & Sawyer::Tree::Vertex< B >::EdgeVector< T >::operator[] ( size_t  i)
inline

Return the i'th edge.

Definition at line 783 of file Tree.h.

References Sawyer::Tree::Vertex< B >::EdgeVector< T >::at().

◆ front() [1/2]

template<class B >
template<class T >
const Edge< Child > & Sawyer::Tree::Vertex< B >::EdgeVector< T >::front ( ) const
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().

◆ front() [2/2]

template<class B >
template<class T >
Edge< Child > & Sawyer::Tree::Vertex< B >::EdgeVector< T >::front ( )
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().

◆ back() [1/2]

template<class B >
template<class T >
const Edge< Child > & Sawyer::Tree::Vertex< B >::EdgeVector< T >::back ( ) const
inline

◆ back() [2/2]

template<class B >
template<class T >
Edge< Child > & Sawyer::Tree::Vertex< B >::EdgeVector< T >::back ( )
inline

◆ begin()

template<class B >
template<class T >
iterator Sawyer::Tree::Vertex< B >::EdgeVector< T >::begin ( )
inline

Return an iterator to the first edge.

Definition at line 815 of file Tree.h.

◆ end()

template<class B >
template<class T >
iterator Sawyer::Tree::Vertex< B >::EdgeVector< T >::end ( )
inline

Return an iterator to one past the last edge.

Definition at line 820 of file Tree.h.

◆ beforeResize()

template<class B >
template<class T >
boost::signals2::connection Sawyer::Tree::Vertex< B >::EdgeVector< T >::beforeResize ( const typename ResizeSignal::slot_type &  slot)
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.

Definition at line 829 of file Tree.h.

◆ afterResize()

template<class B >
template<class T >
boost::signals2::connection Sawyer::Tree::Vertex< B >::EdgeVector< T >::afterResize ( const typename ResizeSignal::slot_type &  slot)
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.

Definition at line 838 of file Tree.h.

◆ pointer()

template<class B >
template<class T >
UserBasePtr Sawyer::Tree::Vertex< B >::EdgeVector< T >::pointer ( size_t  i) const
inlineoverrideprotected

Definition at line 843 of file Tree.h.


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