~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/registry.h

  • Committer: Monty Taylor
  • Date: 2011-01-18 03:24:01 UTC
  • mto: (2114.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2115.
  • Revision ID: mordred@inaugust.com-20110118032401-8vzyz4vqnbhpuu0x
Split out module vertex and then actually used it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include "drizzled/unireg.h"
30
30
#include "drizzled/errmsg_print.h"
31
31
#include "drizzled/plugin/plugin.h"
32
 
 
33
 
#define BOOST_NO_HASH 1
34
 
#include <boost/graph/graph_traits.hpp>
35
 
#include <boost/graph/adjacency_list.hpp>
36
 
#include <boost/graph/topological_sort.hpp>
37
 
 
38
 
namespace drizzled
39
 
{
40
 
  enum vertex_properties_t { vertex_properties };
41
 
}
42
 
 
43
 
namespace boost
44
 
{
45
 
  template <> struct property_kind<drizzled::vertex_properties_t>
46
 
  {
47
 
    typedef vertex_property_tag type;
48
 
  };
49
 
}
 
32
#include "drizzled/module/vertex.h"
 
33
 
50
34
 
51
35
namespace drizzled
52
36
{
56
40
class Module;
57
41
class Library;
58
42
 
59
 
struct ModuleVertex
60
 
{
61
 
  Module *module;
62
 
};
63
43
 
64
44
class Registry
65
45
{
71
51
                               boost::bidirectionalS, 
72
52
                               boost::property<boost::vertex_color_t,
73
53
                                               boost::default_color_type,
74
 
                                 boost::property<vertex_properties_t, ModuleVertex> >
75
 
                      > ModuleGraph;
76
 
  typedef boost::graph_traits<ModuleGraph>::vertex_descriptor Vertex;
77
 
  typedef std::vector<Vertex> VertexList;
 
54
                                 boost::property<vertex_properties_t, Vertex> >
 
55
                      > Graph;
 
56
  typedef boost::graph_traits<Graph>::vertex_descriptor VertexDesc;
 
57
  typedef std::vector<VertexDesc> VertexList;
78
58
 
79
 
  typedef boost::graph_traits<ModuleGraph>::vertex_iterator vertex_iter;
 
59
  typedef boost::graph_traits<Graph>::vertex_iterator vertex_iter;
80
60
 
81
61
  typedef std::map<std::string, Library *> LibraryMap;
82
62
  typedef std::map<std::string, Module *> ModuleMap;
83
63
private:
84
64
  LibraryMap library_registry_;
85
65
  ModuleMap module_registry_;
86
 
  ModuleGraph depend_graph_; 
 
66
  Graph depend_graph_; 
87
67
  
88
68
  plugin::Plugin::map plugin_registry;
89
69
 
97
77
  Registry& operator=(const Registry&);
98
78
  ~Registry();
99
79
 
100
 
  ModuleVertex& properties(const Vertex& v)
 
80
  Vertex& properties(const VertexDesc& v)
101
81
  {
102
 
     boost::property_map<ModuleGraph, vertex_properties_t>::type param=
 
82
     boost::property_map<Graph, vertex_properties_t>::type param=
103
83
       boost::get(vertex_properties, depend_graph_);
104
84
     return param[v];
105
85
  }