anpcpp 0.1.0
Analytic Network Process computational library
Loading...
Searching...
No Matches
json_io.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <memory>
9#include <stdexcept>
10#include <string>
11
12#include "anpcpp/network.hpp"
13
14namespace anpcpp {
15
19class JsonIoError : public std::runtime_error {
20public:
24 explicit JsonIoError(const std::string& message)
25 : std::runtime_error(message) {}
26};
27
33[[nodiscard]] std::string network_to_json(const AnpNetwork& network);
34
41[[nodiscard]] std::unique_ptr<AnpNetwork> network_from_json(
42 const std::string& json_text);
43
50void save_network_file(const AnpNetwork& network, const std::string& path);
51
58[[nodiscard]] std::unique_ptr<AnpNetwork> load_network_file(
59 const std::string& path);
60
61} // namespace anpcpp
Root ANP model: structure, judgments, supermatrices, and priorities.
Definition network.hpp:259
Thrown on JSON parse, validation, or I/O errors.
Definition json_io.hpp:19
JsonIoError(const std::string &message)
Definition json_io.hpp:24
Analytic Network Process computational library.
Definition eigen.hpp:14
std::unique_ptr< AnpNetwork > load_network_file(const std::string &path)
Loads a network from a file.
std::unique_ptr< AnpNetwork > network_from_json(const std::string &json_text)
Parses JSON produced by network_to_json.
void save_network_file(const AnpNetwork &network, const std::string &path)
Writes a network to a file.
std::string network_to_json(const AnpNetwork &network)
Serializes a network (including subnetworks and layout hints) to JSON.
ANP network model: clusters, nodes, connections, and calculations.