2095.3.4
by Monty Taylor
Split out module vertex and then actually used it. |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2011 Monty Taylor
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
19 |
||
20 |
#ifndef DRIZZLED_MODULE_VERTEX_H
|
|
21 |
#define DRIZZLED_MODULE_VERTEX_H
|
|
22 |
||
23 |
#include <string> |
|
24 |
||
25 |
#define BOOST_NO_HASH 1
|
|
26 |
#include <boost/graph/graph_traits.hpp> |
|
27 |
#include <boost/graph/adjacency_list.hpp> |
|
28 |
#include <boost/graph/topological_sort.hpp> |
|
29 |
||
30 |
namespace drizzled |
|
31 |
{
|
|
32 |
enum vertex_properties_t { vertex_properties }; |
|
33 |
}
|
|
34 |
||
35 |
namespace boost |
|
36 |
{
|
|
37 |
template <> struct property_kind<drizzled::vertex_properties_t> |
|
38 |
{
|
|
39 |
typedef vertex_property_tag type; |
|
40 |
};
|
|
41 |
}
|
|
42 |
||
43 |
namespace drizzled |
|
44 |
{
|
|
45 |
||
46 |
namespace module |
|
47 |
{
|
|
48 |
class Module; |
|
49 |
||
50 |
class Vertex |
|
51 |
{
|
|
52 |
std::string name_; |
|
53 |
Module *module_; |
|
54 |
public: |
|
55 |
Vertex() : |
|
56 |
name_(""), |
|
57 |
module_(NULL) |
|
58 |
{ } |
|
2095.3.5
by Monty Taylor
Use the catalog registry. |
59 |
explicit Vertex(const std::string& name) : |
60 |
name_(name), |
|
61 |
module_(NULL) |
|
62 |
{ } |
|
2095.3.4
by Monty Taylor
Split out module vertex and then actually used it. |
63 |
Vertex(const std::string& name, Module *module) : |
64 |
name_(name), |
|
65 |
module_(module) |
|
66 |
{ } |
|
67 |
Vertex(const Vertex& old) : |
|
68 |
name_(old.name_), |
|
69 |
module_(old.module_) |
|
70 |
{ } |
|
71 |
Vertex& operator=(const Vertex& old) |
|
72 |
{
|
|
73 |
name_= old.name_; |
|
74 |
module_= old.module_; |
|
75 |
return *this; |
|
76 |
}
|
|
77 |
const std::string &getName() const |
|
78 |
{
|
|
79 |
return name_; |
|
80 |
}
|
|
2095.3.5
by Monty Taylor
Use the catalog registry. |
81 |
void setModule(Module *module) |
82 |
{
|
|
83 |
module_= module; |
|
84 |
}
|
|
85 |
Module* getModule() |
|
2095.3.4
by Monty Taylor
Split out module vertex and then actually used it. |
86 |
{
|
87 |
return module_; |
|
88 |
}
|
|
89 |
};
|
|
90 |
||
2095.3.6
by Monty Taylor
Actually properly process module dependencies. w00t. |
91 |
typedef std::pair<std::string, std::string> ModuleEdge; |
92 |
typedef boost::adjacency_list<boost::vecS, |
|
93 |
boost::vecS, |
|
94 |
boost::bidirectionalS, |
|
95 |
boost::property<boost::vertex_color_t, |
|
96 |
boost::default_color_type, |
|
97 |
boost::property<vertex_properties_t, Vertex> > |
|
2095.3.7
by Monty Taylor
Fixed the dependency graph so that it doesn't get included in sql_yacc.yy. |
98 |
> VertexGraph; |
99 |
typedef boost::graph_traits<VertexGraph>::vertex_descriptor VertexDesc; |
|
2095.3.6
by Monty Taylor
Actually properly process module dependencies. w00t. |
100 |
typedef std::vector<VertexDesc> VertexList; |
101 |
||
2095.3.7
by Monty Taylor
Fixed the dependency graph so that it doesn't get included in sql_yacc.yy. |
102 |
typedef boost::graph_traits<VertexGraph>::vertex_iterator vertex_iter; |
2095.3.6
by Monty Taylor
Actually properly process module dependencies. w00t. |
103 |
|
2095.3.4
by Monty Taylor
Split out module vertex and then actually used it. |
104 |
} /* namespace module */ |
105 |
} /* namespace vertex */ |
|
106 |
||
107 |
#endif /* DRIZZLED_MODULE_VERTEX_H */ |