Graph: Generic attributed relational graphs


BaseTree Class Reference

BaseTree element. More...

#include <graph/tree/base.h>

Inheritance diagram for BaseTree:

Public Types

typedef std::list< BaseTree * >
::iterator 
iterator
 
typedef std::list< BaseTree * >
::const_iterator 
const_iterator
 
typedef std::list< BaseTree * >
::reverse_iterator 
reverse_iterator
 
typedef std::list< BaseTree * >
::const_reverse_iterator 
const_reverse_iterator
 

Public Member Functions

 BaseTree (bool allowsChildren=true)
 Constructor. More...
 
virtual ~BaseTree ()
 
const std::list< BaseTree * > & children () const
 
bool getAllowsChildren () const
 Returns true if the receiver allows children. More...
 
BaseTreegetChildAt (unsigned childIndex) const
 Returns the child BaseTree pointer at index childIndex. More...
 
int getIndex (BaseTree *node) const
 Returns the index of node in the receivers children. More...
 
BaseTreegetParent () const
 Returns the parent BaseTree of the receiver. More...
 
BaseTreegetTopParent ()
 Returns the top-level parent BaseTree of the receiver. More...
 
const BaseTreegetTopParent () const
 Returns the top-level parent of the receiver (const version) More...
 
bool isLeaf () const
 Returns true if the receiver is a leaf (terminal node) More...
 
void insert (BaseTree *child, int index=-1)
 Adds child to the receiver at index (default: end) More...
 
void remove (unsigned index)
 Removes the child at index index from the receiver. More...
 
void remove (BaseTree *node)
 Removes node from the receiver. More...
 
void removeFromParent ()
 Removes the receiver from its parent. More...
 
void setParent (BaseTree *newParent)
 Sets the parent of the receiver to newParent. More...
 
void clear ()
 Deletes all children from the tree. More...
 
List functions
virtual size_t size () const __attribute__((__deprecated__("use childrenSize() for the number of children")))
 deprecated - use childrenSize() for the number of children. More...
 
virtual size_t childrenSize () const
 Returns the number of children BaseTree the receiver contains. More...
 
const_iterator begin () const
 
const_iterator end () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 

Detailed Description

BaseTree element.

This class has to be derived to contain anything. The default BaseTree class only has the tree structure, which can be used alone.
A tree is a tree node like any other, therefore only one class is provided.

Definition at line 53 of file base.h.

Member Typedef Documentation

Definition at line 57 of file base.h.

Definition at line 59 of file base.h.

typedef std::list<BaseTree *>::iterator BaseTree::iterator

Definition at line 56 of file base.h.

Definition at line 58 of file base.h.

Constructor & Destructor Documentation

BaseTree::BaseTree ( bool  allowsChildren = true)
inline

Constructor.

Parameters
allowsChildrenif true (default) the node can hold children. If false, the node is terminal (leaf) and no children are allowed to be contained in it.

Definition at line 125 of file base.h.

virtual BaseTree::~BaseTree ( )
virtual

Member Function Documentation

BaseTree::const_iterator BaseTree::begin ( ) const
inline

Definition at line 173 of file base.h.

const std::list<BaseTree *>& BaseTree::children ( ) const
size_t BaseTree::childrenSize ( ) const
inlinevirtual

Returns the number of children BaseTree the receiver contains.

Reimplemented in Tree.

Definition at line 155 of file base.h.

void BaseTree::clear ( )

Deletes all children from the tree.

BaseTree::const_iterator BaseTree::end ( ) const
inline

Definition at line 179 of file base.h.

bool BaseTree::getAllowsChildren ( ) const
inline

Returns true if the receiver allows children.

Definition at line 131 of file base.h.

BaseTree * BaseTree::getChildAt ( unsigned  childIndex) const
inline

Returns the child BaseTree pointer at index childIndex.

Definition at line 137 of file base.h.

int BaseTree::getIndex ( BaseTree node) const

Returns the index of node in the receivers children.

BaseTree * BaseTree::getParent ( ) const
inline

Returns the parent BaseTree of the receiver.

Definition at line 161 of file base.h.

BaseTree* BaseTree::getTopParent ( )

Returns the top-level parent BaseTree of the receiver.

const BaseTree* BaseTree::getTopParent ( ) const

Returns the top-level parent of the receiver (const version)

void BaseTree::insert ( BaseTree child,
int  index = -1 
)

Adds child to the receiver at index (default: end)

bool BaseTree::isLeaf ( ) const
inline

Returns true if the receiver is a leaf (terminal node)

Definition at line 167 of file base.h.

BaseTree::const_reverse_iterator BaseTree::rbegin ( ) const
inline

Definition at line 185 of file base.h.

void BaseTree::remove ( unsigned  index)

Removes the child at index index from the receiver.

void BaseTree::remove ( BaseTree node)

Removes node from the receiver.

void BaseTree::removeFromParent ( )
inline

Removes the receiver from its parent.

Definition at line 197 of file base.h.

BaseTree::const_reverse_iterator BaseTree::rend ( ) const
inline

Definition at line 191 of file base.h.

void BaseTree::setParent ( BaseTree newParent)
inline

Sets the parent of the receiver to newParent.

Definition at line 204 of file base.h.

size_t BaseTree::size ( ) const
inlinevirtual

deprecated - use childrenSize() for the number of children.

In a future release, size() will disapear to avoid ambiguity with the GenericObject size in Tree specialization

Reimplemented in Tree.

Definition at line 149 of file base.h.


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