Claw  1.7.3
Public Types | Public Member Functions | Public Attributes | List of all members
claw::tree< T > Class Template Reference

A tree structure with any number of children. More...

#include <tree.hpp>

Public Types

typedef T value_type
 The type of the value stored in the nodes.
typedef tree< T > self_type
 The type of the current class.
typedef child_list::iterator iterator
typedef child_list::const_iterator const_iterator

Public Member Functions

 tree ()
 Default constructor.
 tree (const T &that)
 Constructor with initialization.
bool operator== (const self_type &that) const
 Equality operator.
bool is_leaf () const
 Tell if this node is a leaf (ie. it has no child).
self_typeadd_child (const T &v)
 Add a child to this node.
self_typeadd_child (const self_type &v)
 Add a child subtree to this node.
iterator find (const T &v)
 Search the first child having a given value.
const_iterator find (const T &v) const
 Search the first child having a given value.
iterator begin ()
 Get an iterator on the begining of the children.
iterator end ()
 Get an iterator just past the end of the children.
const_iterator begin () const
 Get a constant iterator on the begining of the children.
const_iterator end () const
 Get a constant iterator just past the end of the children.

Public Attributes

value
 The value in this node.

Detailed Description

template<typename T>
class claw::tree< T >

A tree structure with any number of children.

Author
Julien Jorge

Definition at line 42 of file tree.hpp.

Constructor & Destructor Documentation

template<typename T>
claw::tree< T >::tree ( const T &  v)
explicit

Constructor with initialization.

Parameters
vThe value of the root node.

Definition at line 48 of file tree.tpp.

Member Function Documentation

template<typename T>
claw::tree< T >::self_type & claw::tree< T >::add_child ( const T &  v)

Add a child to this node.

Parameters
vThe value of the child to add.

Definition at line 97 of file tree.tpp.

template<typename T>
claw::tree< T >::self_type & claw::tree< T >::add_child ( const self_type v)

Add a child subtree to this node.

Parameters
vThe tree to add.

Definition at line 110 of file tree.tpp.

template<typename T>
claw::tree< T >::iterator claw::tree< T >::find ( const T &  v)

Search the first child having a given value.

Parameters
vThe value of the child to find.

Definition at line 121 of file tree.tpp.

template<typename T>
claw::tree< T >::const_iterator claw::tree< T >::find ( const T &  v) const

Search the first child having a given value.

Parameters
vThe value of the child to find.

Definition at line 141 of file tree.tpp.

template<typename T >
bool claw::tree< T >::operator== ( const self_type that) const

Equality operator.

Parameters
thatThe tree to compare to.

Definition at line 60 of file tree.tpp.

References claw::tree< T >::begin(), and claw::tree< T >::value.


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