libfly  6.2.2
C++20 utility library for Linux, macOS, and Windows
fly::config::ConfigManager Class Reference

#include <config_manager.hpp>

Inheritance diagram for fly::config::ConfigManager:
Collaboration diagram for fly::config::ConfigManager:

Public Types

using ConfigMap = std::map< std::string, std::weak_ptr< Config > >
 

Public Member Functions

 ~ConfigManager ()
 
template<fly::DerivedFrom< Config > T>
std::shared_ptr< T > create_config ()
 
ConfigMap::size_type prune ()
 

Static Public Member Functions

static std::shared_ptr< ConfigManagercreate (std::shared_ptr< fly::task::SequencedTaskRunner > task_runner, ConfigFileType file_type, std::filesystem::path path)
 

Detailed Description

Class to create and manage a set of configurations.

Author
Timothy Flynn (trfly.nosp@m.nn89.nosp@m.@pm.m.nosp@m.e)
Version
July 21, 2016

Member Typedef Documentation

◆ ConfigMap

using fly::config::ConfigManager::ConfigMap = std::map<std::string, std::weak_ptr<Config> >

Map of configuration group names to configuration objects.

Constructor & Destructor Documentation

◆ ~ConfigManager()

fly::config::ConfigManager::~ConfigManager ( )

Destructor. Stop the configuration manager and underlying objects.

Member Function Documentation

◆ create()

std::shared_ptr< ConfigManager > fly::config::ConfigManager::create ( std::shared_ptr< fly::task::SequencedTaskRunner task_runner,
ConfigFileType  file_type,
std::filesystem::path  path 
)
static

Create and start a configuration manager.

Parameters
task_runnerTask runner for posting config-related tasks onto.
file_typeFile format of the configuration file.
pathPath to the configuration file.
Returns
The created configuration manager.

◆ create_config()

template<fly::DerivedFrom< Config > T>
std::shared_ptr< T > fly::config::ConfigManager::create_config

Create a configuration object, or if one with the given type's name exists, fetch it.

Template Parameters
TConfig type (must derive from or be fly::config::Config).
Returns
A reference to the created/found configuration.

◆ prune()

ConfigManager::ConfigMap::size_type fly::config::ConfigManager::prune ( )

Erase any expired configuration objects.

Returns
The remaining number of configurations.

The documentation for this class was generated from the following files: