|
Porytiles
|
A Config implementation that lazily pulls a config value by consulting multiple priority-ordered backing ConfigProviders . More...
#include <lazy_layered_config.hpp>
Public Member Functions | |
| LazyLayeredConfig (gsl::not_null< TextFormatter * > format, std::vector< std::unique_ptr< ConfigProvider > > &&providers) | |
| Constructs a LazyLayeredConfig with a list of ConfigProviders in priority order, highest to lowest. | |
| LazyLayeredConfig (std::vector< std::unique_ptr< ConfigProvider > > &&providers) | |
| Constructs a LazyLayeredConfig with a default PlainTextFormatter. | |
| std::string | dump () const |
| Dumps the current state of the config for debugging purposes. | |
| void | warmup_cache (const std::vector< std::string > &tileset_names) const |
| Forces all configuration values to be cached immediately for all known tilesets. | |
Public Member Functions inherited from porytiles2::DomainConfig | |
| virtual | ~DomainConfig ()=default |
| ChainableResult< ConfigValue< std::size_t > > | num_tiles_primary (const std::string &tileset) const |
| ChainableResult< ConfigValue< std::size_t > > | num_tiles_total (const std::string &tileset) const |
| ChainableResult< ConfigValue< std::size_t > > | num_metatiles_primary (const std::string &tileset) const |
| ChainableResult< ConfigValue< std::size_t > > | num_metatiles_total (const std::string &tileset) const |
| ChainableResult< ConfigValue< std::size_t > > | num_pals_primary (const std::string &tileset) const |
| ChainableResult< ConfigValue< std::size_t > > | num_pals_total (const std::string &tileset) const |
| ChainableResult< ConfigValue< std::size_t > > | max_map_data_size (const std::string &tileset) const |
| ChainableResult< ConfigValue< std::size_t > > | num_tiles_per_metatile (const std::string &tileset) const |
| ChainableResult< ConfigValue< Rgba32 > > | extrinsic_transparency (const std::string &tileset) const |
| ChainableResult< ConfigValue< bool > > | patch_build_enabled (const std::string &tileset) const |
Public Member Functions inherited from porytiles2::AppConfig | |
| virtual | ~AppConfig ()=default |
Public Member Functions inherited from porytiles2::InfraConfig | |
| virtual | ~InfraConfig ()=default |
| ChainableResult< ConfigValue< TilesPalMode > > | tiles_pal_mode (const std::string &tileset) const |
Protected Member Functions | |
| ChainableResult< ConfigValue< std::size_t > > | num_tiles_primary_raw (const std::string &tileset) const override |
| ChainableResult< ConfigValue< std::size_t > > | num_tiles_total_raw (const std::string &tileset) const override |
| ChainableResult< ConfigValue< std::size_t > > | num_metatiles_primary_raw (const std::string &tileset) const override |
| ChainableResult< ConfigValue< std::size_t > > | num_metatiles_total_raw (const std::string &tileset) const override |
| ChainableResult< ConfigValue< std::size_t > > | num_pals_primary_raw (const std::string &tileset) const override |
| ChainableResult< ConfigValue< std::size_t > > | num_pals_total_raw (const std::string &tileset) const override |
| ChainableResult< ConfigValue< std::size_t > > | max_map_data_size_raw (const std::string &tileset) const override |
| ChainableResult< ConfigValue< std::size_t > > | num_tiles_per_metatile_raw (const std::string &tileset) const override |
| ChainableResult< ConfigValue< Rgba32 > > | extrinsic_transparency_raw (const std::string &tileset) const override |
| ChainableResult< ConfigValue< bool > > | patch_build_enabled_raw (const std::string &tileset) const override |
| ChainableResult< ConfigValue< TilesPalMode > > | tiles_pal_mode_raw (const std::string &tileset) const override |
A Config implementation that lazily pulls a config value by consulting multiple priority-ordered backing ConfigProviders .
LazyLayeredConfig provides the following functionality:
Definition at line 51 of file lazy_layered_config.hpp.
|
inlineexplicit |
Constructs a LazyLayeredConfig with a list of ConfigProviders in priority order, highest to lowest.
The LazyLayeredConfig will attempt to resolve configuration values by traversing the provided list of ConfigProviders in order. That is, it will consult the first provider in the list first, and the next provider only if the first does not supply the config value. And so on. It is the programmer's responsibility to provide a default layer as the final provider in the list. If any config value resolution call chain reaches the end of the provider list without finding a value, the LazyLayeredConfig will terminate with a panic.
| format | A pointer to the TextFormatter to use |
| providers | The list of providers in priority order |
Definition at line 68 of file lazy_layered_config.hpp.
|
inlineexplicit |
Constructs a LazyLayeredConfig with a default PlainTextFormatter.
This constructor creates an internally owned PlainTextFormatter instance and uses it for formatting. The LazyLayeredConfig will attempt to resolve configuration values by traversing the provided list of ConfigProviders in order. It is the programmer's responsibility to provide a default layer as the final provider in the list.
| providers | The list of providers in priority order |
Definition at line 85 of file lazy_layered_config.hpp.
| std::string porytiles2::LazyLayeredConfig::dump | ( | ) | const |
Dumps the current state of the config for debugging purposes.
Returns a string showing each cached config key, actual value, and source layer name with metadata. Only cached values are shown (values that have been requested at least once).
Definition at line 194 of file lazy_layered_config.cpp.
|
overrideprotectedvirtual |
Implements porytiles2::DomainConfig.
Definition at line 164 of file lazy_layered_config.cpp.
|
overrideprotectedvirtual |
Implements porytiles2::DomainConfig.
Definition at line 144 of file lazy_layered_config.cpp.
|
overrideprotectedvirtual |
Implements porytiles2::DomainConfig.
Definition at line 104 of file lazy_layered_config.cpp.
|
overrideprotectedvirtual |
Implements porytiles2::DomainConfig.
Definition at line 114 of file lazy_layered_config.cpp.
|
overrideprotectedvirtual |
Implements porytiles2::DomainConfig.
Definition at line 124 of file lazy_layered_config.cpp.
|
overrideprotectedvirtual |
Implements porytiles2::DomainConfig.
Definition at line 134 of file lazy_layered_config.cpp.
|
overrideprotectedvirtual |
Implements porytiles2::DomainConfig.
Definition at line 154 of file lazy_layered_config.cpp.
|
overrideprotectedvirtual |
Implements porytiles2::DomainConfig.
Definition at line 84 of file lazy_layered_config.cpp.
|
overrideprotectedvirtual |
Implements porytiles2::DomainConfig.
Definition at line 94 of file lazy_layered_config.cpp.
|
overrideprotectedvirtual |
Implements porytiles2::DomainConfig.
Definition at line 174 of file lazy_layered_config.cpp.
|
overrideprotectedvirtual |
Implements porytiles2::InfraConfig.
Definition at line 184 of file lazy_layered_config.cpp.
| void porytiles2::LazyLayeredConfig::warmup_cache | ( | const std::vector< std::string > & | tileset_names | ) | const |
Forces all configuration values to be cached immediately for all known tilesets.
This function eagerly evaluates and caches all configuration values by calling each config method. This is useful for warming up the cache before performance-critical operations or for validating all config values at startup. The function requires a list of tileset names to evaluate tileset-specific configuration values.
| tileset_names | List of tileset names for which to evaluate the configuration |
Definition at line 216 of file lazy_layered_config.cpp.