Class ConfigManager¶
Defined in File config_manager.h
Class Documentation¶
-
class ConfigManager¶
Centralized configuration management system with file loading and validation.
The ConfigManager class provides a complete configuration management solution that handles loading, parsing, validation, and access to configuration settings. It supports multiple configuration sources, type-safe value access, and comprehensive error handling and reporting.
Design¶
Hierarchical configuration loading (defaults → files → command-line)
Type-safe value conversion with error handling
Comprehensive validation and error reporting
Configuration file generation and templating
Category-based organization for large configuration sets
Thread-safe read operations after initialization
Usage Pattern¶
Create ConfigManager instance (typically global)
Call load_config() to initialize from files
Use type-safe getters (get_string, get_int, etc.) to access values
Optionally apply command-line overrides
Use throughout application lifetime for configuration access
Handling¶
Configuration errors are collected rather than thrown as exceptions, allowing the application to continue with default values while reporting issues to the user for correction.
Note
The class follows the singleton-like pattern through a global instance but can be instantiated multiple times if needed for testing
Public Functions
-
ConfigManager()¶
Constructor initializing configuration system.
Creates a ConfigManager instance and initializes the default configuration schema. The configuration is not loaded from files until load_config() is explicitly called.