loader.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __PLUGIN_LOADER_H_
00025 #define __PLUGIN_LOADER_H_
00026
00027 #include <core/plugin.h>
00028 #include <core/exception.h>
00029
00030 #include <string>
00031
00032 namespace fawkes {
00033 #if 0
00034 }
00035 #endif
00036
00037 class Module;
00038 class Configuration;
00039 class PluginLoaderData;
00040
00041 class PluginLoadException : public Exception
00042 {
00043 public:
00044 PluginLoadException(const char *plugin, const char *message);
00045 PluginLoadException(const char *plugin, const char *message, Exception &e);
00046 ~PluginLoadException() throw();
00047
00048 std::string plugin_name() const;
00049
00050 private:
00051 std::string __plugin_name;
00052 };
00053
00054 class PluginUnloadException : public Exception
00055 {
00056 public:
00057 PluginUnloadException(const char *plugin_type, const char *add_msg = NULL);
00058 };
00059
00060
00061 class PluginLoader {
00062 public:
00063
00064 PluginLoader(const char *plugin_base_dir, Configuration *config);
00065 ~PluginLoader();
00066
00067 Plugin * load(const char *plugin_name);
00068 void unload(Plugin *plugin);
00069
00070 std::string get_description(const char *plugin_name);
00071
00072 bool is_loaded(const char *plugin_name);
00073
00074 private:
00075 Module * open_module(const char *plugin_name);
00076 Plugin * create_instance(const char *plugin_name, Module *module);
00077
00078 private:
00079 PluginLoaderData *d;
00080 Configuration *__config;
00081 };
00082
00083
00084 }
00085
00086 #endif