#ifndef PLUGIN_PLUGINMANAGER_HH #define PLUGIN_PLUGINMANAGER_HH #include #include #include #include #include #include "Plugin.hh" namespace AMDA { namespace Plugins { /** * logger definition */ extern log4cxx::LoggerPtr gLogger; /** * Exception specific for AMDA::XMLParameterConfigurator module */ struct exception: virtual AMDA_exception { }; /** * Class PluginManager * Description : Manage plugin loading */ class PluginManager: public Singleton { public: // Design pattern friend class Singleton ; /** Loads 'path/PluginName' plugin */ void loadPlugin(const std::string &path, const std::string &sPluginName); /** Loads a plugin which match with: ${sPluginName}/lib/{sPluginName}.so */ void loadPlugin(const std::string &sPluginName); /** Attempt to load all libraries which match with this pattern '.so' */ void loadPluginFromPath(const std::string& pluginsPath); //void loadNeededPlugins(std::listpluginList , const std::string& pluginsPath); void loadPluginFromConfigFile(const char* fileName); /** Get a reference to the list of Plugins */ inline const std::map& getALLPluginLoaded() { return _loadedPlugins; } void registerPlugin(const std::string &pluginName, const std::string &pluginPath); std::string getCurrentPluginPath(){ return _currentPluginPath; } void setCurrentPluginPath(std::string& pluginPath){ _currentPluginPath = pluginPath; } protected: /** Constructor (default one) */ PluginManager() { } /** Copy Constructor (normally should not be used) */ // PluginManager(const PluginManager& /*copied*/) { // } /** Destructor */ virtual ~PluginManager() { } private: /// Map of plugins by their associated file names typedef std::map PluginMap; PluginMap _loadedPlugins; ///< All plugins currently loaded std::string _currentPluginPath; }; } // namespace Plugins } // namespace AMDA #endif // PLUGIN_PLUGINMANAGER_HH