Program Listing for File Config.hpp

Return to documentation for file (src/mimir/program/Config.hpp)

#pragma once

#include <yaml-cpp/yaml.h>
#include <casadi/core/generic_type.hpp>

// Given two yaml nodes, one is config, the other is schema

// First, the config is checked using yavl-cpp validation
// Then, the node is traversed and read into a casadi::Dict based on types in the schema
// maps are considered to be Dicts, lists are vectors

namespace mimir
{

  namespace program
  {
    casadi::Dict parse_config(const YAML::Node& config, const YAML::Node& schema);

    void read_doc(
        const std::string& key, casadi::Dict& dict,
        const YAML::Node& config, const YAML::Node& schema);

    void read_map(
        casadi::Dict& dict, const YAML::Node& config, const YAML::Node& schema);

    void read_list(
        const std::string& key, casadi::Dict& dict,
        const YAML::Node& config, const YAML::Node& schema);

    void read_leaf(
        const std::string& key, casadi::Dict& dict,
        const YAML::Node& config, const YAML::Node& schema);
  }
}