Mercurial > hg > vamp-plugin-sdk
comparison vamp-sdk/hostext/PluginWrapper.h @ 190:1982246a3902
* Provide PluginWrapper method for getting hold of a nested wrapper
directly (a bit gross, but useful)
* Use the above to enable the simple host to adjust timestamps
appropriately when printing out results from input domain adapter
wrapped plugins
author | cannam |
---|---|
date | Wed, 17 Sep 2008 13:16:09 +0000 |
parents | f5fff1c6f06d |
children |
comparison
equal
deleted
inserted
replaced
189:5ce2c3f79a45 | 190:1982246a3902 |
---|---|
92 | 92 |
93 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); | 93 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); |
94 | 94 |
95 FeatureSet getRemainingFeatures(); | 95 FeatureSet getRemainingFeatures(); |
96 | 96 |
97 /** | |
98 * Return a pointer to the plugin wrapper of type WrapperType | |
99 * surrounding this wrapper's plugin, if present. | |
100 * | |
101 * This is useful in situations where a plugin is wrapped by | |
102 * multiple different wrappers (one inside another) and the host | |
103 * wants to call some wrapper-specific function on one of the | |
104 * layers without having to care about the order in which they are | |
105 * wrapped. For example, the plugin returned by | |
106 * PluginLoader::loadPlugin may have more than one wrapper; if the | |
107 * host wanted to query or fine-tune some property of one of them, | |
108 * it would be hard to do so without knowing the order of the | |
109 * wrappers. This function therefore gives direct access to the | |
110 * wrapper of a particular type. | |
111 */ | |
112 template <typename WrapperType> | |
113 WrapperType *getWrapper() { | |
114 WrapperType *w = dynamic_cast<WrapperType *>(this); | |
115 if (w) return w; | |
116 PluginWrapper *pw = dynamic_cast<PluginWrapper *>(m_plugin); | |
117 if (pw) return pw->getWrapper<WrapperType>(); | |
118 return 0; | |
119 } | |
120 | |
97 protected: | 121 protected: |
98 PluginWrapper(Plugin *plugin); // I take ownership of plugin | 122 PluginWrapper(Plugin *plugin); // I take ownership of plugin |
99 Plugin *m_plugin; | 123 Plugin *m_plugin; |
100 }; | 124 }; |
101 | 125 |