-
Notifications
You must be signed in to change notification settings - Fork 2
/
modulemanager.h
41 lines (29 loc) · 884 Bytes
/
modulemanager.h
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
#ifndef HTTP_MODULEMANAGER_H
#define HTTP_MODULEMANAGER_H
#include "module.h"
namespace openrc {
class ModuleManager
{
typedef std::map<std::string, IModule*> ModuleMap;
public:
ModuleManager();
~ModuleManager();
void RegisterModule(const std::string& moduleName, IModule* module);
void InitializeAll();
void ShutdownAll();
void LoadModuleFromFile(const std::string& filepath);
void LoadModulesFromFolder(const std::string& folderPath);
static ModuleManager& Instance();
template<typename TModule>
static TModule& RegisterModule( const std::string& moduleName )
{
TModule* module = new TModule();
ModuleManager& moduleManager = Instance();
ModuleManager::RegisterModule(moduleName, module);
return *module;
}
protected:
ModuleMap _modules;
};
} // End http.
#endif // MODULEMANAGER_H