コード例 #1
0
ファイル: graphio.cpp プロジェクト: cogsys-tuebingen/csapex
void GraphIO::loadGraphFrom(const YAML::Node& doc)
{
    TimerPtr timer = getProfiler()->getTimer("load graph");
    timer->restart();

    SemanticVersion version;
    if(doc["version"].IsDefined()) {
        version = doc["version"].as<SemanticVersion>();
    } else {
        // with 0.9.7 versioning was introduced, so assume that the version was 0.9.6
        version = SemanticVersion(0, 9, 6);
    }

    graph_.getLocalGraph()->beginTransaction();
    {
        auto interlude = timer->step("load nodes");
        loadNodes(doc, version);
    }

    {
        auto interlude = timer->step("load connections");
        loadConnections(doc, version);
    }
    graph_.getLocalGraph()->finalizeTransaction();

    {
        auto interlude = timer->step("load view");
        loadViewRequest(graph_, doc);
    }

    timer->finish();
}
コード例 #2
0
ファイル: graphio.cpp プロジェクト: cogsys-tuebingen/csapex
void GraphIO::saveGraphTo(YAML::Node& yaml)
{
    TimerPtr timer = getProfiler()->getTimer("save graph");
    timer->restart();

    yaml["version"] = csapex::info::CSAPEX_VERSION;

    saveNodes(yaml);
    saveConnections(yaml);

    {
        auto interlude = timer->step("save view");
        saveViewRequest(graph_, yaml);
    }

    timer->finish();
}