binary_node.tpp

Go to the documentation of this file.
00001 /*
00002   CLAW - a C++ Library Absolutely Wonderful
00003 
00004   CLAW is a free library without any particular aim but being useful to 
00005   anyone.
00006 
00007   Copyright (C) 2005-2008 Julien Jorge
00008 
00009   This library is free software; you can redistribute it and/or
00010   modify it under the terms of the GNU Lesser General Public
00011   License as published by the Free Software Foundation; either
00012   version 2.1 of the License, or (at your option) any later version.
00013 
00014   This library is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017   Lesser General Public License for more details.
00018 
00019   You should have received a copy of the GNU Lesser General Public
00020   License along with this library; if not, write to the Free Software
00021   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023   contact: julien_jorge@yahoo.fr
00024 */
00032 /*---------------------------------------------------------------------------*/
00037 template< class U >
00038 claw::binary_node<U>::binary_node() 
00039   : left(NULL), right(NULL)
00040 {
00041 
00042 } //binary_node()
00043 
00044 /*---------------------------------------------------------------------------*/
00049 template< class U >
00050 claw::binary_node<U>::binary_node( const binary_node& that )
00051 {
00052   if (that.left)
00053     left = new U( * that.left );
00054   else
00055     left = NULL;
00056 
00057   if ( that.right )
00058     right = new U( * that.right );
00059   else
00060     right = NULL;
00061 } // binary_node() [copy constructor]
00062 
00063 /*---------------------------------------------------------------------------*/
00068 template< class U >
00069 void claw::binary_node<U>::clear()
00070 {
00071   left = NULL;
00072   right = NULL;
00073 } // clear()
00074 
00075 /*---------------------------------------------------------------------------*/
00080 template< class U >
00081 claw::binary_node<U>::~binary_node()
00082 {
00083   if (left)
00084     delete left;
00085 
00086   if (right)
00087     delete right;
00088 } // ~binary_node() [destructor]

Generated on 9 Nov 2009 for CLAW Library (a C++ Library Absolutely Wonderful) by  doxygen 1.6.1