Mercurial > hg > piper-cpp
comparison bits/PluginHandleMapper.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 |
comparison
equal
deleted
inserted
replaced
| 48:ce6cb3308bd7 | 58:c38e12d4bbdd |
|---|---|
| 33 */ | 33 */ |
| 34 | 34 |
| 35 #ifndef VAMPIPE_PLUGIN_HANDLE_MAPPER_H | 35 #ifndef VAMPIPE_PLUGIN_HANDLE_MAPPER_H |
| 36 #define VAMPIPE_PLUGIN_HANDLE_MAPPER_H | 36 #define VAMPIPE_PLUGIN_HANDLE_MAPPER_H |
| 37 | 37 |
| 38 #include "PluginOutputIdMapper.h" | |
| 39 | |
| 38 #include <vamp-hostsdk/Plugin.h> | 40 #include <vamp-hostsdk/Plugin.h> |
| 41 #include <memory> | |
| 39 | 42 |
| 40 namespace vampipe { | 43 namespace vampipe { |
| 41 | 44 |
| 42 class PluginHandleMapper | 45 class PluginHandleMapper |
| 43 { | 46 { |
| 44 // NB the handle type must fit in a JSON number | 47 // NB the handle type must fit in a JSON number |
| 45 | 48 |
| 46 public: | 49 public: |
| 50 typedef int32_t Handle; | |
| 51 | |
| 52 virtual ~PluginHandleMapper() { } | |
| 53 | |
| 47 class NotFound : virtual public std::runtime_error { | 54 class NotFound : virtual public std::runtime_error { |
| 48 public: | 55 public: |
| 49 NotFound() : runtime_error("plugin or handle not found in mapper") { } | 56 NotFound() : runtime_error("plugin or handle not found in mapper") { } |
| 50 }; | 57 }; |
| 51 | 58 |
| 52 virtual int32_t pluginToHandle(Vamp::Plugin *) const = 0; // may throw NotFound | 59 virtual Handle pluginToHandle(Vamp::Plugin *) const = 0; // may throw NotFound |
| 53 virtual Vamp::Plugin *handleToPlugin(int32_t) const = 0; // may throw NotFound | 60 virtual Vamp::Plugin *handleToPlugin(Handle) const = 0; // may throw NotFound |
| 61 | |
| 62 virtual const std::shared_ptr<PluginOutputIdMapper> pluginToOutputIdMapper | |
| 63 (Vamp::Plugin *p) const = 0; // may throw NotFound | |
| 64 | |
| 65 virtual const std::shared_ptr<PluginOutputIdMapper> handleToOutputIdMapper | |
| 66 (Handle h) const = 0; // may throw NotFound | |
| 54 }; | 67 }; |
| 55 | 68 |
| 56 } | 69 } |
| 57 | 70 |
| 58 #endif | 71 #endif |
