GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
swu_graph_builder.h
1 #ifndef GRAPHTOOL_SWUGRAPHBUILDER_H_
2 #define GRAPHTOOL_SWUGRAPHBUILDER_H_
3 
4 #include <string>
5 #include <map>
6 #include <iostream>
7 #include <algorithm> // for_each
8 #include <utility> // pair
9 
10 #include "grapher.h"
11 #include "linkler.h"
12 #include "dependency.h"
13 #include "swu.h"
14 #include "graph_builder.h"
15 
22 class SWUGraphBuilder : public GraphBuilder {
23  public:
28 
34  ~SWUGraphBuilder(){
35 
36  }
37 
41  GraphType& grapher();
42 
43  //*******************
44  // Graphing functions
45  //*******************
46 
50  void graph_all();
51 
56 
62  void graph_all_dependents();
63 
68  void graph_single(std::string swu_name);
69 
76  void graph_recursively(std::string swu);
77 
84  void graph_dependencies(std::string swu);
85 
92  void graph_dependents(std::string swu);
93 
97  Linkler* linkler();
98 
103  SWU* get(std::string swu_name);
104 
109  class GraphAdder {
110  public:
111  GraphAdder(GraphType& g) : grapher_(g) { }
112 
113  protected:
114  GraphType& grapher_;
115  };
116 
120  class AddSWU : public GraphAdder {
121  public:
122  explicit AddSWU(GraphType& g)
123  : GraphAdder(g) {}
124 
125  bool operator()(SWU* ptr);
126  };
127 
131  class AddDependencies : public GraphAdder {
132  public:
133  explicit AddDependencies(GraphType& g)
134  : GraphAdder(g) {}
135 
136  bool operator()(SWU* ptr);
137  };
138 
142  class AddDependents : public GraphAdder {
143  public:
144  explicit AddDependents(GraphType& g)
145  : GraphAdder(g) {}
146 
147  bool operator()(SWU* ptr);
148  };
149 
150  private:
151  // The grapher object
152  GraphType grapher_;
153 
154  // The linkler object used for generating the grapher
155  Linkler* linkler_;
156 };
157 
158 #endif
Definition: swu_graph_builder.h:22
Functor for comparing swu dependencies.
Definition: defines.h:55
Definition: graph_builder.h:4
void graph_all()
Definition: swu_graph_builder.cc:24
Functor for comparing names between SWUs.
Definition: defines.h:61
Grapher< SWU *, Dependency< SWU, SWU > *, CompareSWUByName, CompareSWUDependency > GraphType
Definition: swu_graph_builder.h:27
Definition: linkler.h:20
Definition: swu_graph_builder.h:120
void graph_dependencies(std::string swu)
Definition: swu_graph_builder.cc:81
Definition: swu_graph_builder.h:109
Definition: swu_graph_builder.h:131
void graph_all_dependencies()
Definition: swu_graph_builder.cc:32
void graph_all_dependents()
Definition: swu_graph_builder.cc:40
Definition: grapher.h:30
void graph_single(std::string swu_name)
Definition: swu_graph_builder.cc:48
Definition: swu.h:27
void graph_dependents(std::string swu)
Definition: swu_graph_builder.cc:91
Definition: swu_graph_builder.h:142
SWUGraphBuilder(Linkler *l)
Definition: swu_graph_builder.cc:3
Linkler * linkler()
Definition: swu_graph_builder.cc:7
GraphType & grapher()
Definition: swu_graph_builder.cc:16
void graph_recursively(std::string swu)
Definition: swu_graph_builder.cc:58