Tulip  4.6.0
Better Visualization Through Research
library/tulip-core/include/tulip/PluginLoader.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 
00020 #ifndef TLP_PLUGINLOADER
00021 #define TLP_PLUGINLOADER
00022 #include <list>
00023 #include <string>
00024 #include <tulip/WithDependency.h>
00025 
00026 namespace tlp {
00027 
00028 class Plugin;
00029 
00030 /**
00031  * @ingroup Plugins
00032  *
00033  * @brief A callback class when loading plugins into Tulip
00034  *
00035  * This interface can be subclassed and passed to the tlp::PluginLibraryLoader to implement custom event handling when loading plugins into Tulip
00036  *
00037  * @see tlp::PluginLibraryLoader
00038  * @see tlp::PluginLoaderTxt
00039  */
00040 struct TLP_SCOPE PluginLoader {
00041   virtual ~PluginLoader() {}
00042 
00043   /**
00044    * @brief Called when starting to load plugins into a given directory
00045    * @param path The absolute path of the directory
00046    */
00047   virtual void start(const std::string &path)=0;
00048 
00049   /**
00050    * @brief Indicates the number of files to be loaded
00051    * @param int the number of files
00052    */
00053   virtual void numberOfFiles(int) {}
00054 
00055   /**
00056    * @brief Indicates that a new file is being loaded
00057    * @param filename The absolute path of the file
00058    */
00059   virtual void loading(const std::string &filename)=0;
00060 
00061   /**
00062    * @brief Indicates that a plugin has been loaded sucessfully
00063    * @param infos The Plugin object that has just been loaded
00064    * @param dependencies The plugin dependencies
00065    *
00066    * @see tlp::Dependency
00067    */
00068   virtual void loaded(const Plugin* infos, const std::list <Dependency>& dependencies)=0;
00069 
00070   /**
00071    * @brief Indicates that an error occurred when trying to load a file.
00072    * @param filename The absolute path of where the error occured.
00073    * @param errormsg A human-readable error message.
00074    */
00075   virtual void aborted(const std::string &filename,const  std::string &errormsg)=0;
00076 
00077   /**
00078    * @brief Indicates that a file has finished being loaded
00079    * @param state true if the file was loaded sucessfully
00080    * @param msg An additional human-readable message about the load state
00081    */
00082   virtual void finished(bool state,const std::string &msg)=0;
00083 };
00084 
00085 }
00086 #endif
 All Classes Files Functions Variables Enumerations Enumerator Properties