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();
    }
}
Exemple #2
0
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
AnalysisDataProxy::tryGetDataFrameInternal(int index) const
{
    AnalysisDataFrameRef frame = source_.tryGetDataFrame(index);
    if (!frame.isValid())
    {
        return AnalysisDataFrameRef();
    }
    return AnalysisDataFrameRef(frame, firstColumn_, columnSpan_);
}
Exemple #4
0
AnalysisDataFrameRef
AbstractAnalysisData::getDataFrame(int index) const
{
    AnalysisDataFrameRef frame = tryGetDataFrame(index);
    if (!frame.isValid())
    {
        GMX_THROW(APIError("Invalid frame accessed"));
    }
    return frame;
}