graph_node.hpp

Go to the documentation of this file.
00001 //  This file is part of jdl_parser.
00002 //
00003 //  jdl_parser is free software: you can redistribute it and/or modify
00004 //  it under the terms of the GNU General Public License as published by
00005 //  the Free Software Foundation, either version 3 of the License, or
00006 //  (at your option) any later version.
00007 //
00008 //  jdl_parser is distributed in the hope that it will be useful,
00009 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //  GNU General Public License for more details.
00012 //
00013 //  You should have received a copy of the GNU General Public License
00014 //  along with jdl_parser.  If not, see <http://www.gnu.org/licenses/>.
00015 
00016 // Copyright Simone Pellegrini 2007-2008; e-mail: motonacciu@gmail.com
00017 
00018 #ifndef DAG_TREE_HPP_
00019 #define DAG_TREE_HPP_
00020 
00021 #include "tree.hpp"
00022 
00023 using namespace logger;
00024 using namespace jdl;
00025 
00026 namespace graph{
00028 // DAG TREE
00030 class visitor;
00031         
00032 class node{
00033         std::string name;
00034         component const* definition;
00035         std::vector<node*> parents;
00036         std::vector<boost::shared_ptr<node> > children;
00037         
00038         void add_parent(node* node){ parents.push_back(node); }
00039                 
00040 public:
00041         node(std::string _name, jdl::component const* def): 
00042                 name(_name), definition(def){ }
00043           
00044         void add_child(boost::shared_ptr<node> node);
00045         
00046         std::string get_name() const { return name; }
00047         
00048         component const* get_definition() const { return definition; }
00049         
00050         std::vector<node*> const& get_parents() const { return parents; }
00051         
00052         std::vector<boost::shared_ptr<node> > const& get_children() const { return children; }
00053         
00054         void print(int indentation, ostream& out = cout) const;
00055         
00056         void accept(graph::const_visitor& v) const;
00057         
00058         void accept(graph::visitor& v);
00059         
00060         //~dag_node();
00061 };
00062 
00063 }
00064 
00065 #endif /*DAG_TREE_HPP_*/

Generated on Sun Feb 17 16:55:14 2008 for JDLParser by  doxygen 1.5.3