-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinput.h
50 lines (41 loc) · 1.68 KB
/
input.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#include <string>
#include <variant>
#include <vector>
#include <nlohmann/json.hpp>
struct GeometryEngineInput
{
struct Model
{
std::string id; // Model ID
std::string name; // Model name
std::string type; // Model format type, like '.stl'
std::string subType; // Model sub type, like 'binary'
std::string data; // Model data
};
struct Operation
{
struct Marginline {
std::string type; // type of seed point, 'id' for vertex id, or 'coordinate' for coordinate. it must be "coordinate" now.
std::vector<double> seed; // seed point to generate margin line
int num_samples; // number of samples
double threshold_to_remove_last_point; // threshold to remove last point
};
std::string type; // Operation data type, like 'marginline'
Marginline marginline; // input data to generate initial margin line
};
Model model;
Operation operation;
};
// serialize functions
void to_json(nlohmann::json& j, const GeometryEngineInput::Model& m);
void to_json(nlohmann::json& j, const GeometryEngineInput::Operation::Marginline& ml);
void to_json(nlohmann::json& j, const GeometryEngineInput::Operation& o);
void to_json(nlohmann::json& j, const GeometryEngineInput& gei);
// deserialize functions
void from_json(const nlohmann::json& j, GeometryEngineInput::Model& m);
void from_json(const nlohmann::json& j, GeometryEngineInput::Operation::Marginline& ml);
void from_json(const nlohmann::json& j, GeometryEngineInput::Operation& o);
void from_json(const nlohmann::json& j, GeometryEngineInput& gei);
// testing
void test_input_json_00();