cg_construction_mode_0_parsing_schemas.h (3143B)
1 /* Copyright (C) 2022 Université de Pau et des Pays de l'Adour UPPA 2 * Copyright (C) 2022 CNRS 3 * Copyright (C) 2022 Sorbonne Université 4 * Copyright (C) 2022 Université Paul Sabatier 5 * Copyright (C) 2022 |Meso|Star> (contact@meso-star.com) 6 * 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 20 #ifndef FG_MODE0_PARSING_SCHEMAS__ 21 #define FG_MODE0_PARSING_SCHEMAS__ 22 23 #include "cg_cyaml.h" 24 25 struct parsed_dataset_cmode_0 { 26 char* name; 27 double wall_thickness; /* must be > 0 */ 28 double floor_thickness; /* must be > 0 */ 29 }; 30 31 /********************************************************/ 32 /* Types used for parsing and to define parsing schemas */ 33 /********************************************************/ 34 35 struct parsed_catalog_cmode_0 { 36 struct parsed_dataset_cmode_0* datasets; 37 size_t datasets_count; 38 }; 39 40 static const cyaml_schema_field_t dataset_cmode_0_fields_schema[] = { 41 CYAML_FIELD_STRING_PTR("name", CYAML_FLAG_POINTER, 42 struct parsed_dataset_cmode_0, name, 0, CYAML_UNLIMITED), 43 CYAML_FIELD_FLOAT("wall_thickness", CYAML_FLAG_DEFAULT, 44 struct parsed_dataset_cmode_0, wall_thickness), 45 CYAML_FIELD_FLOAT("floor_thickness", CYAML_FLAG_DEFAULT, 46 struct parsed_dataset_cmode_0, floor_thickness), 47 CYAML_FIELD_END 48 }; 49 50 static const struct cyaml_schema_value p_dataset_cmode_0_schema = { 51 CYAML_VALUE_MAPPING(CYAML_FLAG_POINTER, struct parsed_dataset_cmode_0, 52 dataset_cmode_0_fields_schema), 53 }; 54 55 static const struct cyaml_schema_value dataset_cmode_0_schema = { 56 CYAML_VALUE_MAPPING(CYAML_FLAG_DEFAULT, struct parsed_dataset_cmode_0, 57 dataset_cmode_0_fields_schema), 58 }; 59 60 static const cyaml_schema_field_t cmode_0_fields_schemas[] = { 61 CYAML_FIELD_IGNORE("construction_mode", CYAML_FLAG_DEFAULT), 62 { 63 .key = "datasets", 64 .value = { 65 .type = CYAML_SEQUENCE, 66 .flags = CYAML_FLAG_POINTER, 67 .data_size = sizeof(struct parsed_dataset_cmode_0), 68 .sequence = { 69 .entry = &dataset_cmode_0_schema, 70 .min = 1, 71 .max = CYAML_UNLIMITED, 72 } 73 }, 74 .data_offset = offsetof(struct parsed_catalog_cmode_0, datasets), 75 .count_size = sizeof(((struct parsed_catalog_cmode_0*)0)->datasets_count), 76 .count_offset = offsetof(struct parsed_catalog_cmode_0, datasets_count), 77 }, 78 CYAML_FIELD_END 79 }; 80 81 /* Top-level schema. The top level value for the construction mode is a mapping */ 82 static const cyaml_schema_value_t construction_mode_0_schema = { 83 CYAML_VALUE_MAPPING(CYAML_FLAG_POINTER, struct parsed_catalog_cmode_0, 84 cmode_0_fields_schemas), 85 }; 86 87 #endif