Mercurial > hg > piper-cpp
comparison bits/PreservingPluginHandleMapper.h @ 32:2d97883d20df
Wire up a couple of server actions
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Tue, 24 May 2016 17:17:03 +0100 |
parents | b376ab0ce003 |
children | 55d69b26d4db |
comparison
equal
deleted
inserted
replaced
31:b376ab0ce003 | 32:2d97883d20df |
---|---|
35 #ifndef VAMPIPE_PRESERVING_PLUGIN_HANDLE_MAPPER_H | 35 #ifndef VAMPIPE_PRESERVING_PLUGIN_HANDLE_MAPPER_H |
36 #define VAMPIPE_PRESERVING_PLUGIN_HANDLE_MAPPER_H | 36 #define VAMPIPE_PRESERVING_PLUGIN_HANDLE_MAPPER_H |
37 | 37 |
38 #include "PluginHandleMapper.h" | 38 #include "PluginHandleMapper.h" |
39 | 39 |
40 #include <iostream> | |
41 | |
40 namespace vampipe { | 42 namespace vampipe { |
41 | 43 |
42 class PreservingPluginHandleMapper : public PluginHandleMapper | 44 class PreservingPluginHandleMapper : public PluginHandleMapper |
43 { | 45 { |
44 public: | 46 public: |
45 PreservingPluginHandleMapper() : m_handle(0), m_plugin(0) { } | 47 PreservingPluginHandleMapper() : m_handle(0), m_plugin(0) { } |
46 | 48 |
47 virtual int32_t pluginToHandle(Vamp::Plugin *p) { | 49 virtual int32_t pluginToHandle(Vamp::Plugin *p) { |
48 if (p == m_plugin) return m_handle; | 50 if (p == m_plugin) return m_handle; |
49 else throw NotFound(); | 51 else { |
52 std::cerr << "PreservingPluginHandleMapper: p = " << p | |
53 << " differs from saved m_plugin " << m_plugin | |
54 << " (not returning saved handle " << m_handle << ")" | |
55 << std::endl; | |
56 throw NotFound(); | |
57 } | |
50 } | 58 } |
51 | 59 |
52 virtual Vamp::Plugin *handleToPlugin(int32_t h) { | 60 virtual Vamp::Plugin *handleToPlugin(int32_t h) { |
53 m_handle = h; | 61 m_handle = h; |
54 m_plugin = reinterpret_cast<Vamp::Plugin *>(h); | 62 m_plugin = reinterpret_cast<Vamp::Plugin *>(h); |