diff bits/PluginOutputIdMapper.h @ 51:f4244a2d55ac

Introduce and use output id mappers
author Chris Cannam <c.cannam@qmul.ac.uk>
date Fri, 16 Sep 2016 15:10:57 +0100
parents 12e3b396544c
children 8a4bcb3dc3a6
line wrap: on
line diff
--- a/bits/PluginOutputIdMapper.h	Fri Sep 16 14:15:41 2016 +0100
+++ b/bits/PluginOutputIdMapper.h	Fri Sep 16 15:10:57 2016 +0100
@@ -42,31 +42,14 @@
 
 namespace vampipe {
 
+//!!! doc interface
 class PluginOutputIdMapper
 {
 public:
-    PluginOutputIdMapper(Vamp::Plugin *p) {
-	Vamp::Plugin::OutputList outputs = p->getOutputDescriptors();
-	for (const auto &d: outputs) {
-	    m_ids.push_back(d.identifier);
-	}
-    }
-
-    int idToIndex(std::string outputId) const {
-	int n = int(m_ids.size());
-	for (int i = 0; i < n; ++i) {
-	    if (outputId == m_ids[i]) {
-		return i;
-	    }
-	}
-    }
-
-    std::string indexToId(int index) const {
-	return m_ids[index];
-    }
-
-private:
-    std::vector<std::string> m_ids;
+    virtual ~PluginOutputIdMapper() { }
+    
+    virtual int idToIndex(std::string outputId) const = 0;
+    virtual std::string indexToId(int index) const = 0;
 };
 
 }