diff bits/PreservingPluginHandleMapper.h @ 58:c38e12d4bbdd

Merge from branch outputid-string-in-featureset
author Chris Cannam <c.cannam@qmul.ac.uk>
date Mon, 19 Sep 2016 14:48:43 +0100
parents 7aec704705c7
children 8a4bcb3dc3a6
line wrap: on
line diff
--- a/bits/PreservingPluginHandleMapper.h	Wed Sep 14 14:43:37 2016 +0100
+++ b/bits/PreservingPluginHandleMapper.h	Mon Sep 19 14:48:43 2016 +0100
@@ -36,17 +36,25 @@
 #define VAMPIPE_PRESERVING_PLUGIN_HANDLE_MAPPER_H
 
 #include "PluginHandleMapper.h"
+#include "PreservingPluginOutputIdMapper.h"
 
 #include <iostream>
 
 namespace vampipe {
 
+//!!! document -- this is a passthrough thing for a single plugin
+//!!! handle only, it does not use actually valid Plugin pointers at
+//!!! all
+
 class PreservingPluginHandleMapper : public PluginHandleMapper
 {
 public:
-    PreservingPluginHandleMapper() : m_handle(0), m_plugin(0) { }
+    PreservingPluginHandleMapper() :
+        m_handle(0),
+        m_plugin(0),
+        m_omapper(std::make_shared<PreservingPluginOutputIdMapper>()) { }
 
-    virtual int32_t pluginToHandle(Vamp::Plugin *p) const {
+    virtual Handle pluginToHandle(Vamp::Plugin *p) const {
 	if (p == m_plugin) return m_handle;
 	else {
 	    std::cerr << "PreservingPluginHandleMapper: p = " << p
@@ -57,15 +65,26 @@
 	}
     }
 
-    virtual Vamp::Plugin *handleToPlugin(int32_t h) const {
+    virtual Vamp::Plugin *handleToPlugin(Handle h) const {
 	m_handle = h;
 	m_plugin = reinterpret_cast<Vamp::Plugin *>(h);
 	return m_plugin;
     }
 
+    virtual const std::shared_ptr<PluginOutputIdMapper> pluginToOutputIdMapper
+    (Vamp::Plugin *) const {
+        return m_omapper;
+    }
+        
+    virtual const std::shared_ptr<PluginOutputIdMapper> handleToOutputIdMapper
+    (Handle h) const {
+        return m_omapper;
+    }
+    
 private:
-    mutable int32_t m_handle;
+    mutable Handle m_handle;
     mutable Vamp::Plugin *m_plugin;
+    std::shared_ptr<PreservingPluginOutputIdMapper> m_omapper;
 };
 
 }