Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
configuration_parsing_helpers.h File Reference

This file contains helper functions used by the configuration parsing code. More...

#include "configuration.h"
#include "poco.h"
#include "HealthGPS.Core/income_category_layout.h"
#include <fmt/color.h>
#include <fmt/core.h>
#include <nlohmann/json.hpp>
#include <filesystem>
#include <string>
Include dependency graph for configuration_parsing_helpers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  hgps
 Top-level namespace for Health-GPS Console host application.
 
namespace  hgps::input
 Data structures containing model parameters and configuration options.
 

Functions

nlohmann::json hgps::input::get (const nlohmann::json &j, const std::string &key)
 Load value from JSON, printing an error message if it fails.
 
template<class T >
bool hgps::input::get_to (const nlohmann::json &j, const std::string &key, T &out) noexcept
 Get value from JSON object and store in out.
 
template<class T >
bool hgps::input::get_to (const nlohmann::json &j, const std::string &key, T &out, bool &success) noexcept
 Get value from JSON object and store in out, setting success flag.
 
void hgps::input::rebase_valid_path (std::filesystem::path &path, const std::filesystem::path &base_dir)
 Rebase path on base_dir.
 
bool hgps::input::rebase_valid_path_to (const nlohmann::json &j, const std::string &key, std::filesystem::path &out, const std::filesystem::path &base_dir) noexcept
 Get a valid path from a JSON object.
 
void hgps::input::rebase_valid_path_to (const nlohmann::json &j, const std::string &key, std::filesystem::path &out, const std::filesystem::path &base_dir, bool &success) noexcept
 Get a valid path from a JSON object.
 
FileInfo hgps::input::get_file_info (const nlohmann::json &node, const std::filesystem::path &base_dir)
 Load FileInfo from JSON.
 
SettingsInfo hgps::input::get_settings (const nlohmann::json &j)
 Load settings section of JSON.
 
BaselineInfo hgps::input::get_baseline_info (const nlohmann::json &j, const std::filesystem::path &base_dir)
 Load BaselineInfo from JSON.
 
void hgps::input::load_interventions (const nlohmann::json &running, Configuration &config)
 Load interventions from running section.
 
void hgps::input::reject_deprecated_root_config_fields (const nlohmann::json &opt)
 Reject deprecated root-level fields when project_requirements is the source of truth.
 
void hgps::input::validate_legacy_trend_type_string (const std::string &trend_type)
 
void hgps::input::apply_legacy_root_config_fields (const nlohmann::json &opt, ProjectRequirements &req)
 Map legacy root-level trend_type / income_categories into project_requirements.
 
void hgps::input::parse_project_requirements_block (const nlohmann::json &pr, ProjectRequirements &req)
 Parse project_requirements block from config.json.
 

Detailed Description

This file contains helper functions used by the configuration parsing code.

The reason for placing these definitions in a separate header is so as to keep the main configuration_parsing.h file tidy, whilst also making them available to testing code.