ROSE  0.11.125.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::Tree::List< T > Class Template Reference

Description

template<class T>
class Rose::Tree::List< T >

Tree vertex that points to an ordered sequence of indexable children.

This vertex acts like an std::vector except that inserting and erasing children also adjusts the child's parent pointer.

Definition at line 12 of file List.h.

#include <Rose/Tree/List.h>

Inheritance diagram for Rose::Tree::List< T >:
Inheritance graph
[legend]
Collaboration diagram for Rose::Tree::List< T >:
Collaboration graph
[legend]

Classes

class  iterator
 Random access iterator to non-const edges. More...
 

Public Types

using Ptr = std::shared_ptr< List >
 Shared-ownership pointer to nodes of this type. More...
 
using Child = T
 Type of child. More...
 
using ChildPtr = std::shared_ptr< T >
 Type of child pointer. More...
 
using value_type = Edge< T >
 Type of values stored in this class. More...
 
using size_type = typename EdgeVector::size_type
 Size type. More...
 
using difference_type = typename EdgeVector::difference_type
 Distance between elements. More...
 
using reference = value_type &
 Reference to value. More...
 
using const_reference = const value_type &
 Reference to cons value. More...
 
using pointer = value_type *
 Pointer to value. More...
 
using const_pointer = const value_type *
 Pointer to const value. More...
 
- Public Types inherited from Rose::Tree::Base
enum  Traversal {
  Traversal::ENTER,
  Traversal::LEAVE
}
 Traversal direction. More...
 
using Ptr = BasePtr
 Shared-ownership pointer to a Base. More...
 

Public Member Functions

bool empty () const
 Test whether vector is empty. More...
 
size_t size () const
 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...
 
Edge< T > & push_back (const std::shared_ptr< T > &elmt)
 Insert a child pointer at the end of this node. More...
 
BasePtr pop_back ()
 Erase a child edge from the end of this node. More...
 
iterator begin ()
 Return an iterator pointing to the first edge. More...
 
iterator end ()
 Return an iterator pointing to one past the last edge. More...
 
Edge< T > & front ()
 Return a reference to the first edge. More...
 
Edge< T > & back ()
 Return a reference to the last edge. More...
 
const Edge< T > & operator[] (size_t i) const
 Return a reference to the Ith edge.
 
Edge< T > & operator[] (size_t i)
 Return a reference to the Ith edge.
 
const Edge< T > & at (size_t i) const
 Return a reference to the Ith edge.
 
Edge< T > & at (size_t i)
 Return a reference to the Ith edge.
 
- Public Member Functions inherited from Rose::Tree::Base
Ptr pointer ()
 Returns a shared pointer to this vertex. More...
 
template<class Visitor >
auto traverseReverse (const Visitor &visitor)
 Traverse in reverse direction from children to parents. More...
 
template<class Visitor >
auto traverse (const Visitor &visitor)
 Traverse in forward direction from parents to children. More...
 
template<class T >
std::shared_ptr< T > findAncestor ()
 Traversal that finds an ancestor of a particular type. More...
 
template<class T >
std::vector< std::shared_ptr< T > > findDescendants ()
 Traversal that finds all the descendants of a particular type. More...
 
std::string childName (size_t i)
 Returns the property name for a child. More...
 
Ptr child (size_t i)
 Returns the pointer for a child. More...
 
size_t nChildren (size_t i)
 Returns the number of children. More...
 

Static Public Member Functions

static std::shared_ptr< Listinstance ()
 Allocating constructor. More...
 

Protected Member Functions

virtual ChildDescriptor findChild (size_t i) const override
 Finds information about an indexed child. More...
 
- Protected Member Functions inherited from Rose::Tree::Base
virtual void destructorHelper ()
 

Additional Inherited Members

- Public Attributes inherited from Rose::Tree::Base
ReverseEdge parent
 Pointer to the parent in the tree. More...
 

Member Typedef Documentation

