void AnalysisDataModuleManager::Impl::presentData(AbstractAnalysisData *data, AnalysisDataModuleInterface *module) { if (state_ == eNotStarted) { return; } GMX_RELEASE_ASSERT(state_ != eInFrame, "Cannot apply a modules in mid-frame"); module->dataStarted(data); const bool bCheckMissing = bAllowMissing_ && !(module->flags() & AnalysisDataModuleInterface::efAllowMissing); for (int i = 0; i < data->frameCount(); ++i) { AnalysisDataFrameRef frame = data->getDataFrame(i); GMX_RELEASE_ASSERT(frame.isValid(), "Invalid data frame returned"); // TODO: Check all frames before doing anything for slightly better // exception behavior. if (bCheckMissing && !frame.allPresent()) { GMX_THROW(APIError("Missing data not supported by a module")); } module->frameStarted(frame.header()); for (int j = 0; j < frame.pointSetCount(); ++j) { module->pointsAdded(frame.pointSet(j)); } module->frameFinished(frame.header()); } if (state_ == eFinished) { module->dataFinished(); } }
void AbstractAnalysisData::Impl::presentData(AbstractAnalysisData *data, AnalysisDataModuleInterface *module) { module->dataStarted(data); bool bCheckMissing = bAllowMissing_ && !(module->flags() & AnalysisDataModuleInterface::efAllowMissing); for (int i = 0; i < data->frameCount(); ++i) { AnalysisDataFrameRef frame = data->getDataFrame(i); GMX_RELEASE_ASSERT(frame.isValid(), "Invalid data frame returned"); // TODO: Check all frames before doing anything for slightly better // exception behavior. if (bCheckMissing && !frame.allPresent()) { GMX_THROW(APIError("Missing data not supported by a module")); } module->frameStarted(frame.header()); module->pointsAdded(frame.points()); module->frameFinished(frame.header()); } if (!bInData_) { module->dataFinished(); } }