Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

node.cc

Go to the documentation of this file.
00001 /* ===========================================================================
00002  *        Filename:  node.c
00003  *     Description:  A simple node class
00004  * 
00005  *         Version:  $Rev: 3 $
00006  *         Changed:  $Date: 2005-03-02 14:30:37 -0800 (Mi, 02 Mär 2005) $
00007  *         Licence:  GPL (read COPYING file for details)
00008  * 
00009  *          Author:  Erich Schubert (eS), erich@debian.org
00010  *                   Institut für Informatik, LMU München
00011  * ======================================================================== */
00012 #include "node.h"
00013 
00014 namespace SSD {
00015 
00016 /* simple vector<Node*>* access wrapper */
00017 void
00018 Node::addChild(Node* node) {
00019         if (!node) throw "Node::addChild(NULL) called";
00020         if (!children) children = new NodeVec;
00021         children->push_back(node);
00022 }
00023 
00024 /* clean up data on destruction */
00025 Node::~Node() {
00026         NodeVec::iterator iter;
00027         if (children) {
00028                 for (iter=children->begin(); iter != children->end(); iter++)
00029                         delete(*iter);
00030                 children->clear();
00031                 delete children;
00032         }
00033         if (relup)   delete(relup);
00034         if (reldown) delete(reldown);
00035 }
00036 
00037 /* nice output for debugging */
00038 std::ostream &operator<<(std::ostream &out, const Node &node) {
00039         return out << "Node(" << node.label << "," << node.content << ")";
00040 }
00041 
00042 }

Generated on Thu Aug 4 17:57:12 2005 for SSDDiff by  doxygen 1.4.3-20050530