template<class T >
using Rose::Tree::List< T >::Ptr = std::shared_ptr<List>

Shared-ownership pointer to nodes of this type.

Definition at line 18 of file List.h.

template<class T >
using Rose::Tree::List< T >::Child = T

Type of child.

Definition at line 21 of file List.h.

template<class T >
using Rose::Tree::List< T >::ChildPtr = std::shared_ptr<T>

Type of child pointer.

Definition at line 24 of file List.h.

template<class T >
using Rose::Tree::List< T >::value_type = Edge<T>

Type of values stored in this class.

Definition at line 27 of file List.h.

template<class T >
using Rose::Tree::List< T >::size_type = typename EdgeVector::size_type

Size type.

Definition at line 28 of file List.h.

template<class T >
using Rose::Tree::List< T >::difference_type = typename EdgeVector::difference_type

Distance between elements.

Definition at line 29 of file List.h.

template<class T >
using Rose::Tree::List< T >::reference = value_type&

Reference to value.

Definition at line 30 of file List.h.

template<class T >
using Rose::Tree::List< T >::const_reference = const value_type&

Reference to cons value.

Definition at line 31 of file List.h.

template<class T >
using Rose::Tree::List< T >::pointer = value_type*

Pointer to value.

Definition at line 32 of file List.h.

template<class T >
using Rose::Tree::List< T >::const_pointer = const value_type*

Pointer to const value.

Definition at line 33 of file List.h.

Member Function Documentation

template<class T >
static std::shared_ptr<List> Rose::Tree::List< T >::instance ( )
inlinestatic

Allocating constructor.

Constructs a new node that has no children.

Definition at line 168 of file List.h.

template<class T >
bool Rose::Tree::List< T >::empty ( ) const
inline

Test whether vector is empty.

Returns true if this node contains no child edges, null or otherwise.

Definition at line 175 of file List.h.

template<class T >
size_t Rose::Tree::List< T >::size ( ) const
inline

Number of child edges.

Returns the number of children edges, null or otherwise.

Definition at line 182 of file List.h.

template<class T >
void Rose::Tree::List< T >::reserve ( size_t  n)
inline

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

Definition at line 187 of file List.h.

template<class T >
size_t Rose::Tree::List< T >::capacity ( ) const
inline

Reserved capacity.

Definition at line 192 of file List.h.

template<class T >
Edge<T>& Rose::Tree::List< T >::push_back ( const std::shared_ptr< T > &  elmt)
inline

Insert a child pointer at the end of this node.

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

Definition at line 200 of file List.h.

template<class T >
BasePtr Rose::Tree::List< T >::pop_back ( )
inline

Erase a child edge from the end of this node.

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

Definition at line 208 of file List.h.

template<class T >
iterator Rose::Tree::List< T >::begin ( )
inline

Return an iterator pointing to the first edge.

Definition at line 233 of file List.h.

template<class T >
iterator Rose::Tree::List< T >::end ( )
inline

Return an iterator pointing to one past the last edge.

Definition at line 238 of file List.h.

template<class T >
Edge<T>& Rose::Tree::List< T >::front ( )
inline

Return a reference to the first edge.

Definition at line 243 of file List.h.

template<class T >
Edge<T>& Rose::Tree::List< T >::back ( )
inline

Return a reference to the last edge.

Definition at line 249 of file List.h.

template<class T >
virtual ChildDescriptor Rose::Tree::List< T >::findChild ( size_t  i) const
inlineoverrideprotectedvirtual

Finds information about an indexed child.

The index, i, specifies the child about which information is returned. Children are numbered recursively in base classes followed by the current class. This function is re-implemented in every derived class that has children.

A ChildDescriptor is returned for every query. If the index is out of range for the class, then the return value is for a child one past the end. I.e., the index is equal to the number of children, the name is empty, and the value is a null pointer.

Reimplemented from Rose::Tree::Base.

Definition at line 255 of file List.h.


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