Fawkes API
Fawkes Development Version
loader.h
1
2
/***************************************************************************
3
* loader.h - Loads plugins from .so shared objects
4
*
5
* Created: Wed Aug 23 15:18:13 2006
6
* Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
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).
15
*
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.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#ifndef _PLUGIN_LOADER_H_
25
#define _PLUGIN_LOADER_H_
26
27
#include <core/exception.h>
28
#include <core/plugin.h>
29
30
#include <string>
31
32
namespace
fawkes
{
33
34
class
Module;
35
class
Configuration;
36
class
ModuleManager;
37
38
class
PluginLoadException :
public
Exception
39
{
40
public
:
41
PluginLoadException
(
const
char
*plugin,
const
char
*message);
42
PluginLoadException
(
const
char
*plugin,
const
char
*message,
Exception
&e);
43
~PluginLoadException
() throw();
44
45
std::
string
plugin_name
() const;
46
47
private:
48
std::
string
plugin_name_;
49
};
50
51
class
PluginUnloadException
: public
Exception
52
{
53
public
:
54
PluginUnloadException
(
const
char
*plugin_type,
const
char
*add_msg = NULL);
55
};
56
57
class
PluginLoader
58
{
59
public
:
60
PluginLoader
(
const
char
*plugin_base_dir,
Configuration
*config);
61
~
PluginLoader
();
62
63
Plugin
*load(
const
char
*
plugin_name
);
64
void
unload(
Plugin
*plugin);
65
66
std::string get_description(
const
char
*
plugin_name
);
67
68
bool
is_loaded(
const
char
*
plugin_name
);
69
70
ModuleManager
*get_module_manager()
const
;
71
72
private
:
73
Module
* open_module(
const
char
*
plugin_name
);
74
std::string get_string_symbol(
const
char
*
plugin_name
,
75
const
char
*symbol_name,
76
const
char
*section_name =
".fawkes_plugin"
);
77
Plugin
* create_instance(
const
char
*
plugin_name
,
Module
*module);
78
79
private
:
80
class
Data;
81
82
Data * d_;
83
Configuration
*config_;
84
std::string plugin_base_dir_;
85
};
86
87
}
// end namespace fawkes
88
89
#endif
fawkes::PluginLoadException::~PluginLoadException
~PluginLoadException()
Destructor.
Definition:
loader.cpp:73
fawkes::Exception::Exception
Exception()
Constructor for subclasses.
Definition:
exception.cpp:253
fawkes::PluginLoader
Definition:
loader.h:63
fawkes::PluginUnloadException
Definition:
loader.h:57
fawkes::Configuration
Definition:
config.h:70
fawkes::PluginLoadException::plugin_name
std::string plugin_name() const
Get name of plugin which failed to load.
Definition:
loader.cpp:93
fawkes::PluginLoadException::PluginLoadException
PluginLoadException(const char *plugin, const char *message)
Constructor.
Definition:
loader.cpp:66
fawkes
fawkes::ModuleManager
Definition:
module_manager.h:43
fawkes::Plugin
Definition:
plugin.h:39
fawkes::Module
Definition:
module.h:47
fawkes::Exception
Definition:
exception.h:41
src
libs
plugin
loader.h
Generated by
1.8.17