btreenode.cpp

00001 /***************************************************************************
00002  *   Copyright (C) 2004-2005 by Daniel Clarke                              *
00003  *   daniel.jc@gmail.com                                               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #include "btreenode.h"
00022 #include "pic14.h"
00023 
00024 BTreeNode::BTreeNode()
00025 {
00026         m_parent = 0;
00027         m_left = 0;
00028         m_right = 0;
00029         m_type = unset;
00030 }
00031 
00032 BTreeNode::BTreeNode(BTreeNode *p, BTreeNode *l, BTreeNode *r)
00033 {
00034         m_parent = p;
00035         m_left = l;
00036         m_right = r;
00037 }
00038 
00039 BTreeNode::~BTreeNode()
00040 {
00041         // Must not delete children as might be unlinking!!! deleteChildren();
00042 }
00043 
00044 void BTreeNode::deleteChildren()
00045 {
00046         if(m_left) {
00047                 m_left->deleteChildren();
00048                 delete m_left;
00049                 m_left = 0;
00050         } if(m_right) {
00051                 m_right->deleteChildren();
00052                 delete m_right;
00053                 m_right = 0;
00054         }
00055 
00056         return;
00057 }
00058 
00059 // void BTreeNode::printTree()
00060 // {
00061 //      
00062 // }

Generated on Tue May 8 17:05:28 2007 for KTechLab by  doxygen 1.5.1