|
Monero
|
Thread-safe Configuration repository. More...
#include <easylogging++.h>


Classes | |
| class | Parser |
| Parser used internally to parse configurations from file or text. More... | |
Public Member Functions | |
| Configurations (void) | |
| Default constructor with empty repository. | |
| Configurations (const std::string &configurationFile, bool useDefaultsForRemaining=true, Configurations *base=nullptr) | |
| Constructor used to set configurations using configuration file. | |
| virtual | ~Configurations (void) |
| bool | parseFromFile (const std::string &configurationFile, Configurations *base=nullptr) |
| Parses configuration from file. | |
| bool | parseFromText (const std::string &configurationsString, Configurations *base=nullptr) |
| Parse configurations from configuration string. | |
| void | setFromBase (Configurations *base) |
| Sets configuration based-off an existing configurations. | |
| bool | hasConfiguration (ConfigurationType configurationType) |
| Determines whether or not specified configuration type exists in the repository. | |
| bool | hasConfiguration (Level level, ConfigurationType configurationType) |
| Determines whether or not specified configuration type exists for specified level. | |
| void | set (Level level, ConfigurationType configurationType, const std::string &value) |
| Sets value of configuration for specified level. | |
| void | set (Configuration *conf) |
| Sets single configuration based on other single configuration. | |
| Configuration * | get (Level level, ConfigurationType configurationType) |
| void | setGlobally (ConfigurationType configurationType, const std::string &value) |
| Sets configuration for all levels. | |
| void | clear (void) |
| Clears repository so that all the configurations are unset. | |
| const std::string & | configurationFile (void) const |
| Gets configuration file used in parsing this configurations. | |
| void | setToDefault (void) |
| Sets configurations to "factory based" configurations. | |
| void | setRemainingToDefault (void) |
| Lets you set the remaining configurations to default. | |
| Public Member Functions inherited from el::base::utils::RegistryWithPred< Configuration, Configuration::Predicate > | |
| RegistryWithPred (void) | |
| virtual | ~RegistryWithPred (void) |
| RegistryWithPred & | operator= (const RegistryWithPred &sr) |
| Assignment operator that unregisters all the existing registeries and deeply copies each of repo element. | |
| Public Member Functions inherited from el::base::utils::AbstractRegistry< Configuration, std::vector< Configuration * > > | |
| AbstractRegistry (void) | |
| Default constructor. | |
| bool | operator== (const AbstractRegistry< Configuration, std::vector< Configuration * > > &other) |
| bool | operator!= (const AbstractRegistry< Configuration, std::vector< Configuration * > > &other) |
| AbstractRegistry & | operator= (AbstractRegistry &&sr) |
| Assignment move operator. | |
| virtual | ~AbstractRegistry (void) |
| virtual iterator | begin (void) ELPP_FINAL |
| virtual iterator | end (void) ELPP_FINAL |
| virtual const_iterator | cbegin (void) const ELPP_FINAL |
| virtual const_iterator | cend (void) const ELPP_FINAL |
| virtual bool | empty (void) const ELPP_FINAL |
| virtual std::size_t | size (void) const ELPP_FINAL |
| virtual std::vector< Configuration * > & | list (void) ELPP_FINAL |
| Returns underlying container by reference. | |
| Public Member Functions inherited from el::base::threading::ThreadSafe | |
| virtual void | acquireLock (void) ELPP_FINAL |
| virtual void | releaseLock (void) ELPP_FINAL |
| virtual base::threading::Mutex & | lock (void) ELPP_FINAL |
Private Member Functions | |
| void | unsafeSetIfNotExist (Level level, ConfigurationType configurationType, const std::string &value) |
| Unsafely sets configuration if does not already exist. | |
| void | unsafeSet (Level level, ConfigurationType configurationType, const std::string &value) |
| Thread unsafe set. | |
| void | setGlobally (ConfigurationType configurationType, const std::string &value, bool includeGlobalLevel) |
| Sets configurations for all levels including Level::Global if includeGlobalLevel is true. | |
| void | unsafeSetGlobally (ConfigurationType configurationType, const std::string &value, bool includeGlobalLevel) |
| Sets configurations (Unsafely) for all levels including Level::Global if includeGlobalLevel is true. | |
Private Attributes | |
| std::string | m_configurationFile |
| bool | m_isFromFile |
Friends | |
| class | el::Loggers |
Thread-safe Configuration repository.
@detail This repository represents configurations for all the levels and configuration type mapped to a value.
| el::Configurations::Configurations | ( | void | ) |
Default constructor with empty repository.
| el::Configurations::Configurations | ( | const std::string & | configurationFile, |
| bool | useDefaultsForRemaining = true, | ||
| Configurations * | base = nullptr ) |
Constructor used to set configurations using configuration file.
| configurationFile | Full path to configuration file |
| useDefaultsForRemaining | Lets you set the remaining configurations to default. |
| base | If provided, this configuration will be based off existing repository that this argument is pointing to. |
|
inlinevirtual |
|
inline |
Clears repository so that all the configurations are unset.
|
inline |
Gets configuration file used in parsing this configurations.
@detail If this repository was set manually or by text this returns empty string.
|
inline |
| bool el::Configurations::hasConfiguration | ( | ConfigurationType | configurationType | ) |
Determines whether or not specified configuration type exists in the repository.
@detail Returns as soon as first level is found.
| configurationType | Type of configuration to check existence for. |
| bool el::Configurations::hasConfiguration | ( | Level | level, |
| ConfigurationType | configurationType ) |
| bool el::Configurations::parseFromFile | ( | const std::string & | configurationFile, |
| Configurations * | base = nullptr ) |
Parses configuration from file.
| configurationFile | Full path to configuration file |
| base | Configurations to base new configuration repository off. This value is used when you want to use existing Configurations to base all the values and then set rest of configuration via configuration file. |
| bool el::Configurations::parseFromText | ( | const std::string & | configurationsString, |
| Configurations * | base = nullptr ) |
Parse configurations from configuration string.
@detail This configuration string has same syntax as configuration file contents. Make sure all the necessary new line characters are provided.
| base | Configurations to base new configuration repository off. This value is used when you want to use existing Configurations to base all the values and then set rest of configuration via configuration text. |
| void el::Configurations::set | ( | Configuration * | conf | ) |
Sets single configuration based on other single configuration.
| void el::Configurations::set | ( | Level | level, |
| ConfigurationType | configurationType, | ||
| const std::string & | value ) |
Sets value of configuration for specified level.
@detail Any existing configuration for specified level will be replaced. Also note that configuration types ConfigurationType::SubsecondPrecision and ConfigurationType::PerformanceTracking will be ignored if not set for Level::Global because these configurations are not dependant on level.
| level | Level to set configuration for (el::Level). |
| configurationType | Type of configuration (el::ConfigurationType) |
| value | A string based value. Regardless of what the data type of configuration is, it will always be string from users' point of view. This is then parsed later to be used internally. |
| void el::Configurations::setFromBase | ( | Configurations * | base | ) |
|
inline |
Sets configuration for all levels.
|
private |
Sets configurations for all levels including Level::Global if includeGlobalLevel is true.
| void el::Configurations::setRemainingToDefault | ( | void | ) |
Lets you set the remaining configurations to default.
@detail By remaining, it means that the level/type a configuration does not exist for. This function is useful when you want to minimize chances of failures, e.g, if you have a configuration file that sets configuration for all the configurations except for Enabled or not, we use this so that ENABLED is set to default i.e, true. If you dont do this explicitly (either by calling this function or by using second param in Constructor and try to access a value, an error is thrown
| void el::Configurations::setToDefault | ( | void | ) |
Sets configurations to "factory based" configurations.
|
private |
Thread unsafe set.
|
private |
Sets configurations (Unsafely) for all levels including Level::Global if includeGlobalLevel is true.
|
private |
Unsafely sets configuration if does not already exist.
|
friend |
|
private |
|
private |