dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
Loader.hpp
1// SPDX-FileCopyrightText: 2025 Vincent Leroy
2// SPDX-License-Identifier: MIT
3//
4// This file is part of dfx.
5//
6// Licensed under the MIT License. See the LICENSE file in the project root
7// for full license information.
8
9#pragma once
10
11// Third-party includes
12#include <nlohmann/json.hpp>
13
14// Project includes
15#include "Controller.hpp"
16#include <dfx-utilities/FileSystem.hpp>
17
18namespace dfx::Graph
19{
27{
35 std::size_t errorLimit = 10;
36
44 bool startNodes = false;
45};
46
60{
62 std::vector<Core::Node::Id> nodeIds;
64 std::vector<Core::Channel::Id> channelIds;
65};
66
110{
111public:
122 static LoadingResult loadFromFile(fs::path const & path, Controller & controller, LoaderOptions const & options = {});
123
138 static LoadingResult loadFromJson(nlohmann::json const & json, Controller & controller, LoaderOptions const & options = {});
139};
140} // !namespace dfx::Graph
In-memory graph builder and mutation controller (nodes + channels) with optional connection verificat...
Definition Controller.hpp:213
Helper that loads a graph into a Controller from a JSON file or JSON object.
Definition Loader.hpp:110
static LoadingResult loadFromJson(nlohmann::json const &json, Controller &controller, LoaderOptions const &options={})
Load a graph from an in-memory JSON object into a controller.
static LoadingResult loadFromFile(fs::path const &path, Controller &controller, LoaderOptions const &options={})
Load a graph JSON file into a controller.
Definition Node.hpp:42
Options controlling graph loading behavior.
Definition Loader.hpp:27
bool startNodes
Start newly created nodes after a successful load.
Definition Loader.hpp:44
std::size_t errorLimit
Maximum number of channel-verification errors to collect per channel creation.
Definition Loader.hpp:35
Identifiers of nodes and channels created by a load operation.
Definition Loader.hpp:60
std::vector< Core::Node::Id > nodeIds
Node ids created by the load operation.
Definition Loader.hpp:62
std::vector< Core::Channel::Id > channelIds
Channel ids created by the load operation.
Definition Loader.hpp:64