GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
swu.h
1 #ifndef GRAPHTOOL_SWU_H_
2 #define GRAPHTOOL_SWU_H_
3 
4 #include <algorithm>
5 #include <iostream>
6 #include <string>
7 #include <set>
8 #include <list>
9 #include <map>
10 #include <assert.h>
11 
12 #include "defines.h"
13 #include "module.h"
14 #include "executable.h"
15 #include "mem_type.h"
16 
18 template<class T1, class T2> class Dependency;
19 
27 class SWU {
28  public:
33  SWU(const std::string);
34 
38  ~SWU();
39 
46 
53 
58  bool remove_dependency(SWU*);
59 
64  void add_module(Module*);
65 
66 
71  void add_executable(Executable* executable);
72 
78  int remove_module(Module*);
79 
80  int remove_executable(Executable*);
81 
87  Module* find_module(std::string);
88 
90  std::string name() const;
91 
93  ModuleSet* modules();
94 
96  SwuDependencySet* dependencies();
97 
99  SwuDependentSet* dependents();
100 
102  ExecutableSet* executables();
103 
105  ModDependencySet* module_dependencies();
106 
108  ModDependentSet* module_dependents();
109 
111  void update_file_count();
112 
114  int num_files();
115 
119  ModDependencySet sub_dependencies(Dependency<SWU,SWU>* dependency);
120 
121  protected:
128 
133  bool remove_dependent(SWU*);
134 
135  private:
137  std::string name_;
138 
140  ModuleSet modules_;
141 
143  ExecutableSet executables_;
144 
146  SwuDependencySet dependencies_;
147 
149  SwuDependentSet dependents_;
150 
152  int num_files_;
153 
154  // This map contains both dependencies and dependents
155  // This differs from the other dependency-collections
156  std::map<Dependency<SWU,SWU>*, ModDependencySet > sub_dependencies_;
157 
159  ModDependencySet module_dependencies_;
160 
162  ModDependentSet module_dependents_;
163 
165  SWU(SWU& copy);
166 
167  void remove_all_dependencies();
168 
169  void remove_all_dependents();
170 
171  void remove_all_executables();
172 
173  void remove_all_modules();
174 };
175 
176 #endif // GRAPHTOOL_SWU_H_
bool add_dependent(Dependency< SWU, SWU > *, Dependency< Module, Module > *)
Definition: swu.cc:96
void update_file_count()
Function to update number of files in this swu.
Definition: swu.cc:193
void add_executable(Executable *executable)
Definition: swu.cc:176
bool add_dependency(Dependency< SWU, SWU > *, Dependency< Module, Module > *)
Definition: swu.cc:62
Forward declarations for functors.
Definition: defines.h:32
ModuleSet * modules()
Accessor for the set of modules.
Definition: swu.cc:155
ModDependentSet * module_dependents()
Accessor for the set of module dependents.
Definition: swu.cc:167
ModDependencySet sub_dependencies(Dependency< SWU, SWU > *dependency)
Definition: swu.cc:211
int remove_module(Module *)
Definition: swu.cc:181
bool remove_dependency(SWU *)
Definition: swu.cc:107
SwuDependencySet * dependencies()
Accessor for the set of dependencies.
Definition: swu.cc:143
std::string name() const
Accessor for name.
Definition: swu.cc:151
Definition: module.h:21
SwuDependentSet * dependents()
Accessor for the set of dependents.
Definition: swu.cc:147
void remove_from_datastructure()
Definition: swu.cc:18
Definition: swu.h:27
void add_module(Module *)
Definition: swu.cc:171
int num_files()
accessor for the number of files in this swu
Definition: swu.cc:207
ExecutableSet * executables()
Accessor for the set of executables.
Definition: swu.cc:159
SWU(const std::string)
Definition: swu.cc:3
Executable class, defines an executable / run block.
Definition: executable.h:13
ModDependencySet * module_dependencies()
Accessor for the set of module dependencies.
Definition: swu.cc:163
~SWU()
Definition: swu.cc:8
Module * find_module(std::string)
Definition: swu.cc:134
bool remove_dependent(SWU *)
Definition: swu.cc:124