Plugin *PluginFactory::createPlugin( const PluginInfoPair& pair ) { PluginInfo *pluginInfo = pair.first; //create plugin PTRACE( 6, "Creating plugin " << pluginInfo->name ); Plugin *plugin = pluginInfo->create(); if ( !plugin ) { PTRACE( 1, "Creation of plugin " << pluginInfo->name << " failed" ); return 0; } //insert plugin to appropriate list according to its type Plugin::Type type = pluginInfo->type; PluginList& list = pluginMap[ type ]; list.append( plugin ); idMap[pluginInfo->id] = plugin; PTRACE( 6, "Initializing plugin..." ); plugin->init(args); return plugin; }