SWC-DB  v0.5.9 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
SWC::Config::Settings Class Referencefinal

#include <swcdb/core/config/Settings.h>

+ Inheritance diagram for SWC::Config::Settings:
+ Collaboration diagram for SWC::Config::Settings:

Classes

struct  DynFile
 

Public Types

typedef std::shared_ptr< SettingsPtr
 
typedef void init_option_t(Settings *)
 

Public Member Functions

 Settings ()
 
 ~Settings () noexcept
 
void init (int argc, char *argv[], init_option_t app, init_option_t post_cmd_args)
 
void init_options ()
 
void parse_args (int argc, char *argv[])
 
void load_files_by (const char *fileprop, bool allow_unregistered)
 
void parse_file (const std::string &fname, const char *onchg)
 
void init_process (bool with_pid_file, const char *port_cfg=nullptr)
 
std::string usage_str (const char *usage=nullptr)
 
void check_dynamic_files () noexcept
 
- Public Member Functions inherited from SWC::Config::Properties
SWC_CAN_INLINE Properties () noexcept
 
SWC_CAN_INLINE ~Properties () noexcept
 
void reset () noexcept
 
void load_from (const Config::Parser::Options &opts, bool only_guarded=false)
 
void load (const std::string &fname, const Config::ParserConfig &filedesc, const Config::ParserConfig &cmddesc, bool allow_unregistered=false, bool only_guarded=false)
 
void reload (const std::string &fname, const Config::ParserConfig &filedesc, const Config::ParserConfig &cmddesc)
 
void alias (const char *primary, const char *secondary)
 
void set (const char *name, Property::Value::Ptr p)
 
bool SWC_PURE_FUNC has (const char *name) const noexcept
 
bool defaulted (const char *name) const
 
std::string to_string (const char *name) const
 
void get_names (Strings &names) const
 
void remove (const char *name)
 
Property::Value::Ptr get_ptr (const char *name, bool null_ok=false) const
 
template<typename T >
SWC_SHOULD_NOT_INLINE Tget (const char *name) const
 
std::string get_str (const char *name) const
 
std::string get_str (const char *name, const std::string &v) const
 
Strings get_strs (const char *name) const
 
bool get_bool (const char *name) const
 
bool get_bool (const char *name, bool v) const
 
bool get_gbool (const char *name) const
 
int32_t get_enum (const char *name) const
 
int32_t get_genum (const char *name) const
 
uint8_t get_i8 (const char *name) const
 
uint16_t get_i16 (const char *name) const
 
uint16_t get_i16 (const char *name, uint16_t v) const
 
int32_t get_i32 (const char *name) const
 
int32_t get_i32 (const char *name, int32_t v) const
 
int64_t get_i64 (const char *name) const
 
void print (std::ostream &out, bool include_default=false) const
 

Public Attributes

ParserConfig cmdline_desc
 
ParserConfig file_desc
 
std::string install_path
 
std::string executable
 
- Public Attributes inherited from SWC::Config::Properties
Core::MutexSptd mutex
 

Private Attributes

Parser::Options m_cmd_args
 
Core::Vector< DynFilem_dyn_files
 

Detailed Description

Definition at line 25 of file Settings.h.

Member Typedef Documentation

◆ init_option_t

typedef void SWC::Config::Settings::init_option_t(Settings *)

Definition at line 30 of file Settings.h.

◆ Ptr

typedef std::shared_ptr<Settings> SWC::Config::Settings::Ptr

Definition at line 29 of file Settings.h.

Constructor & Destructor Documentation

◆ Settings()

SWC_SHOULD_NOT_INLINE SWC::Config::Settings::Settings ( )

Definition at line 37 of file Settings.cc.

References cmdline_desc, SWC::Config::ParserConfig::definition(), and usage_str().

+ Here is the call graph for this function:

◆ ~Settings()

SWC::Config::Settings::~Settings ( )
noexcept

Definition at line 41 of file Settings.cc.

Member Function Documentation

◆ check_dynamic_files()

SWC_SHOULD_NOT_INLINE void SWC::Config::Settings::check_dynamic_files ( )
noexcept

Definition at line 394 of file Settings.cc.

References cmdline_desc, file_desc, SWC::LOG_DEBUG, m_dyn_files, SWC::Config::Properties::mutex, SWC::Config::Properties::reload(), SWC_LOG_CURRENT_EXCEPTION, and SWC_LOGF.

+ Here is the call graph for this function:

◆ init()

SWC_SHOULD_NOT_INLINE void SWC::Config::Settings::init ( int  argc,
char *  argv[],
Settings::init_option_t  init_app_options,
Settings::init_option_t  init_post_cmd_args 
)

