Mercurial > hg > svcore
diff transform/FeatureExtractionModelTransformer.cpp @ 1752:6d09d68165a4 by-id
Further review of ById: make IDs only available when adding a model to the ById store, not by querying the item directly. This means any id encountered in the wild must have been added to the store at some point (even if later released), which simplifies reasoning about lifecycles
author | Chris Cannam |
---|---|
date | Fri, 05 Jul 2019 15:28:07 +0100 |
parents | b92bdcd4954b |
children | fd7f127ecd89 |
line wrap: on
line diff
--- a/transform/FeatureExtractionModelTransformer.cpp Thu Jul 04 18:04:21 2019 +0100 +++ b/transform/FeatureExtractionModelTransformer.cpp Fri Jul 05 15:28:07 2019 +0100 @@ -517,8 +517,7 @@ if (out) { out->setSourceModel(getInputModel()); - ModelById::add(out); - m_outputs.push_back(out->getId()); + m_outputs.push_back(ModelById::add(out)); } } @@ -604,8 +603,8 @@ additional->setScaleUnits(baseModel->getScaleUnits()); additional->setRDFTypeURI(baseModel->getRDFTypeURI()); - ModelId additionalId = additional->getId(); - ModelById::add(std::shared_ptr<SparseTimeValueModel>(additional)); + ModelId additionalId = ModelById::add + (std::shared_ptr<SparseTimeValueModel>(additional)); m_additionalModels[n][binNo] = additionalId; return additionalId; } @@ -648,7 +647,8 @@ } if (m_abandoned) return; - auto input = ModelById::getAs<DenseTimeValueModel>(getInputModel()); + ModelId inputId = getInputModel(); + auto input = ModelById::getAs<DenseTimeValueModel>(inputId); if (!input) { abandon(); return; @@ -677,7 +677,7 @@ if (frequencyDomain) { for (int ch = 0; ch < channelCount; ++ch) { FFTModel *model = new FFTModel - (input->getId(), + (inputId, channelCount == 1 ? m_input.getChannel() : ch, primaryTransform.getWindowType(), blockSize,