GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
module_graph_builder.h
1 #ifndef GRAPH_BUILDER_H
2 #define GRAPH_BUILDER_H
3 
4 #include <string>
5 #include <map>
6 #include <iostream>
7 #include <algorithm> // for_each
8 #include <utility> // pair
9 
10 #include "defines.h"
11 #include "grapher.h"
12 #include "linkler.h"
13 #include "dependency.h"
14 #include "module.h"
15 #include "graph_builder.h"
16 
24  public:
29 
37  }
38 
42  GraphType& grapher();
43 
44  //*******************
45  // Graphing functions
46  //*******************
47 
51  void graph_all();
52 
57 
63  void graph_all_dependents();
64 
69  void graph_single(std::string module);
70 
77  void graph_recursively(std::string module);
78 
85  void graph_dependencies(std::string module);
86 
93  void graph_dependents(std::string module);
94 
98  Linkler* linkler();
99 
104  Module* get(std::string module_name);
105 
110  class GraphAdder {
111  public:
112  GraphAdder(GraphType& g) : grapher_(g) { }
113 
114  protected:
115  GraphType& grapher_;
116  };
117 
121  class AddModule : public GraphAdder {
122  public:
123  explicit AddModule(GraphType& g)
124  : GraphAdder(g) {}
125 
126  bool operator()(Module* ptr);
127  };
128 
132  class AddDependencies : public GraphAdder {
133  public:
134  explicit AddDependencies(GraphType& g)
135  : GraphAdder(g) {}
136 
137  bool operator()(Module* ptr);
138  };
139 
143  class AddDependents : public GraphAdder {
144  public:
145  explicit AddDependents(GraphType& g)
146  : GraphAdder(g) {}
147 
148  bool operator()(Module* ptr);
149  };
150 
151  private:
152  // The grapher object
153  GraphType grapher_;
154 
155  // The linkler object used for generating the grapher
156  Linkler* linkler_;
157 };
158 
159 #endif
GraphType & grapher()
Definition: module_graph_builder.cc:17
Definition: graph_builder.h:4
Definition: module_graph_builder.h:143
Definition: linkler.h:20
void graph_recursively(std::string module)
Definition: module_graph_builder.cc:59
Definition: module_graph_builder.h:121
Grapher< Module *, Dependency< Module, Module > *, CompareModuleByName, CompareModuleDependency > GraphType
Definition: module_graph_builder.h:28
Linkler * linkler()
Definition: module_graph_builder.cc:8
Definition: module.h:21
Definition: module_graph_builder.h:110
void graph_all_dependencies()
Definition: module_graph_builder.cc:33
Definition: grapher.h:30
void graph_single(std::string module)
Definition: module_graph_builder.cc:49
Definition: module_graph_builder.h:132
Functor for comparing names between modules.
Definition: defines.h:50
void graph_all_dependents()
Definition: module_graph_builder.cc:41
void graph_all()
Definition: module_graph_builder.cc:25
void graph_dependents(std::string module)
Definition: module_graph_builder.cc:92
void graph_dependencies(std::string module)
Definition: module_graph_builder.cc:82
Functor for comparing module dependencies.
Definition: defines.h:44
ModuleGraphBuilder(Linkler *l)
Definition: module_graph_builder.cc:4
Definition: module_graph_builder.h:23