AnalysisDataFrameRef::AnalysisDataFrameRef( const AnalysisDataFrameRef &frame, int firstColumn, int columnCount) : header_(frame.header()), values_(&frame.values_[firstColumn], columnCount) { GMX_ASSERT(firstColumn >= 0, "Invalid first column"); GMX_ASSERT(columnCount >= 0, "Invalid column count"); GMX_ASSERT(firstColumn + columnCount <= frame.columnCount(), "Invalid last column"); }
AnalysisDataFrameRef AnalysisDataProxy::tryGetDataFrameInternal(int index) const { AnalysisDataFrameRef frame = source_.tryGetDataFrame(index); if (!frame.isValid()) { return AnalysisDataFrameRef(); } return AnalysisDataFrameRef(frame, firstColumn_, columnSpan_); }
AnalysisDataFrameRef AbstractAnalysisData::getDataFrame(int index) const { AnalysisDataFrameRef frame = tryGetDataFrame(index); if (!frame.isValid()) { GMX_THROW(APIError("Invalid frame accessed")); } return frame; }
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(); } }
AnalysisDataFrameRef::AnalysisDataFrameRef( const AnalysisDataFrameRef &frame, int firstColumn, int columnCount) : header_(frame.header()), values_(constArrayRefFromArray(&frame.values_[firstColumn], columnCount)), pointSets_(frame.pointSets_) { // FIXME: This doesn't produce a valid internal state, although it does // work in some cases. The point sets cannot be correctly managed here, but // need to be handles by the data proxy class. GMX_ASSERT(firstColumn >= 0, "Invalid first column"); GMX_ASSERT(columnCount >= 0, "Invalid column count"); GMX_ASSERT(pointSets_.size() == 1U, "Subsets of frames only supported with simple data"); GMX_ASSERT(firstColumn + columnCount <= ssize(values_), "Invalid last column"); }