00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #pragma once
00021
00022 #include <string>
00023
00024 #define BOOST_NO_HASH 1
00025 #include <boost/graph/graph_traits.hpp>
00026 #include <boost/graph/adjacency_list.hpp>
00027 #include <boost/graph/topological_sort.hpp>
00028
00029 namespace drizzled
00030 {
00031 enum vertex_properties_t { vertex_properties };
00032 }
00033
00034 namespace boost
00035 {
00036 template<> struct property_kind<drizzled::vertex_properties_t>
00037 {
00038 typedef vertex_property_tag type;
00039 };
00040 }
00041
00042 namespace drizzled {
00043 namespace module {
00044
00045 class Vertex
00046 {
00047 std::string name_;
00048 Module *module_;
00049 public:
00050 Vertex() :
00051 name_(""),
00052 module_(NULL)
00053 { }
00054 explicit Vertex(const std::string& name) :
00055 name_(name),
00056 module_(NULL)
00057 { }
00058 Vertex(const std::string& name, Module *module) :
00059 name_(name),
00060 module_(module)
00061 { }
00062 Vertex(const Vertex& old) :
00063 name_(old.name_),
00064 module_(old.module_)
00065 { }
00066 Vertex& operator=(const Vertex& old)
00067 {
00068 name_= old.name_;
00069 module_= old.module_;
00070 return *this;
00071 }
00072 const std::string &getName() const
00073 {
00074 return name_;
00075 }
00076 void setModule(Module *module)
00077 {
00078 module_= module;
00079 }
00080 Module* getModule()
00081 {
00082 return module_;
00083 }
00084 };
00085
00086 typedef std::pair<std::string, std::string> ModuleEdge;
00087 typedef boost::adjacency_list<boost::vecS,
00088 boost::vecS,
00089 boost::bidirectionalS,
00090 boost::property<boost::vertex_color_t,
00091 boost::default_color_type,
00092 boost::property<vertex_properties_t, Vertex> >
00093 > VertexGraph;
00094 typedef boost::graph_traits<VertexGraph>::vertex_descriptor VertexDesc;
00095 typedef std::vector<VertexDesc> VertexList;
00096
00097 typedef boost::graph_traits<VertexGraph>::vertex_iterator vertex_iter;
00098
00099 }
00100 }
00101