HyperspaceExplorer 0.7.1
Tree.h
00001 /*
00002     <one line to give the program's name and a brief idea of what it does.>
00003     Copyright (C) <year>  <name of author>
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 along
00016     with this program; if not, write to the Free Software Foundation, Inc.,
00017     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018 
00019 */
00020 
00021 #ifndef TREE_H
00022 #define TREE_H
00023 
00024 #include <list>
00025 
00026 template < typename Node >
00027 class Tree {
00028 
00029 public:
00030 
00031   typedef std::list< Tree<Node> > sub_tree_type;
00032 
00033   Tree();
00034   explicit Tree(const Node &node);
00035 
00036   const Node &getNode() const;
00037   Node &getNode();
00038   void addNode(const Node &new_node);
00039   void removeNode(const Node &old_node);
00040 
00041   const sub_tree_type &getSubTrees() const;
00042   sub_tree_type &getSubTrees();
00043   void addTree(const Tree<Node> &new_tree);
00044   void removeTree(const Tree<Node> &new_tree);
00045 
00046   const Tree &findByNode(const Node &node) const;
00047   Tree &findByNode(const Node &node);
00048 
00049 private:
00050 
00051   Node current_node_;
00052   sub_tree_type sub_trees_;
00053 
00054 };
00055 
00056 #endif // TREE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:16 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo