still in the middle of json export, last attempt did not work

This commit is contained in:
Sebastian
2024-11-02 23:12:38 +01:00
parent 522e9d456a
commit a4ea20b2b3
11 changed files with 158 additions and 68 deletions
+14 -11
View File
@@ -8,8 +8,8 @@
#include "nlohmann/json.hpp"
#include "button.h"
#include "midi-node.h"
#include "node.h"
#include "midi-node.h"
#include "edge.h"
#include <algorithm>
@@ -22,8 +22,21 @@
#include <ranges>
#include <vector>
#include "state-io.h"
using json = nlohmann::json;
typedef std::shared_ptr<GraphItem> SPTR_GraphItem;
typedef std::shared_ptr<Node> SPTR_Node;
typedef std::shared_ptr<Edge> SPTR_Edge;
typedef std::shared_ptr<Signal> SPTR_Signal;
typedef std::vector<SPTR_GraphItem> VEC_SPTR_GraphItem;
typedef std::vector<SPTR_Node> VEC_SPTR_Node;
typedef std::vector<SPTR_Edge> VEC_SPTR_Edge;
typedef std::vector<SPTR_Signal> VEC_SPTR_Signal;
class GraphManager{
public:
@@ -280,14 +293,4 @@ class GraphManager{
};
inline void to_json(json& j, const Node& N) {
std::vector<int> conns;
std::ranges::transform(N.connections.begin(), N.connections.end(), std::back_inserter(conns), [](SPTR_Edge e){ return e->id;});
j = json{{"neighbor", N.neighbor}, {"nodeType", N.nodeType}, {"distributionMode", N.distributionMode}, {"connections", conns}};
}
inline void from_json(const json& j, Node& N) {
}
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(GraphManager, nodes, edges)