00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00025 #ifndef PLUMA_PLUGIN_MANAGER_HPP
00026 #define PLUMA_PLUGIN_MANAGER_HPP
00027
00029
00031 #include <Pluma/Config.hpp>
00032 #include <Pluma/Host.hpp>
00033
00034 #include <string>
00035 #include <map>
00036
00037 namespace pluma{
00038 class DLibrary;
00039
00044 class PLUMA_API PluginManager{
00045
00046
00047 public:
00048
00053 ~PluginManager();
00054
00071 bool load(const std::string& path);
00072
00073
00091 bool load(const std::string& folder, const std::string& pluginName);
00092
00107 int loadFromFolder(const std::string& folder, bool recursive = false);
00108
00123 bool unload(const std::string& pluginName);
00124
00134 void unloadAll();
00135
00142 bool addProvider(Provider* provider);
00143
00150 void getLoadedPlugins(std::vector<const std::string*>& pluginNames) const;
00151
00158 bool isLoaded(const std::string& pluginName) const;
00159
00160
00161 protected:
00162
00169 PluginManager();
00170
00181 void registerType(const std::string& type, unsigned int version, unsigned int lowestVersion);
00182
00194 const std::list<Provider*>* getProviders(const std::string& type) const;
00195
00196
00197 private:
00198
00212 static std::string getPluginName(const std::string& path);
00213
00229 static std::string resolvePathExtension(const std::string& path);
00230
00231
00232 private:
00233
00235 typedef bool fnRegisterPlugin(Host&);
00236 typedef std::map<std::string,DLibrary*> LibMap;
00237
00238 LibMap libraries;
00239 Host host;
00240
00241 };
00242
00243 }
00244
00245 #endif // PLUMA_PLUGIN_MANAGER_HPP