Tulip  5.1.0
Large graphs analysis and drawing
PluginLoader.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 
20 #ifndef TLP_PLUGINLOADER
21 #define TLP_PLUGINLOADER
22 #include <list>
23 #include <string>
24 #include <tulip/WithDependency.h>
25 
26 namespace tlp {
27 
28 class Plugin;
29 
30 /**
31  * @ingroup Plugins
32  *
33  * @brief A callback class when loading plugins into Tulip
34  *
35  * This interface can be subclassed and passed to the tlp::PluginLibraryLoader to implement custom event handling when loading plugins into Tulip
36  *
37  * @see tlp::PluginLibraryLoader
38  * @see tlp::PluginLoaderTxt
39  */
40 struct TLP_SCOPE PluginLoader {
41  virtual ~PluginLoader() {}
42 
43  /**
44  * @brief Called when starting to load plugins into a given directory
45  * @param path The absolute path of the directory
46  */
47  virtual void start(const std::string &path)=0;
48 
49  /**
50  * @brief Indicates the number of files to be loaded
51  * @param int the number of files
52  */
53  virtual void numberOfFiles(int) {}
54 
55  /**
56  * @brief Indicates that a new file is being loaded
57  * @param filename The absolute path of the file
58  */
59  virtual void loading(const std::string &filename)=0;
60 
61  /**
62  * @brief Indicates that a plugin has been loaded sucessfully
63  * @param info The Plugin object that has just been loaded
64  * @param dependencies The plugin dependencies
65  *
66  * @see tlp::Dependency
67  */
68  virtual void loaded(const Plugin* info, const std::list <Dependency>& dependencies)=0;
69 
70  /**
71  * @brief Indicates that an error occurred when trying to load a file.
72  * @param filename The absolute path of where the error occured.
73  * @param errormsg A human-readable error message.
74  */
75  virtual void aborted(const std::string &filename,const std::string &errormsg)=0;
76 
77  /**
78  * @brief Indicates that a file has finished being loaded
79  * @param state true if the file was loaded sucessfully
80  * @param msg An additional human-readable message about the load state
81  */
82  virtual void finished(bool state,const std::string &msg)=0;
83 };
84 
85 }
86 #endif
virtual void numberOfFiles(int)
Indicates the number of files to be loaded.
Definition: PluginLoader.h:53
Top-level interface for plug-ins.
Definition: Plugin.h:79
A callback class when loading plugins into Tulip.
Definition: PluginLoader.h:40