changeset 1377:f1c4ca3ccaa3 dev/refactor-piper-related

Change setDesiredExtractor signature to take ServerDescription aggregate.
author Lucas Thompson <lucas.thompson@qmul.ac.uk>
date Fri, 10 Feb 2017 11:30:29 +0000
parents d9511f9e04d7
children
files plugin/PiperVampPluginFactory.cpp plugin/PiperVampPluginFactory.h
diffstat 2 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/plugin/PiperVampPluginFactory.cpp	Fri Feb 10 11:15:19 2017 +0000
+++ b/plugin/PiperVampPluginFactory.cpp	Fri Feb 10 11:30:29 2017 +0000
@@ -64,7 +64,7 @@
         for (auto platformHelper: hep.getHelperExecutables(QString::fromStdString(server.name)))
             m_servers.push_back(platformHelper);
         if (server.hasDesiredExtractors) {
-            setDesiredExtractors(server.name, server.extractors);
+            setDesiredExtractors(server);
         }
     }
 
@@ -92,17 +92,16 @@
 }
 
 void 
-PiperVampPluginFactory::setDesiredExtractors(ServerName name, 
-                                             DesiredExtractors extractors)
+PiperVampPluginFactory::setDesiredExtractors(ServerDescription description)
 {
     const bool isValidServerName = std::find_if(
         m_servers.begin(), 
         m_servers.end(), 
-        [&name](const HelperExecPath::HelperExec &h) -> bool {
-            return QFileInfo(h.executable).fileName().toStdString() == name;       
+        [&description](const HelperExecPath::HelperExec &h) -> bool {
+            return QFileInfo(h.executable).fileName().toStdString() == description.name;       
         }) != m_servers.end();
-    if ( isValidServerName ) {
-        m_overrideDesiredExtractors[name] = extractors;
+    if ( isValidServerName && description.hasDesiredExtractors ) {
+        m_overrideDesiredExtractors[description.name] = description.extractors;
     }
 }
 
--- a/plugin/PiperVampPluginFactory.h	Fri Feb 10 11:15:19 2017 +0000
+++ b/plugin/PiperVampPluginFactory.h	Fri Feb 10 11:30:29 2017 +0000
@@ -61,7 +61,7 @@
     PiperVampPluginFactory();
     PiperVampPluginFactory(std::initializer_list<ServerDescription> servers);
     
-    virtual void setDesiredExtractors(ServerName name, DesiredExtractors extractors);
+    virtual void setDesiredExtractors(ServerDescription description);
     
     virtual ~PiperVampPluginFactory();