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 {
00044
00045 namespace module
00046 {
00047 class Module;
00048
00049 class Vertex
00050 {
00051 std::string name_;
00052 Module *module_;
00053 public:
00054 Vertex() :
00055 name_(""),
00056 module_(NULL)
00057 { }
00058 explicit Vertex(const std::string& name) :
00059 name_(name),
00060 module_(NULL)
00061 { }
00062 Vertex(const std::string& name, Module *module) :
00063 name_(name),
00064 module_(module)
00065 { }
00066 Vertex(const Vertex& old) :
00067 name_(old.name_),
00068 module_(old.module_)
00069 { }
00070 Vertex& operator=(const Vertex& old)
00071 {
00072 name_= old.name_;
00073 module_= old.module_;
00074 return *this;
00075 }
00076 const std::string &getName() const
00077 {
00078 return name_;
00079 }
00080 void setModule(Module *module)
00081 {
00082 module_= module;
00083 }
00084 Module* getModule()
00085 {
00086 return module_;
00087 }
00088 };
00089
00090 typedef std::pair<std::string, std::string> ModuleEdge;
00091 typedef boost::adjacency_list<boost::vecS,
00092 boost::vecS,
00093 boost::bidirectionalS,
00094 boost::property<boost::vertex_color_t,
00095 boost::default_color_type,
00096 boost::property<vertex_properties_t, Vertex> >
00097 > VertexGraph;
00098 typedef boost::graph_traits<VertexGraph>::vertex_descriptor VertexDesc;
00099 typedef std::vector<VertexDesc> VertexList;
00100
00101 typedef boost::graph_traits<VertexGraph>::vertex_iterator vertex_iter;
00102
00103 }
00104 }
00105