Mania++
 All Classes Functions Variables Pages
PluginManager.h
1 #ifndef PLUGINMANAGER_H_
2 #define PLUGINMANAGER_H_
3 
4 #include <string>
5 #include <vector>
6 #include <iostream>
7 #include <dirent.h>
8 #include <stdio.h>
9 #include <dlfcn.h>
10 
11 #include "../Config/Config.h"
12 #include "../Events/EventManager.h"
13 #include "../Commands/CommandManager.h"
14 #include "../Methods/Methods.h"
15 
16 #include "PluginHandler.h"
17 #include "Plugin.h"
18 
19 //* PluginManager
24 {
25 public:
38  PluginManager(Config* configPtr, Methods* methodsPtr, CommandManager* commandsPtr, std::map<std::string, Player>* playersPtr, MapList* mapsPtr, sql::Connection* databasePtr, UIManager* uiPtr, ServerInfo* serverInfoPtr);
39 
44 
50  void SetEventManager(EventManager* eventManagerPtr);
51 
57  void LoadPlugins(std::string pluginsFolder = "./plugins");
58 
62  void InitializePlugins();
63 
69  void DisplayPluginList(Player player);
70 
71 private:
75  std::map<std::string, std::string> discoverPlugins(std::string pluginsFolder);
76 
77  std::map<std::string, PluginInfo> plugins;
83 };
84 
85 #endif // PLUGINMANAGER_H_
void InitializePlugins()
Calls all Init() functions in the plugins (called after loading all plugins).
Definition: PluginManager.cpp:168
Manages the plugins.
Definition: PluginManager.h:23
std::map< std::string, PluginInfo > plugins
Vector of loaded plugins.
Definition: PluginManager.h:77
Manages the user interface on the server (ManiaLinks).
Definition: UIManager.h:17
std::map< std::string, std::string > discoverPlugins(std::string pluginsFolder)
Disovers plugin (.so) files in the specified folder.
Definition: PluginManager.cpp:180
Contains all information about a player in easy-to-use format.
Definition: Player.h:11
Reads and stores configuration information.
Definition: Config.h:67
void SetEventManager(EventManager *eventManagerPtr)
Sets the event manager to be used for callbacks.
Definition: PluginManager.cpp:58
Contains the maplist and a pointer to the current map.
Definition: MapList.h:10
Contains all server methods and returns usable data types.
Definition: Methods.h:15
Controller * controller
Current instance of the controller.
Definition: PluginManager.h:81
EventManager * events
Current instance of the EventManager.
Definition: PluginManager.h:80
Definition: PluginHandler.h:27
~PluginManager()
Destructor closes all open plugins.
Definition: PluginManager.cpp:39
Struct with all instances needed for plugins.
Definition: Plugin.h:35
CommandManager * commands
Current instance of the CommandManager.
Definition: PluginManager.h:79
PluginManager(Config *configPtr, Methods *methodsPtr, CommandManager *commandsPtr, std::map< std::string, Player > *playersPtr, MapList *mapsPtr, sql::Connection *databasePtr, UIManager *uiPtr, ServerInfo *serverInfoPtr)
Initializes the pointers the plugins need.
Definition: PluginManager.cpp:3
PluginHandler * pluginHandler
Current plugin handler.
Definition: PluginManager.h:82
void LoadPlugins(std::string pluginsFolder="./plugins")
Loads the plugins in the specified folder.
Definition: PluginManager.cpp:65
Config * config
Current instance of the Config.
Definition: PluginManager.h:78
Handles events (callbacks) from server to plugins.
Definition: EventManager.h:15
Manages the chat commands.
Definition: CommandManager.h:17
void DisplayPluginList(Player player)
Displays the plugin list to the admin.
Definition: PluginsUI.cpp:3
Struct with server information.
Definition: Structs.h:41