diff utilities/json-to-capnp.cpp @ 40:55d69b26d4db

Pull out CountingPluginHandleMapper; consts
author Chris Cannam <c.cannam@qmul.ac.uk>
date Mon, 22 Aug 2016 17:16:44 +0100
parents d678cd00e593
children a98ef4c2616b
line wrap: on
line diff
--- a/utilities/json-to-capnp.cpp	Mon Aug 22 17:16:23 2016 +0100
+++ b/utilities/json-to-capnp.cpp	Mon Aug 22 17:16:44 2016 +0100
@@ -6,6 +6,8 @@
 #include <sstream>
 #include <stdexcept>
 
+#include "bits/PreservingPluginHandleMapper.h"
+
 using namespace std;
 using namespace json11;
 using namespace vampipe;
@@ -35,27 +37,6 @@
     return j;
 }
 
-class PreservingPluginHandleMapper : public PluginHandleMapper
-{
-public:
-    PreservingPluginHandleMapper() : m_handle(0), m_plugin(0) { }
-
-    virtual int32_t pluginToHandle(Vamp::Plugin *p) {
-	if (p == m_plugin) return m_handle;
-	else throw NotFound();
-    }
-
-    virtual Vamp::Plugin *handleToPlugin(int32_t h) {
-	m_handle = h;
-	m_plugin = reinterpret_cast<Vamp::Plugin *>(h);
-	return m_plugin;
-    }
-
-private:
-    int32_t m_handle;
-    Vamp::Plugin *m_plugin;
-};
-
 void 
 handle_input(::capnp::MallocMessageBuilder &message, string input)
 {