Mercurial > hg > svcore
diff transform/FeatureExtractionModelTransformer.h @ 1740:fe3f7f8df3a3 by-id
More work on transformers
author | Chris Cannam |
---|---|
date | Wed, 26 Jun 2019 17:25:20 +0100 |
parents | 565575463752 |
children | 5f8fbbde08ff |
line wrap: on
line diff
--- a/transform/FeatureExtractionModelTransformer.h Wed Jun 26 14:59:09 2019 +0100 +++ b/transform/FeatureExtractionModelTransformer.h Wed Jun 26 17:25:20 2019 +0100 @@ -95,27 +95,23 @@ QWaitCondition m_outputsCondition; void awaitOutputModels() override; - // just casts: -/*!!! - DenseTimeValueModel *getConformingInput(); - - template <typename ModelClass> bool isOutput(int n) { - return dynamic_cast<ModelClass *>(m_outputs[n]) != 0; + template <typename T> bool isOutputType(int n) { + if (!ModelById::getAs<T>(m_outputs[n])) { + return false; + } else { + return true; + } } - template <typename ModelClass> ModelClass *getConformingOutput(int n) { - if ((int)m_outputs.size() > n) { - ModelClass *mc = dynamic_cast<ModelClass *>(m_outputs[n]); - if (!mc) { - std::cerr << "FeatureExtractionModelTransformer::getOutput: Output model not conformable" << std::endl; - } - return mc; + template <typename T> bool setOutputCompletion(int n, int completion) { + auto model = ModelById::getAs<T>(m_outputs[n]); + if (!model) { + return false; } else { - std::cerr << "FeatureExtractionModelTransformer::getOutput: No such output number " << n << std::endl; - return 0; + model->setCompletion(completion, true); + return true; } } -*/ }; #endif