presage
0.9.2~beta
|
#include <profileManager.h>
Classes | |
struct | CachedLogMessage |
Public Member Functions | |
ProfileManager (const std::string="") | |
~ProfileManager () | |
void | save_profile () const |
Configuration * | get_configuration () |
void | set_autopersist (const std::string &value) |
Static Public Attributes | |
static const char * | LOGGER = "Presage.ProfileManager.LOGGER" |
static const char * | AUTOPERSIST = "Presage.ProfileManager.AUTOPERSIST" |
Private Member Functions | |
void | init_profiles (const std::string &profilename) |
Profile * | create_profile_from_xml (const std::string &filename) |
std::string | get_user_home_dir () const |
std::string | get_system_etc_dir () const |
void | cache_log_message (Logger< char >::Level level, const std::string &message) |
void | flush_cached_log_messages () |
void | refresh_config () |
Private Attributes | |
bool | loaded_at_least_one_profile |
std::list< CachedLogMessage > | cached_log_messages |
Configuration * | config |
Profile * | rw_profile |
bool | autopersist_config |
Logger< char > | logger |
Juggles configuration files and presage system initialization.
ProfileManager loads up a bunch of xml files containing configuration data and initializes a configuration object.
Definition at line 51 of file profileManager.h.
ProfileManager::ProfileManager | ( | const std::string | profilename = "" | ) |
Constructor.
Initialises other modules.
Definition at line 55 of file profileManager.cpp.
References autopersist_config, config, init_profiles(), loaded_at_least_one_profile, and rw_profile.
ProfileManager::~ProfileManager | ( | ) |
Destructor.
Definition at line 70 of file profileManager.cpp.
References AUTOPERSIST, autopersist_config, config, Configuration::find(), flush_cached_log_messages(), Variable::get_value(), rw_profile, save_profile(), and set_autopersist().
|
private |
Cache log message until logger level is read from configuration.
Definition at line 282 of file profileManager.cpp.
References cached_log_messages, and ProfileManager::CachedLogMessage::message.
Referenced by create_profile_from_xml().
|
private |
Definition at line 84 of file profileManager.cpp.
References cache_log_message(), Profile::file_read_ok(), logger, and Logger< _charT, _Traits >::NOTICE.
Referenced by init_profiles().
|
private |
Flush cached log messages.
Definition at line 291 of file profileManager.cpp.
References cached_log_messages, endl(), and logger.
Referenced by refresh_config(), and ~ProfileManager().
Configuration * ProfileManager::get_configuration | ( | ) |
Definition at line 270 of file profileManager.cpp.
References config, and refresh_config().
|
private |
Definition at line 152 of file profileManager.cpp.
Referenced by init_profiles().
|
private |
Definition at line 214 of file profileManager.cpp.
References HOME.
Referenced by init_profiles().
|
private |
Definition at line 113 of file profileManager.cpp.
References config, create_profile_from_xml(), DefaultProfile::DEFAULT_PROFILE_FILENAME, Profile::file_read_ok(), get_system_etc_dir(), get_user_home_dir(), loaded_at_least_one_profile, Profile::read_into_configuration(), and rw_profile.
Referenced by ProfileManager().
|
private |
Refresh configuration variables
Definition at line 302 of file profileManager.cpp.
References config, Configuration::find(), flush_cached_log_messages(), Variable::get_value(), LOGGER, logger, and setlevel().
Referenced by get_configuration().
void ProfileManager::save_profile | ( | ) | const |
Write profile to disk.
Returns true is file was saved successfully, false otherwise.
Definition at line 261 of file profileManager.cpp.
References config, endl(), logger, Profile::read_from_configuration(), rw_profile, and Profile::write_to_file().
Referenced by Presage::save_config(), and ~ProfileManager().
void ProfileManager::set_autopersist | ( | const std::string & | value | ) |
Definition at line 315 of file profileManager.cpp.
References autopersist_config, endl(), Utility::isTrue(), and logger.
Referenced by ~ProfileManager().
|
static |
Definition at line 63 of file profileManager.h.
Referenced by ~ProfileManager().
|
private |
Definition at line 101 of file profileManager.h.
Referenced by ProfileManager(), set_autopersist(), and ~ProfileManager().
|
private |
Definition at line 97 of file profileManager.h.
Referenced by cache_log_message(), and flush_cached_log_messages().
|
private |
Definition at line 99 of file profileManager.h.
Referenced by get_configuration(), init_profiles(), ProfileManager(), refresh_config(), save_profile(), and ~ProfileManager().
|
private |
Definition at line 73 of file profileManager.h.
Referenced by init_profiles(), and ProfileManager().
|
static |
Definition at line 62 of file profileManager.h.
Referenced by refresh_config().
|
private |
Definition at line 103 of file profileManager.h.
Referenced by create_profile_from_xml(), flush_cached_log_messages(), refresh_config(), save_profile(), and set_autopersist().
|
private |
Definition at line 100 of file profileManager.h.
Referenced by init_profiles(), ProfileManager(), save_profile(), and ~ProfileManager().