ROSE  0.11.145.0
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 128 of file Tree.h.

#include <util/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. More...
 
using ChildPtr = std::shared_ptr< Child >
 Type of pointers to children. More...
 
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. More...
 
 EdgeVector (UserBase &parent)
 Construct a child edge that belongs to the specified parent. More...
 
bool empty () const
 Test whether vector is empty. More...
 
size_t size () const override
 Number of child edges. More...
 
void reserve (size_t n)
 Reserve space so the child edge vector can grow without being reallocated. More...
 
size_t capacity () const
 Reserved capacity. More...
 
void push_back (const ChildPtr &elmt)
 Insert a child pointer at the end of this vertex. More...
 
void pop_back ()
 Erase a child edge from the end of this vertex. More...
 
iterator begin ()
 Return an iterator to the first edge. More...
 
iterator end ()
 Return an iterator to one past the last edge. More...
 
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

Vertexpointer (size_t i) const override
 

Member Typedef Documentation

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

Type of children being pointed to.

Definition at line 444 of file Tree.h.

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 447 of file Tree.h.

Constructor & Destructor Documentation

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

Destructor clears children's parents.

Definition at line 574 of file Tree.h.

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 1066 of file Tree.h.

Member Function Documentation

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 587 of file Tree.h.

Referenced by Sawyer::Tree::Vertex< B >::EdgeVector< T >::back(), and Sawyer::Tree::Vertex< B >::EdgeVector< T >::front().

template<class B>
template<class T >
size_t Sawyer::Tree::Vertex< B >::EdgeVector< T >::size ( void  ) const
inlineoverride

Number of child edges.

Returns the number of children edges, null or otherwise.

Definition at line 594 of file Tree.h.

Referenced by Sawyer::Tree::Vertex< B >::EdgeVector< T >::back().

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 599 of file Tree.h.

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

Reserved capacity.

Definition at line 604 of file Tree.h.

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 612 of file Tree.h.

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 620 of file Tree.h.

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 671 of file Tree.h.

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 676 of file Tree.h.


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