Mania++
 All Classes Functions Variables Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PluginManager Class Reference

Manages the plugins. More...

#include <PluginManager.h>

Public Member Functions

 PluginManager (Config *configPtr, Methods *methodsPtr, CommandManager *commandsPtr, std::map< std::string, Player > *playersPtr, MapList *mapsPtr, sql::Connection *databasePtr, UIManager *uiPtr)
 Initializes the pointers the plugins need. More...
 
 ~PluginManager ()
 Destructor closes all open plugins.
 
void SetEventManager (EventManager *eventManagerPtr)
 Sets the event manager to be used for callbacks. More...
 
void LoadPlugins (std::string pluginsFolder="./plugins")
 Loads the plugins in the specified folder. More...
 
void InitializePlugins ()
 Calls all Init() functions in the plugins (called after loading all plugins).
 

Private Member Functions

std::map< std::string,
std::string > 
discoverPlugins (std::string pluginsFolder)
 Disovers plugin (.so) files in the specified folder.
 

Private Attributes

std::map< std::string, PluginInfoplugins
 Vector of loaded plugins.
 
Configconfig
 Current instance of the Config.
 
CommandManagercommands
 Current instance of the CommandManager.
 
EventManagerevents
 Current instance of the EventManager.
 
Controllercontroller
 Current instance of the controller.
 

Detailed Description

Manages the plugins.

Constructor & Destructor Documentation

PluginManager::PluginManager ( Config configPtr,
Methods methodsPtr,
CommandManager commandsPtr,
std::map< std::string, Player > *  playersPtr,
MapList mapsPtr,
sql::Connection *  databasePtr,
UIManager uiPtr 
)

Initializes the pointers the plugins need.

Parameters
configPtrCurrent instance of Config.
methodsPtrCurrent instance of Methods.
commandsPtrCurrent instance of the CommandManager.
playersPtrCurrent instance of the playerlist.
mapsPtrCurrent instance of the maplist.
databasePtrCurrent instance of the database connection.
uiPtrCurrent instance of the interface manager.

Member Function Documentation

void PluginManager::LoadPlugins ( std::string  pluginsFolder = "./plugins")

Loads the plugins in the specified folder.

Parameters
pluginsFolderRelative path to the plugins folder.
void PluginManager::SetEventManager ( EventManager eventManagerPtr)

Sets the event manager to be used for callbacks.

Parameters
eventManagerPtrInstance of EventManager.

The documentation for this class was generated from the following files: