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 -45
View File
@@ -31,54 +31,23 @@ enum Distribution {GEOMETRIC, ROUNDROBIN, RANDOM};
// Types
class GraphItem;
class Node;
class Edge;
class Signal;
/*class GraphItem;*/
/*class Node;*/
/*class Edge;*/
/*class Signal;*/
#define RANGE_FILTER(L) std::ranges::views::filter(L)
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;
using Vec2Df = VMath::Vec2D<float>;
namespace nlohmann {
template <typename T>
struct adl_serializer<std::shared_ptr<T>> {
static void to_json(json& j, const std::shared_ptr<T>& opt){
if (opt)
{
j = *opt;
}
else
{
j = nullptr;
}
}
static void from_json(const json& j, std::shared_ptr<T>& opt){
if (j.is_null())
{
opt = nullptr;
}
else
{
opt.reset(new T(j.get<T>()));
//opt = j.get<T>();
}
}
};
}
/*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;*/
// App Settings
struct AppSettings{