Blame view

src/Plugins/PluginManager.hh 2.23 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef PLUGIN_PLUGINMANAGER_HH
#define PLUGIN_PLUGINMANAGER_HH

#include <string>
#include <map>
#include <dsgpatt_Singleton.hh>
#include <log4cxx/logger.h>

#include <AMDA_exception.hh>
#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<PluginManager> {

public:
	// Design pattern
	friend class Singleton<PluginManager> ;

	/**
	 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);
bf54b7d4   Hacene SI HADJ MOHAND   not woring yet
49
50
        
        //void loadNeededPlugins(std::list<std::string>pluginList , const std::string& pluginsPath);
fbe3c2bb   Benjamin Renard   First commit
51
52
53
54
55
56
57
58
59
60
61
62
63

	void loadPluginFromConfigFile(const char* fileName);


	/**
	 Get a reference to the list of Plugins
	 */
	inline const std::map<std::string, Plugin>& getALLPluginLoaded() {
		return _loadedPlugins;
	}

	void registerPlugin(const std::string &pluginName,
			const std::string &pluginPath);
3caf58ee   Hacene SI HADJ MOHAND   compil mais march...
64
65
66
67
68
69
70
71
        
                    std::string getCurrentPluginPath(){
                        return _currentPluginPath; 
                    }
                    
                     void setCurrentPluginPath(std::string& pluginPath){
                        _currentPluginPath =  pluginPath;
                    }
fbe3c2bb   Benjamin Renard   First commit
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

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<std::string, Plugin> PluginMap;
	PluginMap _loadedPlugins;  ///< All plugins currently loaded
3caf58ee   Hacene SI HADJ MOHAND   compil mais march...
97
                    std::string _currentPluginPath; 
fbe3c2bb   Benjamin Renard   First commit
98
99
100
101
102
103
};

} // namespace Plugins
} // namespace AMDA

#endif // PLUGIN_PLUGINMANAGER_HH