Tulip  4.6.0
Better Visualization Through Research
library/tulip-core/include/tulip/ExportModule.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 _EXPORTMODULE_H
00023 #define _EXPORTMODULE_H
00024 
00025 #include <iostream>
00026 #include <tulip/Plugin.h>
00027 #include <tulip/Algorithm.h>
00028 
00029 namespace tlp {
00030 
00031 static const std::string EXPORT_CATEGORY = "Export";
00032 
00033 class Graph;
00034 class DataSet;
00035 class PluginProgress;
00036 
00037 /**
00038  * @ingroup Plugins
00039  * @brief The ExportModule class
00040  */
00041 class ExportModule: public tlp::Plugin {
00042 public:
00043   ///
00044   ExportModule(const tlp::PluginContext* context) {
00045     if(context != NULL) {
00046       const tlp::AlgorithmContext* algoritmContext = dynamic_cast<const tlp::AlgorithmContext*>(context);
00047       assert(algoritmContext != NULL);
00048       graph = algoritmContext->graph;
00049       pluginProgress = algoritmContext->pluginProgress;
00050       dataSet = algoritmContext->dataSet;
00051     }
00052   }
00053   ///
00054   virtual ~ExportModule() {}
00055 
00056   virtual std::string category() const {
00057     return EXPORT_CATEGORY;
00058   }
00059   std::string icon() const {
00060     return ":/tulip/gui/icons/32/plugin_import_export.png";
00061   }
00062 
00063   /**
00064    * @brief Gets the extension of the file format this export plugin saves to.
00065    * e.g. a GraphML export would return 'xml'.
00066    *
00067    * @return :string the extension that this export module saves to.
00068    **/
00069   virtual std::string fileExtension() const = 0;
00070 
00071   /**
00072    * @brief The export operations should take place here.
00073    * @param the output stream
00074    * @return bool Whether the export was successful or not.
00075    **/
00076   virtual bool exportGraph(std::ostream &os)=0;
00077   /** It is the root graph*/
00078   Graph *graph;
00079   ///
00080   PluginProgress *pluginProgress;
00081   DataSet *dataSet;
00082 };
00083 
00084 
00085 }
00086 #endif
00087 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties