12 template<
typename __C,
typename __P>
15 __C* newInstance = NULL;
20 LOG_INFO() <<
"Loading module "<<pluginsInfo[pluginName]<<std::endl;
21 loadModule(pluginsInfo[pluginName]);
27 loadedModulesInfo[pluginsInfo[pluginName]].refCount++;
31 pluginInstancesInfo.insert(std::pair<void*, std::string>(newInstance, pluginName));
38 template<
typename __C>
41 if (pluginInstancesInfo.find(instance) == pluginInstancesInfo.end())
43 LOG_ERROR() <<
"Plugin instance "<<(
long long)instance<<
" was not created using getPluginInstance"<<std::endl;
46 std::string moduleName = getPluginModuleName(pluginInstancesInfo[instance]);
47 loadedModulesInfo[moduleName].refCount--;
48 pluginInstancesInfo.erase(instance);
50 if (loadedModulesInfo[moduleName].refCount <= 0)
52 LOG_INFO() <<
"Unloading module "<<moduleName<<std::endl;
__C * getPluginInstance(const std::string &pluginName, const __P ¶ms)
Creates instance of a plugin using plugin specific parameters to initialize it.
Definition: PluginManagerTemplates.hpp:13
virtual __C * newIstance(const __P &)=0
#define LOG_ERROR()
Definition: Log.hpp:117
Definition: Plugin.hpp:133
bool isPluginAvailable(const std::string &pluginName) const
Checks if given plugin is provided by any module.
Definition: PluginManager.cpp:121
void freePluginInstance(__C *instance)
Frees plugin instance created by getPluginInstance function. Apart from removing instance it will che...
Definition: PluginManagerTemplates.hpp:39
#define LOG_INFO()
Definition: Log.hpp:135