Diff managemnet

The management of the diff-view between 2 Linklers is held by the LinklerDiff class.

Generating LinklerDiffs

This class is created with references to 2 Linklers. The first one being the current Linkler being graphed and the second being the new Linkler created from parsing a new xml file.

At initialization 4 methods will be run in the constructor:

set_difference_modules();
set_difference_swus();
set_difference_module_dependencies();
set_difference_swu_dependencies();

These 4 methods will check the difference in modules, swus and their dependencies respectively and will each modify the internal sets introduced_modules_, removed_modules_, introduced_swus_, removed_swus_, introduced_module_dependencies_, removed_module_dependencies_, introduced_swu_dependencies_ and removed_swu_dependencies_.

The methods are implemented using the std::set_difference(...) from the C++ STL-library that takes 2 sets as arguments and checks (in set notation) A \ B, which means those that are in A but not B. This function also needs a custom comparator if the set contains custom-defined classes / objects.

Diff filters

In the LinklerDiff we have methods called added(...) & removed(...) that can take a pointer to either a Module, a Module dependency, a SWU or a SWU Dependency. These methods are then used in the filters for the difference view. They check whether the given pointer to the object is present in respective sets e.g if we would like to know if a SWU is added, the filter would run the SWU through the added(SWU* swu) method which in return would check in the introduced_swus_ set.

Extending the LinklerDiff

As of now the LinklerDiff only manages modules, SWUs and their respective dependencies. This could be further developed in the future if such a feature would be desirable. As long as the difference one wish to check is implemented as a set in Linkler it is very simple to extend since the LinklerDiff makes use of the std::set_difference(...) from the C++ STL-library.