Mercurial > hg > piper-cpp
comparison vamp-support/PluginHandleMapper.h @ 75:81e1c48e97f9
Rearrange and rename to Piper C++ structure
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Mon, 10 Oct 2016 16:31:09 +0100 |
parents | |
children | c6b6051b1b1a |
comparison
equal
deleted
inserted
replaced
74:d45cfa25aaad | 75:81e1c48e97f9 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Piper C++ | |
5 | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 Copyright 2006-2016 Chris Cannam and QMUL. | |
8 | |
9 Permission is hereby granted, free of charge, to any person | |
10 obtaining a copy of this software and associated documentation | |
11 files (the "Software"), to deal in the Software without | |
12 restriction, including without limitation the rights to use, copy, | |
13 modify, merge, publish, distribute, sublicense, and/or sell copies | |
14 of the Software, and to permit persons to whom the Software is | |
15 furnished to do so, subject to the following conditions: | |
16 | |
17 The above copyright notice and this permission notice shall be | |
18 included in all copies or substantial portions of the Software. | |
19 | |
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR | |
24 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
25 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
27 | |
28 Except as contained in this notice, the names of the Centre for | |
29 Digital Music; Queen Mary, University of London; and Chris Cannam | |
30 shall not be used in advertising or otherwise to promote the sale, | |
31 use or other dealings in this Software without prior written | |
32 authorization. | |
33 */ | |
34 | |
35 #ifndef PIPER_PLUGIN_HANDLE_MAPPER_H | |
36 #define PIPER_PLUGIN_HANDLE_MAPPER_H | |
37 | |
38 #include "PluginOutputIdMapper.h" | |
39 | |
40 #include <vamp-hostsdk/Plugin.h> | |
41 #include <memory> | |
42 | |
43 namespace piper { | |
44 | |
45 /** | |
46 * Convert plugin pointers to handles within some scope defined by the | |
47 * individual PluginHandleMapper implementation. | |
48 * | |
49 * The special handle 0 and the NULL plugin pointer are both used to | |
50 * represent "not found" and will be returned in any case where an | |
51 * unknown handle or plugin is requested. | |
52 * | |
53 * Note that the handle type must be representable as a JSON number, | |
54 * hence the use of a 32-bit rather than 64-bit int. | |
55 * | |
56 * This interface also includes methods for obtaining a | |
57 * PluginOutputIdMapper, \see PluginOutputIdMapper. | |
58 */ | |
59 | |
60 class PluginHandleMapper | |
61 { | |
62 public: | |
63 typedef int32_t Handle; | |
64 const Handle INVALID_HANDLE = 0; | |
65 | |
66 virtual ~PluginHandleMapper() noexcept { } | |
67 | |
68 /** | |
69 * Look up and return the handle for a given plugin pointer. | |
70 * If the given pointer is null or not known, return INVALID_HANDLE. | |
71 */ | |
72 virtual Handle pluginToHandle(Vamp::Plugin *) const noexcept = 0; | |
73 | |
74 /** | |
75 * Look up and return the plugin for a given handle. | |
76 * If the given handle is INVALID_HANDLE or not known, return nullptr. | |
77 */ | |
78 virtual Vamp::Plugin *handleToPlugin(Handle) const noexcept = 0; | |
79 | |
80 /** | |
81 * Return a shared pointer to a PluginOutputIdMapper | |
82 * implementation for the given plugin pointer. If the given | |
83 * pointer is null or not known, return the null shared_ptr. | |
84 */ | |
85 virtual const std::shared_ptr<PluginOutputIdMapper> pluginToOutputIdMapper | |
86 (Vamp::Plugin *p) const noexcept = 0; | |
87 | |
88 /** | |
89 * Return a shared pointer to a PluginOutputIdMapper | |
90 * implementation for the given plugin handle. If the given | |
91 * handle is INVALID_HANDLE or not known, return the null shared_ptr. | |
92 */ | |
93 virtual const std::shared_ptr<PluginOutputIdMapper> handleToOutputIdMapper | |
94 (Handle h) const noexcept = 0; | |
95 }; | |
96 | |
97 } | |
98 | |
99 #endif | |
100 |