Tulip  4.6.0
Better Visualization Through Research
library/tulip-core/include/tulip/ImportModule.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 ///@cond DOXYGEN_HIDDEN
00020 
00021 
00022 #ifndef _IMPORTMODULE_H
00023 #define _IMPORTMODULE_H
00024 
00025 #include <tulip/Plugin.h>
00026 
00027 #include <list>
00028 #include <string>
00029 
00030 namespace tlp {
00031 
00032 static const std::string IMPORT_CATEGORY = "Import";
00033 
00034 class PluginProgress;
00035 class Graph;
00036 class DataSet;
00037 
00038 
00039 /**
00040  * @addtogroup Plugins
00041  * @brief Base class for import plug-ins.
00042 **/
00043 class ImportModule : public tlp::Plugin {
00044 public:
00045   /**
00046   * @brief Initializes the DataSet to the one passed in the context.
00047   *
00048   * @param context The context this import plug-in runs into.
00049   **/
00050   ImportModule (const tlp::PluginContext* context) {
00051     if(context != NULL) {
00052       const tlp::AlgorithmContext* algoritmContext = dynamic_cast<const tlp::AlgorithmContext*>(context);
00053       assert(algoritmContext != NULL);
00054       graph = algoritmContext->graph;
00055       pluginProgress = algoritmContext->pluginProgress;
00056       dataSet = algoritmContext->dataSet;
00057     }
00058   }
00059 
00060   virtual std::list<std::string> fileExtensions() const {
00061     return std::list<std::string>();
00062   }
00063 
00064   virtual std::string getGroup() const {
00065     return "Import";
00066   }
00067 
00068   virtual std::string category() const {
00069     return IMPORT_CATEGORY;
00070   }
00071   std::string icon() const {
00072     return ":/tulip/gui/icons/32/plugin_import_export.png";
00073   }
00074 
00075   /**
00076   * @brief The import operations should take place here.
00077   *
00078   * @return bool Whether the import was successful or not.
00079   **/
00080   virtual bool importGraph()=0;
00081 
00082   /**
00083   * @brief The Graph in which to write the data to import.
00084   **/
00085   Graph *graph;
00086 
00087   /**
00088   * @brief A means to report progress to the user.
00089   **/
00090   PluginProgress *pluginProgress;
00091 
00092   /**
00093   * @brief A container for the parameters of this import plug-in.
00094   **/
00095   DataSet *dataSet;
00096 };
00097 
00098 
00099 }
00100 #endif
00101 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties