Tulip  4.6.0
Better Visualization Through Research
tlp::Algorithm Class Reference

#include <Algorithm.h>

+ Inheritance diagram for tlp::Algorithm:
+ Collaboration diagram for tlp::Algorithm:

List of all members.

Public Member Functions

 Algorithm (const PluginContext *context)
virtual std::string category () const
virtual bool check (std::string &)
std::string icon () const
virtual bool run ()=0

Public Attributes

DataSetdataSet
Graphgraph
PluginProgresspluginProgress

Detailed Description

This abstract class describes a basic algorithm plugin.

It inherits on WithParameter and WithDependency for convenience. Basic functionality consists in checking the algorithm can run on the current Graph (e.g. is the graph simple ?), running the algorithm and resetting the algorithm to re-apply it. The algorithm can and should report progress and which task it is performing if it is decomposed in multiple phases (e.g. layouting the graph, coloring it, ...).

Definition at line 45 of file Algorithm.h.


Constructor & Destructor Documentation

tlp::Algorithm::Algorithm ( const PluginContext context) [inline]

Constructs an algorithm and initializes members from the AlgorithmContext.

Parameters:
contextThe context this algorithm runs in, containing the graph, a DataSet for the parameters, and a PluginProgress to give feedback to the user about the tasks the algorithm is performing.

Definition at line 53 of file Algorithm.h.


Member Function Documentation

virtual std::string tlp::Algorithm::category ( ) const [inline, virtual]

A string identifier for a plugin used for categorization purposes.

Returns:
std::string the category of the plugin.

Implements tlp::Plugin.

Reimplemented in tlp::StringAlgorithm, tlp::SizeAlgorithm, tlp::LayoutAlgorithm, tlp::IntegerAlgorithm, tlp::DoubleAlgorithm, tlp::ColorAlgorithm, tlp::BooleanAlgorithm, and tlp::PropertyAlgorithm.

Definition at line 77 of file Algorithm.h.

virtual bool tlp::Algorithm::check ( std::string &  ) [inline, virtual]

Checks whether the algorithm can be applied on this graph or not. If not, the reason why should be reported through the PluginProgress.

Parameters:
errorMessageA string whose value will be modified to an error message, if the check fails.
Returns:
bool Whether the plug-in can run on this Graph.

Definition at line 87 of file Algorithm.h.

std::string tlp::Algorithm::icon ( ) const [inline, virtual]

The icon (preferably a thumbnail) of the plugin.

Returns:
std::string the icon path

Reimplemented from tlp::Plugin.

Definition at line 64 of file Algorithm.h.

virtual bool tlp::Algorithm::run ( ) [pure virtual]

Runs the algorithm. It is a good practice to report progress through the PluginProgress, Even if your algorithm is very fast. Keep in mind that Tulip can handle very large graphs. The PluginProgress should also be used to report errors, if any.

Returns:
bool Whether the algorithm execution was successful or not.

Member Data Documentation

A DataSet containing parameters for this algorithm, if any. Retrieved from the context at construction.

Definition at line 101 of file Algorithm.h.

The graph this algorithm will be run on. Retrieved from the context at construction.

Definition at line 93 of file Algorithm.h.

A PluginProgress to give feedback to the user, retrieved from the context. It can be a NULL pointer, so use with caution.

Definition at line 97 of file Algorithm.h.

 All Classes Files Functions Variables Enumerations Enumerator Properties