#include <PluginManager.hpp>
Public Member Functions | |
void | setErrorLogging (bool enable) |
Set error logging. | |
const bool | getErrorLogging () const |
Get error logging. | |
bool | load (const std::string &name) |
Load a plugin. | |
bool | unload (const std::string &name) |
Unload a plugin. | |
const PluginDescriptor * | getDescriptor (const std::string &name) const |
Get the descriptor of a loaded plugin. | |
Static Public Member Functions | |
static bool | initializeSingleton (Core::Logger *pLogger) |
Initialize singleton. | |
static PluginManager * | getSingleton (Core::Logger *pLogger) |
Retrieve singleton instance. | |
static void | terminateSingleton (Core::Logger *pLogger) |
Terminate singleton. | |
Private Member Functions | |
PluginManager (Core::Logger *pLogger) | |
Constructor. | |
~PluginManager () | |
Destructor. | |
Private Attributes | |
Core::Logger * | m_pLogger |
Pointer to the logger to be used. | |
bool | m_errorLogging |
Error logging:. | |
std::map < std::string, PluginEntry > | m_mapPlugins |
Static Private Attributes | |
static PluginManager * | sm_pSingleton = NULL |
Singleton instance. |
It is the class responsible of handling plugins loading and management.
syBR::Game::PluginManager::PluginManager | ( | Core::Logger * | pLogger | ) | [private] |
Constructor.
pLogger | Pointer to the instance of the logger to use |
syBR::Game::PluginManager::~PluginManager | ( | ) | [private] |
Destructor.
bool syBR::Game::PluginManager::initializeSingleton | ( | Core::Logger * | pLogger | ) | [static] |
Initialize singleton.
Create a new instance of the plugin manager only if none already exists.
pLogger | Pointer to the instance of the logger to use |
PluginManager * syBR::Game::PluginManager::getSingleton | ( | Core::Logger * | pLogger | ) | [static] |
Retrieve singleton instance.
pLogger | Pointer to the instance of the logger to use |
void syBR::Game::PluginManager::terminateSingleton | ( | Core::Logger * | pLogger | ) | [static] |
Terminate singleton.
pLogger | Pointer to the instance of the logger to use |
void syBR::Game::PluginManager::setErrorLogging | ( | bool | enable | ) |
Set error logging.
Most of the time, this shouldn't be called and the default value (true) should be used. However, in some cases, it is cleaner to not log errors i.e. when writing a tool to select plugins, it would be useful not not display errors as a lot of unrelated dynamic libraries would be loaded by the plugin manager only to find that they are not plugins.
Note that this does not enable/disable all error messages but only those related to the plugin loading/unloading.
enable | One of the following values:
|
const bool syBR::Game::PluginManager::getErrorLogging | ( | ) | const |
Get error logging.
bool syBR::Game::PluginManager::load | ( | const std::string & | name | ) |
Load a plugin.
Load a plugin and retrieve its descriptor.
name | Filename of the plugin |
bool syBR::Game::PluginManager::unload | ( | const std::string & | name | ) |
Unload a plugin.
Remove plugin descriptor and unload plugin
name | Name of the plugin to unload |
const PluginDescriptor * syBR::Game::PluginManager::getDescriptor | ( | const std::string & | name | ) | const |
Get the descriptor of a loaded plugin.
name | Name of the plugin whose descriptor is to be retrieved |
PluginManager * syBR::Game::PluginManager::sm_pSingleton = NULL [static, private] |
Singleton instance.
Core::Logger* syBR::Game::PluginManager::m_pLogger [private] |
Pointer to the logger to be used.
bool syBR::Game::PluginManager::m_errorLogging [private] |
Error logging:.
It can have the following values:
std::map<std::string, PluginEntry> syBR::Game::PluginManager::m_mapPlugins [private] |
Map of loaded plugins
Copyright © 2008 by Sebastien Frippiat
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:33 2008