Adds all COM plugins to the given vector. Takes care of sorting them by group info (ID and position). @param p_COMPluginProvider Object to access registered COM plugins. @param p_rvspPlugins Vector where to store plugins.
| 241 | // @param p_rvspPlugins Vector where to store plugins. |
| 242 | // |
| 243 | void PluginsRegistry::GetCOMPlugins(const COMPluginProvider& p_COMPluginProvider, |
| 244 | PluginSPV& p_rvspPlugins) |
| 245 | { |
| 246 | // Get list of COM plugins from settings. |
| 247 | CLSIDV vPluginCLSIDs = p_COMPluginProvider.GetCOMPlugins(); |
| 248 | if (!vPluginCLSIDs.empty()) { |
| 249 | // Load list of plugins by creating the COM objects and store group IDs and positions. |
| 250 | COMPluginInfoV vCOMPluginInfos; |
| 251 | for (const CLSID& clsid : vPluginCLSIDs) { |
| 252 | try { |
| 253 | COMPluginInfo pluginInfo; |
| 254 | pluginInfo.m_CLSID = clsid; |
| 255 | pluginInfo.m_spPlugin = std::make_shared<Plugins::COMPlugin>(clsid); |
| 256 | pluginInfo.m_GroupId = pluginInfo.m_spPlugin->GroupId(); |
| 257 | pluginInfo.m_GroupPosition = pluginInfo.m_spPlugin->GroupPosition(); |
| 258 | |
| 259 | // Only care about position if the group ID is set. |
| 260 | if (pluginInfo.m_GroupId == 0) { |
| 261 | pluginInfo.m_GroupPosition = 0; |
| 262 | } |
| 263 | vCOMPluginInfos.push_back(std::move(pluginInfo)); |
| 264 | } catch (const Plugins::COMPluginError&) { |
| 265 | // The plugin is not functional, simply skip it. |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | // Check if we have some plugins left. We might fail to load them. |
| 270 | if (!vCOMPluginInfos.empty()) { |
| 271 | // Sort plugins by group ID and position. |
| 272 | if (vCOMPluginInfos.size() > 1) { |
| 273 | std::stable_sort(vCOMPluginInfos.begin(), vCOMPluginInfos.end()); |
| 274 | } |
| 275 | |
| 276 | // Register all plugins. Insert a separator between each group. |
| 277 | PluginSP spSeparator = std::make_shared<PluginSeparator>(); |
| 278 | ULONG currentGroup = 0xFFFFFFFF; |
| 279 | for (const COMPluginInfo& pluginInfo : vCOMPluginInfos) { |
| 280 | if (pluginInfo.m_GroupId != currentGroup) { |
| 281 | p_rvspPlugins.push_back(spSeparator); |
| 282 | } |
| 283 | p_rvspPlugins.push_back(pluginInfo.m_spPlugin); |
| 284 | currentGroup = pluginInfo.m_GroupId; |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | // |
| 291 | // Adds pipeline plugins to the given vector. |