NGen
Loading...
Searching...
No Matches
global_config.hpp
1#ifndef NGEN_REALIZATION_GLOBAL_CONFIG_H
2#define NGEN_REALIZATION_GLOBAL_CONFIG_H
3
4#include "JSONProperty.hpp"
5
6namespace realization {
7namespace config {
8
26enum class GlobalConfigKey {
30};
31
33inline const char* to_key_string(GlobalConfigKey which) {
34 switch (which) {
35 case GlobalConfigKey::SERIALIZATION: return "serialization";
36 }
37 // Enum is exhaustively handled above; any future addition must
38 // supply a case or compilation should fail at the call site.
39 return "";
40}
41
57 const geojson::PropertyMap& parent,
58 GlobalConfigKey which) {
59 const char* key = to_key_string(which);
60 auto src_it = parent.find(key);
61 if (src_it == parent.end()) return;
62 if (child.count(key) != 0) return;
63 child.emplace(key, src_it->second);
64}
65
66} // namespace config
67} // namespace realization
68
69#endif // NGEN_REALIZATION_GLOBAL_CONFIG_H
std::map< std::string, JSONProperty > PropertyMap
Shorthand for a mapping between strings and properties.
Definition JSONProperty.hpp:21
GlobalConfigKey
Identifier for a realization-level configuration block that can be inherited down into each formulati...
Definition global_config.hpp:26
@ SERIALIZATION
The serialization block consumed by the BMI serialization protocols (Ngen{Serialization,...
void apply_config(geojson::PropertyMap &child, const geojson::PropertyMap &parent, GlobalConfigKey which)
Copy a named config block from parent into child, unless the child already declares its own entry for...
Definition global_config.hpp:56
const char * to_key_string(GlobalConfigKey which)
Top-level JSON key string for a given GlobalConfigKey.
Definition global_config.hpp:33
Definition HY_Features.hpp:13