Overview     Modules     Class Hierarchy     Classes     Members  

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, ...). More...

#include <Algorithm.h>

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

Public Member Functions

 Algorithm (const AlgorithmContext &context)
 Constructs an algorithm and initializes members from the AlgorithmContext.
virtual ~Algorithm ()
virtual bool run ()
 Runs the algorithm on the context that was specified during construction.
virtual bool check (std::string &)
 Checks if the algorithm can run on the context it was given.
- Public Member Functions inherited from tlp::WithParameter
const
tlp::ParameterDescriptionList
getParameters ()
 Retrieves the parameters.
template<typename T >
void addInParameter (const char *str, const char *inHelp=0, const char *inDefValue=0, bool isMandatory=true)
 Adds an IN parameter to the plug-in.
template<typename T >
void addOutParameter (const char *str, const char *inHelp=0, const char *inDefValue=0, bool isMandatory=true)
 Adds an OUT parameter to the plug-in.
template<typename T >
void addInOutParameter (const char *str, const char *inHelp=0, const char *inDefValue=0, bool isMandatory=true)
 Adds an INOUT parameter to the plug-in.
template<typename T >
void addParameter (const char *parameterName, const char *help=NULL, const char *defaultValue=NULL, bool isMandatory=true)
 Adds an IN parameter to the plug-in (deprecated)
- Public Member Functions inherited from tlp::WithDependency
std::list< DependencygetDependencies ()
 Gets the list of Dependencies of this plug-in.
template<typename Ty >
void addDependency (const char *name, const char *release)
 Adds a dependency upon another plug-in. The parameters should be null-terminated strings, or NULL.

Public Attributes

Graphgraph
 The graph this algorithm will be run on. Retrieved from the context at construction.
PluginProgresspluginProgress
 A PluginProgress to give feedback to the user, retrieved from the context. It can be a NULL pointer, so use with caution.
DataSetdataSet
 A DataSet containing parameters for this algorithm, if any. Retrieved from the context at construction.

Additional Inherited Members

- Protected Member Functions inherited from tlp::WithDependency
void addDependency (const char *factory, const char *name, const char *release)
 Adds a dependency upon another plug-in.
- Protected Attributes inherited from tlp::WithParameter
ParameterDescriptionList parameters
 The internal structure storing the parameters.
- Protected Attributes inherited from tlp::WithDependency
std::list< Dependencydependencies
 The inner list of dependencies.

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, ...).

Constructor & Destructor Documentation

tlp::Algorithm::Algorithm ( const AlgorithmContext 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.
virtual tlp::Algorithm::~Algorithm ( )
inlinevirtual

Member Function Documentation

virtual bool tlp::Algorithm::check ( std::string &  )
inlinevirtual

Checks if the algorithm can run on the context it was given.

Returns
Whether the algorithm can be applied or not.
virtual bool tlp::Algorithm::run ( )
inlinevirtual

Runs the algorithm on the context that was specified during construction.

Returns
bool Whether the algorithm was successful or not.

Member Data Documentation

DataSet* tlp::Algorithm::dataSet

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

Graph* tlp::Algorithm::graph

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

PluginProgress* tlp::Algorithm::pluginProgress

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



Tulip Software by LaBRI Visualization Team    2001 - 2012