Otclient  14/8/2020
modulemanager.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2020 OTClient <https://github.com/edubart/otclient>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 
23 #ifndef MODULEMANAGER_H
24 #define MODULEMANAGER_H
25 
26 #include "module.h"
27 
28 // @bindsingleton g_modules
30 {
31 public:
32  void clear();
33 
34  void discoverModules();
35  void autoLoadModules(int maxPriority);
36  ModulePtr discoverModule(const std::string& moduleFile);
37  void ensureModuleLoaded(const std::string& moduleName);
38  void unloadModules();
39  void reloadModules();
40 
41  ModulePtr getModule(const std::string& moduleName);
42  std::deque<ModulePtr> getModules() { return m_modules; }
43 
44 protected:
45  void updateModuleLoadOrder(ModulePtr module);
46 
47  friend class Module;
48 
49 private:
50  std::deque<ModulePtr> m_modules;
51  std::multimap<int, ModulePtr> m_autoLoadModules;
52 };
53 
55 
56 #endif
ModuleManager::getModule
ModulePtr getModule(const std::string &moduleName)
Definition: modulemanager.cpp:125
ModuleManager::getModules
std::deque< ModulePtr > getModules()
Definition: modulemanager.h:42
module.h
ModuleManager::reloadModules
void reloadModules()
Definition: modulemanager.cpp:106
ModuleManager::clear
void clear()
Definition: modulemanager.cpp:31
ModuleManager
Definition: modulemanager.h:29
ModuleManager::unloadModules
void unloadModules()
Definition: modulemanager.cpp:99
g_modules
ModuleManager g_modules
Definition: modulemanager.cpp:29
ModuleManager::updateModuleLoadOrder
void updateModuleLoadOrder(ModulePtr module)
Definition: modulemanager.cpp:133
ModuleManager::autoLoadModules
void autoLoadModules(int maxPriority)
Definition: modulemanager.cpp:55
ModuleManager::discoverModule
ModulePtr discoverModule(const std::string &moduleFile)
Definition: modulemanager.cpp:66
ModuleManager::discoverModules
void discoverModules()
Definition: modulemanager.cpp:37
Module
Definition: module.h:32
stdext::shared_object_ptr
Definition: shared_object.h:39
ModuleManager::ensureModuleLoaded
void ensureModuleLoaded(const std::string &moduleName)
Definition: modulemanager.cpp:92