still in the middle of json export, last attempt did not work
This commit is contained in:
+14
-11
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user