ROSE
0.11.125.0
|
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.
#include <Rose/Tree/List.h>
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... | |
![]() | |
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. | |
![]() | |
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< List > | instance () |
Allocating constructor. More... | |
Protected Member Functions | |
virtual ChildDescriptor | findChild (size_t i) const override |
Finds information about an indexed child. More... | |
![]() | |
virtual void | destructorHelper () |
Additional Inherited Members | |
![]() | |
ReverseEdge | parent |
Pointer to the parent in the tree. More... | |
using Rose::Tree::List< T >::Ptr = std::shared_ptr<List> |
using Rose::Tree::List< T >::Child = T |
using Rose::Tree::List< T >::ChildPtr = std::shared_ptr<T> |
using Rose::Tree::List< T >::value_type = Edge<T> |
using Rose::Tree::List< T >::size_type = typename EdgeVector::size_type |
using Rose::Tree::List< T >::difference_type = typename EdgeVector::difference_type |
using Rose::Tree::List< T >::reference = value_type& |
using Rose::Tree::List< T >::const_reference = const value_type& |
using Rose::Tree::List< T >::pointer = value_type* |
using Rose::Tree::List< T >::const_pointer = const value_type* |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
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.