cg_construction_modes_parsing_schemas.h (2275B)
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_CMODES_PARSING_SCHEMAS__ 21 #define FG_CMODES_PARSING_SCHEMAS__ 22 23 #include "cg_cyaml.h" 24 25 /********************************************************/ 26 /* Types used for parsing and to define parsing schemas */ 27 /********************************************************/ 28 29 /* construction mode type */ 30 enum parsed_cmode_type { 31 PARSED_CMODE_0, 32 PARSED_CMODE_1, 33 PARSED_CMODE_2, 34 PARSED_CMODE_TYPE_UNDEFINED 35 }; 36 37 /* Mapping from "construction mode type" strings to enum parsed_cmode_type values for 38 * schema. */ 39 static const cyaml_strval_t city_building_types_strings[] = { 40 { "Construction_Mode_0", PARSED_CMODE_0 }, 41 { "Construction_Mode_1", PARSED_CMODE_1 }, 42 { "Construction_Mode_2", PARSED_CMODE_2 } 43 }; 44 45 struct parsed_cmode { 46 enum parsed_cmode_type cmode_type; 47 }; 48 49 static const cyaml_schema_field_t construction_mode_fields_schemas[] = { 50 CYAML_FIELD_ENUM("construction_mode", 51 CYAML_FLAG_CASE_INSENSITIVE, struct parsed_cmode, cmode_type, 52 city_building_types_strings, CYAML_ARRAY_LEN(city_building_types_strings)), 53 CYAML_FIELD_IGNORE("datasets", CYAML_FLAG_DEFAULT), 54 CYAML_FIELD_END 55 }; 56 57 /* Top-level schema. The top level value for the construction mode is a mapping */ 58 static const cyaml_schema_value_t construction_mode_schema = { 59 CYAML_VALUE_MAPPING(CYAML_FLAG_POINTER, struct parsed_cmode, 60 construction_mode_fields_schemas), 61 }; 62 63 #endif