Tulip  4.6.0
Better Visualization Through Research
library/tulip-core/include/tulip/PluginContext.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 #ifndef _PLUGINCONTEXT
00020 #define _PLUGINCONTEXT
00021 
00022 #include <tulip/DataSet.h>
00023 
00024 namespace tlp {
00025 
00026 class Graph;
00027 class PropertyInterface;
00028 class PluginProgress;
00029 
00030 /**
00031  * @ingroup Plugins
00032  * @brief Contains runtime parameters for a plugin.
00033  *
00034  * tlp::PluginContext is a data structure containing a set of parameters required by a plugin.
00035  * Each tlp::Plugin subclass has its associated tlp::PluginContext subclass that contains specific parameters related to the Plugin.
00036  * For instance, the tlp::AlgorithmContext (related to tlp::Algorithm) contains the Graph on which the algorithm should be run
00037  * In essence, you will never have to access to a plugin's context since the base class constructor will copy its members into protected members of the plugin interface.
00038  */
00039 class PluginContext {
00040 public:
00041   // Required for dynamic casting
00042   virtual ~PluginContext() {}
00043 };
00044 
00045 /**
00046  * @ingroup Plugins
00047  * @brief Parameters structure for a tlp::Algorithm
00048  *
00049  * This class contains data required for a tlp::Algorithm to run. Each of its member is copied into a protected member at the object construction.
00050  */
00051 class AlgorithmContext : public tlp::PluginContext {
00052 public :
00053   /**
00054    * @brief The pointer to the tlp::Graph on which the algorithm will be run.
00055    */
00056   Graph *graph;
00057 
00058   /**
00059    * @brief Input parameters set by the user when running the plugin.
00060    * @see tlp::DataSet
00061    * @see tlp::WithDependency
00062    */
00063   DataSet *dataSet;
00064 
00065   /**
00066    * @brief A progress handler to notify the user about the progress state of the algorithm when run.
00067    * @see tlp::PluginProgress
00068    */
00069   PluginProgress *pluginProgress;
00070 
00071   AlgorithmContext (tlp::Graph* graph = NULL, tlp::DataSet* dataSet = NULL, tlp::PluginProgress* progress = NULL): graph(graph), dataSet(dataSet), pluginProgress(progress) {}
00072   ~AlgorithmContext() {}
00073 };
00074 
00075 
00076 }
00077 #endif
 All Classes Files Functions Variables Enumerations Enumerator Properties