CLAW Library (a C++ Library Absolutely Wonderful) 1.5.5
Public Member Functions | Public Attributes

claw::binary_node< U > Class Template Reference

Basic binary node. More...

#include <binary_node.hpp>

List of all members.

Public Member Functions

 binary_node ()
 Binary node constructor.
 binary_node (const binary_node &that)
 Binary node copy constructor.
 ~binary_node ()
 Binary node destructor. Deletes the whole subtree.
void clear ()
 Clear right and left childs. Memory's not freed.

Public Attributes

U * left
 Left child.
U * right
 Right child.

Detailed Description

template<class U>
class claw::binary_node< U >

Basic binary node.

Author:
Julien Jorge

Definition at line 41 of file binary_node.hpp.


Constructor & Destructor Documentation

template<class U >
claw::binary_node< U >::binary_node ( ) [explicit]

Binary node constructor.

Postcondition:
(left==NULL) && (right==NULL)

Definition at line 38 of file binary_node.tpp.

  : left(NULL), right(NULL)
{

} //binary_node()
template<class U >
claw::binary_node< U >::binary_node ( const binary_node< U > &  that) [explicit]

Binary node copy constructor.

Parameters:
thatNode to copy from.

Definition at line 50 of file binary_node.tpp.

References claw::binary_node< U >::left, and claw::binary_node< U >::right.

{
  if (that.left)
    left = new U( * that.left );
  else
    left = NULL;

  if ( that.right )
    right = new U( * that.right );
  else
    right = NULL;
} // binary_node() [copy constructor]
template<class U >
claw::binary_node< U >::~binary_node ( )

Binary node destructor. Deletes the whole subtree.

Definition at line 81 of file binary_node.tpp.

{
  if (left)
    delete left;

  if (right)
    delete right;
} // ~binary_node() [destructor]

Member Function Documentation

template<class U >
void claw::binary_node< U >::clear ( )

Clear right and left childs. Memory's not freed.

Postcondition:
this->left == NULL && this->right == NULL

Definition at line 69 of file binary_node.tpp.

Referenced by claw::avl_base< K, Comp >::recursive_delete_max(), and claw::avl_base< K, Comp >::recursive_delete_node().

{
  left = NULL;
  right = NULL;
} // clear()

Member Data Documentation

template<class U>
U* claw::binary_node< U >::left
template<class U>
U* claw::binary_node< U >::right

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