2 /***************************************************************************
3 * loader.h - Loads plugins from .so shared objects
5 * Created: Wed Aug 23 15:18:13 2006
6 * Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
8 ****************************************************************************/
10 /* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. A runtime exception applies to
14 * this software (see LICENSE.GPL_WRE file mentioned below for details).
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
21 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
24 #ifndef __PLUGIN_LOADER_H_
25 #define __PLUGIN_LOADER_H_
27 #include <core/plugin.h>
28 #include <core/exception.h>
33 #if 0 /* just to make Emacs auto-indent happy */
39 class PluginLoaderData;
41 class PluginLoadException : public Exception
44 PluginLoadException(const char *plugin, const char *message);
45 PluginLoadException(const char *plugin, const char *message, Exception &e);
46 ~PluginLoadException() throw();
48 std::string plugin_name() const;
51 std::string __plugin_name;
54 class PluginUnloadException : public Exception
57 PluginUnloadException(const char *plugin_type, const char *add_msg = NULL);
64 PluginLoader(const char *plugin_base_dir, Configuration *config);
67 Plugin * load(const char *plugin_name);
68 void unload(Plugin *plugin);
70 std::string get_description(const char *plugin_name);
72 bool is_loaded(const char *plugin_name);
75 Module * open_module(const char *plugin_name);
76 Plugin * create_instance(const char *plugin_name, Module *module);
80 Configuration *__config;
84 } // end namespace fawkes