Definition at line 44 of file Settings.cc.

References executable, SWC::Config::Properties::get_bool(), SWC::Config::Properties::has(), SWC::Config::init_app_options(), init_options(), SWC::Config::init_post_cmd_args(), install_path, SWC::LOG_DEBUG, SWC::LOG_ERROR, parse_args(), SWC::Error::print(), SWC_LOG_OSTREAM, SWC_LOG_OUT, SWC_PRINT, SWC_PRINT_CLOSE, SWC_QUICK_EXIT, and swcdb_copyrights().

+ Here is the call graph for this function:

◆ init_options()

SWC_SHOULD_NOT_INLINE void SWC::Config::Settings::init_options ( )

Definition at line 97 of file Settings.cc.

References SWC::Config::ParserConfig::add_options(), SWC::Config::boo(), cmdline_desc, SWC::Core::LogWriter::from_string(), SWC::Config::g_boo(), SWC::Config::g_enum(), install_path, SWC::LOG_INFO, SWC::Core::logger, SWC::Core::LogWriter::repr(), SWC::Core::LogWriter::set_level(), SWC::Config::str(), SWC::Config::strs(), USE_SWC_PATH_ETC, USE_SWC_PATH_LOG, and SWC::Config::Property::Value::zero_token().

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_process()

SWC_SHOULD_NOT_INLINE void SWC::Config::Settings::init_process ( bool  with_pid_file,
const char *  port_cfg = nullptr 
)

◆ load_files_by()

SWC_SHOULD_NOT_INLINE void SWC::Config::Settings::load_files_by ( const char *  fileprop,
bool  allow_unregistered 
)

Definition at line 190 of file Settings.cc.

References SWC::Core::Vector< T, SizeT, GROW_SZ >::cbegin(), SWC::Core::Vector< T, SizeT, GROW_SZ >::cend(), cmdline_desc, file_desc, SWC::Config::Properties::get_str(), SWC::Config::Properties::has(), SWC::Config::Properties::load(), SWC::LOG_WARN, m_dyn_files, SWC::Config::Properties::mutex, SWC_CURRENT_EXCEPTION, SWC_LOG_OSTREAM, and SWC_LOG_OUT.

Referenced by parse_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_args()

SWC_SHOULD_NOT_INLINE void SWC::Config::Settings::parse_args ( int  argc,
char *  argv[] 
)

Definition at line 137 of file Settings.cc.

References SWC::Config::ParserConfig::add(), cmdline_desc, SWC::Config::Parser::config, file_desc, SWC::Config::Parser::get_options(), SWC::Config::Properties::get_str(), SWC::Config::Properties::has(), SWC::Config::Properties::load_from(), m_cmd_args, SWC::Config::Parser::own_options(), SWC::Config::Parser::parse_cmdline(), parse_file(), SWC_PRINT, SWC_PRINT_CLOSE, SWC_QUICK_EXIT, swcdb_copyrights(), and swcdb_version().

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_file()

SWC_SHOULD_NOT_INLINE void SWC::Config::Settings::parse_file ( const std::string &  fname,
const char *  onchg 
)

Definition at line 171 of file Settings.cc.

References cmdline_desc, SWC::Comm::Protocol::FsBroker::Handler::exists(), file_desc, SWC::Config::Properties::get_str(), SWC::Config::Properties::load(), load_files_by(), SWC::Config::Properties::load_from(), m_cmd_args, and SWC_THROWF.

Referenced by SWC::Config::init_post_cmd_args(), and parse_args().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ usage_str()

std::string SWC::Config::Settings::usage_str ( const char *  usage = nullptr)

Definition at line 365 of file Settings.cc.

References executable, SWC::format(), and swcdb_copyrights().

Referenced by SWC::Config::init_app_options(), and Settings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ cmdline_desc

◆ executable

std::string SWC::Config::Settings::executable

Definition at line 36 of file Settings.h.

Referenced by init(), init_process(), and usage_str().

◆ file_desc

◆ install_path

std::string SWC::Config::Settings::install_path

Definition at line 35 of file Settings.h.

Referenced by init(), init_options(), and init_process().

◆ m_cmd_args

Parser::Options SWC::Config::Settings::m_cmd_args
private

Definition at line 61 of file Settings.h.

Referenced by parse_args(), and parse_file().

◆ m_dyn_files

Core::Vector<DynFile> SWC::Config::Settings::m_dyn_files
private

Definition at line 81 of file Settings.h.

Referenced by check_dynamic_files(), and load_files_by().


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