summaryrefslogtreecommitdiffstats
path: root/src/Common/ModuleManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/ModuleManager.h')
-rw-r--r--src/Common/ModuleManager.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/Common/ModuleManager.h b/src/Common/ModuleManager.h
index de5535f..eb8c800 100644
--- a/src/Common/ModuleManager.h
+++ b/src/Common/ModuleManager.h
@@ -20,8 +20,10 @@
#ifndef MAD_COMMON_MODULEMANAGER_H_
#define MAD_COMMON_MODULEMANAGER_H_
+#include "Module.h"
#include <Core/Configurable.h>
-#include <Core/Initializable.h>
+
+#include <boost/noncopyable.hpp>
#include <map>
#include <stack>
@@ -32,32 +34,31 @@
namespace Mad {
namespace Common {
-class ModuleManager : public Core::Configurable, public Core::Initializable {
+class Application;
+
+class ModuleManager : public Core::Configurable, private boost::noncopyable {
private:
- static ModuleManager moduleManager;
+ friend class Application;
+
+ typedef Module* (*ModuleLoadFunc)(Application*);
+
+ Application *application;
- std::map<std::string, std::pair<lt_dlhandle, bool> > modules;
+ std::map<std::string, std::pair<lt_dlhandle, Module*> > modules;
std::stack<std::string> moduleOrder;
- static int preopenCallback(lt_dlhandle handle);
+ //static int preopenCallback(lt_dlhandle handle);
+
+ ModuleManager(Application *application0);
+ ~ModuleManager();
void unloadModule(const std::string &name);
protected:
- virtual void doInit();
- virtual void doDeinit();
-
virtual bool handleConfigEntry(const Core::ConfigEntry &entry, bool handled);
public:
lt_dlhandle loadModule(const std::string &name);
-
- static ModuleManager* get() {
- if(!moduleManager.isInitialized())
- moduleManager.init();
-
- return &moduleManager;
- }
};
}