GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
defines.h
1 #ifndef GRAPHTOOL_DEFINES_H_
2 #define GRAPHTOOL_DEFINES_H_
3 
4 #include <set>
5 
6 // Deleter for sets of pointers
7 struct Deleter{
8  template <typename T>
9  void operator()(T *ptr){
10  delete ptr;
11  }
12 };
13 
17 template<typename SetType>
18 struct Copier {
19  SetType& set;
20 
21  Copier(SetType& st) : set(st) {
22  }
23 
24  template<typename T>
25  void operator()(T* original) {
26  T* copy = new T(*original); // Call the copy constructor
27  set.insert(copy);
28  }
29 };
30 
32 template<class T1, class T2> class Dependency;
33 class Module;
34 class Executable;
35 class SWU;
36 class File;
37 
38 /*
39 * TODO Make Functors for Module and SWU dependency/dependent into 2 functors
40 * that makes use of templates. Example is in dependency.h, the structs needs implementation.
41 */
42 
44 struct CompareModuleDependency: public std::binary_function<const Dependency<Module, Module>&, const Dependency<Module, Module>&, bool> {
45  bool operator()(const Dependency<Module,Module>& a, const Dependency<Module,Module>& b) const;
46  bool operator()(const Dependency<Module,Module>* a, const Dependency<Module,Module>* b) const;
47 };
48 
50 struct CompareModuleByName : public std::binary_function<Module*, Module*, bool> {
51  bool operator()(const Module* a, const Module* b) const;
52 };
53 
55 struct CompareSWUDependency: public std::binary_function<const Dependency<SWU, SWU>&, const Dependency<SWU, SWU>&, bool> {
56  bool operator()(const Dependency<SWU,SWU>& a, const Dependency<SWU,SWU>& b) const;
57  bool operator()(const Dependency<SWU,SWU>* a, const Dependency<SWU,SWU>* b) const;
58 };
59 
61 struct CompareSWUByName : public std::binary_function<SWU*, SWU*, bool> {
62  bool operator()(const SWU* a, const SWU* b) const;
63 };
64 
70 struct CompareDependencyByFile : public std::binary_function<const Dependency<File, File>, const Dependency<File, File>, bool> {
72  bool operator()(const Dependency<File, File>& a, const Dependency<File, File>& b) const;
73  bool operator()(const Dependency<File, File>* a, const Dependency<File, File>* b) const;
74 };
75 
77 struct CompareDependentByFile : public std::binary_function<const Dependency<File, File>, const Dependency<File, File>, bool> {
78  bool operator()(const Dependency<File, File>& a, const Dependency<File, File>& b) const;
79  bool operator()(const Dependency<File, File>* a, const Dependency<File, File>* b) const;
80 };
81 
83 struct CompareFileByName : public std::binary_function<File*, File*, bool> {
84  bool operator()(const File* a, const File* b);
85 };
86 
88 struct CompareExByName : public std::binary_function<Executable*, Executable*, bool> {
89  bool operator()(const Executable* a, const Executable* b) const;
90 };
91 
93 typedef std::set<Dependency<Module,Module>*, CompareModuleDependency> ModDependencySet;
94 typedef std::set<Dependency<Module,Module>*, CompareModuleDependency> ModDependentSet;
95 typedef std::set<Module*, CompareModuleByName> ModuleSet;
96 
98 typedef std::set<Dependency<SWU, SWU>*, CompareSWUDependency> SwuDependencySet;
99 typedef std::set<Dependency<SWU, SWU>*, CompareSWUDependency> SwuDependentSet;
100 typedef std::set<SWU*, CompareSWUByName> SWUSet;
101 
103 typedef std::set<Dependency<File, File>*, CompareDependencyByFile> FileDependencySet;
104 typedef std::set<Dependency<File, File>*, CompareDependentByFile> FileDependentSet;
105 
107 typedef std::set<Executable*, CompareExByName> ExecutableSet;
108 
109 #endif
Functor for comparing swu dependencies.
Definition: defines.h:55
Definition: defines.h:7
Functor for comparing dependencies between Files.
Definition: defines.h:71
Functor for comparing names between SWUs.
Definition: defines.h:61
Forward declarations for functors.
Definition: defines.h:32
Functor for comparing names between Files.
Definition: defines.h:83
Definition: module.h:21
Definition: swu.h:27
Functor for comparing names between modules.
Definition: defines.h:50
Executable class, defines an executable / run block.
Definition: executable.h:13
Functor for comparing names between Executables.
Definition: defines.h:88
Definition: defines.h:18
Functor for comparing dependents between Files.
Definition: defines.h:77
Definition: file.h:13
Functor for comparing module dependencies.
Definition: defines.h:44