Mercurial > hg > svcore
comparison 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 |
comparison
equal
deleted
inserted
replaced
1739:565575463752 | 1740:fe3f7f8df3a3 |
---|---|
93 bool m_haveOutputs; | 93 bool m_haveOutputs; |
94 QMutex m_outputMutex; | 94 QMutex m_outputMutex; |
95 QWaitCondition m_outputsCondition; | 95 QWaitCondition m_outputsCondition; |
96 void awaitOutputModels() override; | 96 void awaitOutputModels() override; |
97 | 97 |
98 // just casts: | 98 template <typename T> bool isOutputType(int n) { |
99 /*!!! | 99 if (!ModelById::getAs<T>(m_outputs[n])) { |
100 DenseTimeValueModel *getConformingInput(); | 100 return false; |
101 | 101 } else { |
102 template <typename ModelClass> bool isOutput(int n) { | 102 return true; |
103 return dynamic_cast<ModelClass *>(m_outputs[n]) != 0; | 103 } |
104 } | 104 } |
105 | 105 |
106 template <typename ModelClass> ModelClass *getConformingOutput(int n) { | 106 template <typename T> bool setOutputCompletion(int n, int completion) { |
107 if ((int)m_outputs.size() > n) { | 107 auto model = ModelById::getAs<T>(m_outputs[n]); |
108 ModelClass *mc = dynamic_cast<ModelClass *>(m_outputs[n]); | 108 if (!model) { |
109 if (!mc) { | 109 return false; |
110 std::cerr << "FeatureExtractionModelTransformer::getOutput: Output model not conformable" << std::endl; | |
111 } | |
112 return mc; | |
113 } else { | 110 } else { |
114 std::cerr << "FeatureExtractionModelTransformer::getOutput: No such output number " << n << std::endl; | 111 model->setCompletion(completion, true); |
115 return 0; | 112 return true; |
116 } | 113 } |
117 } | 114 } |
118 */ | |
119 }; | 115 }; |
120 | 116 |
121 #endif | 117 #endif |
122 | 118 |