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

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

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

Public Member Functions

SWC_CAN_INLINE Properties () noexcept
 
 Properties (Properties &&)=delete
 
 Properties (const Properties &)=delete
 
Propertiesoperator= (Properties &&)=delete
 
Propertiesoperator= (const Properties &)=delete
 
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

Core::MutexSptd mutex
 

Private Types

typedef std::map< std::string, Property::Value::PtrMap
 
typedef std::map< std::string, std::string > AliasMap
 

Private Attributes

Map m_map
 
AliasMap m_alias_map
 

Detailed Description

Definition at line 19 of file Properties.h.

Member Typedef Documentation

◆ AliasMap

typedef std::map<std::string, std::string> SWC::Config::Properties::AliasMap
private

Definition at line 22 of file Properties.h.

◆ Map

typedef std::map<std::string, Property::Value::Ptr> SWC::Config::Properties::Map
private

Definition at line 21 of file Properties.h.

Constructor & Destructor Documentation

◆ Properties() [1/3]

SWC_CAN_INLINE SWC::Config::Properties::Properties ( )
inlinenoexcept

Definition at line 29 of file Properties.h.

◆ Properties() [2/3]

SWC::Config::Properties::Properties ( Properties &&  )
delete

◆ Properties() [3/3]

SWC::Config::Properties::Properties ( const Properties )
delete

◆ ~Properties()

SWC_CAN_INLINE SWC::Config::Properties::~Properties ( )
inlinenoexcept

Definition at line 37 of file Properties.h.

References reset().

+ Here is the call graph for this function:

Member Function Documentation

◆ alias()

void SWC::Config::Properties::alias ( const char *  primary,
const char *  secondary 
)

Definition at line 64 of file Properties.cc.

References m_alias_map.

◆ defaulted()

bool SWC::Config::Properties::defaulted ( const char *  name) const

Definition at line 94 of file Properties.cc.

References get_ptr(), and SWC::Config::Property::Value::is_default().

Referenced by SWC::Config::Settings::init_process().

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

◆ get()

template<typename T >
SWC_SHOULD_NOT_INLINE T* SWC::Config::Properties::get ( const char *  name) const
inline

Definition at line 73 of file Properties.h.

References get_ptr().

+ Here is the call graph for this function:

◆ get_bool() [1/2]

bool SWC::Config::Properties::get_bool ( const char *  name) const
inline

Definition at line 89 of file Properties.h.

Referenced by get_bool(), and SWC::Config::Settings::init().

+ Here is the caller graph for this function:

◆ get_bool() [2/2]

bool SWC::Config::Properties::get_bool ( const char *  name,
bool  v 
) const
inline

Definition at line 93 of file Properties.h.

References get_bool(), and has().

+ Here is the call graph for this function:

◆ get_enum()

int32_t SWC::Config::Properties::get_enum ( const char *  name) const
inline

Definition at line 101 of file Properties.h.

◆ get_gbool()

bool SWC::Config::Properties::get_gbool ( const char *  name) const
inline

Definition at line 97 of file Properties.h.

Referenced by SWC::Config::Settings::init_process().

+ Here is the caller graph for this function:

◆ get_genum()

int32_t SWC::Config::Properties::get_genum ( const char *  name) const
inline

Definition at line 105 of file Properties.h.

◆ get_i16() [1/2]

uint16_t SWC::Config::Properties::get_i16 ( const char *  name) const
inline

Definition at line 113 of file Properties.h.

Referenced by get_i16(), and SWC::Config::Settings::init_process().

+ Here is the caller graph for this function:

◆ get_i16() [2/2]

uint16_t SWC::Config::Properties::get_i16 ( const char *  name,
uint16_t  v 
) const
inline

Definition at line 117 of file Properties.h.

References get_i16(), and has().

+ Here is the call graph for this function:

◆ get_i32() [1/2]

int32_t SWC::Config::Properties::get_i32 ( const char *  name) const
inline

Definition at line 121 of file Properties.h.

Referenced by get_i32().

+ Here is the caller graph for this function:

◆ get_i32() [2/2]

int32_t SWC::Config::Properties::get_i32 ( const char *  name,
int32_t  v 
) const
inline

Definition at line 125 of file Properties.h.

References get_i32(), and has().

+ Here is the call graph for this function:

◆ get_i64()

int64_t SWC::Config::Properties::get_i64 ( const char *  name) const
inline

Definition at line 129 of file Properties.h.

◆ get_i8()

uint8_t SWC::Config::Properties::get_i8 ( const char *  name) const
inline

Definition at line 109 of file Properties.h.

◆ get_names()

void SWC::Config::Properties::get_names ( Strings names) const

Definition at line 102 of file Properties.cc.

References m_map, SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back(), and SWC::Core::Vector< T, SizeT, GROW_SZ >::reserve().

+ Here is the call graph for this function:

◆ get_ptr()

SWC_SHOULD_NOT_INLINE Property::Value::Ptr SWC::Config::Properties::get_ptr ( const char *  name,
bool  null_ok = false 
) const

Definition at line 119 of file Properties.cc.

References SWC::Error::CONFIG_GET_ERROR, m_alias_map, m_map, SWC::Condition::str_eq(), and SWC_THROWF.

Referenced by defaulted(), get(), set(), and to_string().

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

◆ get_str() [1/2]

std::string SWC::Config::Properties::get_str ( const char *  name) const
inline

Definition at line 77 of file Properties.h.

Referenced by SWC::Comm::ConfigSSL::ConfigSSL(), get_str(), SWC::Config::init_post_cmd_args(), SWC::Config::Settings::init_process(), SWC::Config::Settings::load_files_by(), SWC::Config::Settings::parse_args(), SWC::Config::Settings::parse_file(), and SWC::Comm::server::SerializedServer::SerializedServer().

+ Here is the caller graph for this function:

◆ get_str() [2/2]

std::string SWC::Config::Properties::get_str ( const char *  name,
const std::string &  v 
) const
inline

Definition at line 81 of file Properties.h.

References get_str(), and has().

+ Here is the call graph for this function:

◆ get_strs()

Strings SWC::Config::Properties::get_strs ( const char *  name) const
inline

Definition at line 85 of file Properties.h.

Referenced by SWC::Comm::ConfigSSL::ConfigSSL(), SWC::client::Mngr::Groups::Groups(), and SWC::Comm::server::SerializedServer::SerializedServer().

+ Here is the caller graph for this function:

◆ has()

SWC_SHOULD_NOT_INLINE bool SWC::Config::Properties::has ( const char *  name) const
noexcept

Definition at line 82 of file Properties.cc.

References SWC::Condition::str_eq().

Referenced by SWC::Comm::ConfigSSL::ConfigSSL(), get_bool(), get_i16(), get_i32(), get_str(), SWC::Config::Settings::init(), SWC::Config::Settings::init_process(), SWC::Config::Settings::load_files_by(), load_from(), SWC::Config::Settings::parse_args(), and SWC::Comm::server::SerializedServer::SerializedServer().

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

◆ load()

SWC_SHOULD_NOT_INLINE void SWC::Config::Properties::load ( const std::string &  fname,
const Config::ParserConfig filedesc,
const Config::ParserConfig cmddesc,
bool  allow_unregistered = false,
bool  only_guarded = false 
)

Definition at line 32 of file Properties.cc.

References SWC::Config::ParserConfig::add(), SWC::Config::Parser::config, SWC::Config::Parser::get_options(), load_from(), and SWC::Config::Parser::parse_filedata().

Referenced by SWC::Config::Settings::load_files_by(), SWC::Config::Settings::parse_file(), and reload().

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

◆ load_from()

SWC_SHOULD_NOT_INLINE void SWC::Config::Properties::load_from ( const Config::Parser::Options opts,
bool  only_guarded = false 
)

Definition at line 20 of file Properties.cc.

References has(), SWC::Config::Parser::Options::map, and set().

Referenced by load(), SWC::Config::Settings::parse_args(), and SWC::Config::Settings::parse_file().

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

◆ operator=() [1/2]

Properties& SWC::Config::Properties::operator= ( const Properties )
delete

◆ operator=() [2/2]

Properties& SWC::Config::Properties::operator= ( Properties &&  )
delete

◆ print()

void SWC::Config::Properties::print ( std::ostream &  out,
bool  include_default = false 
) const

Definition at line 140 of file Properties.cc.

References m_map.

◆ reload()

SWC_SHOULD_NOT_INLINE void SWC::Config::Properties::reload ( const std::string &  fname,
const Config::ParserConfig filedesc,
const Config::ParserConfig cmddesc 
)

Definition at line 50 of file Properties.cc.

References load(), SWC::LOG_WARN, SWC_CURRENT_EXCEPTION, SWC_LOG_OSTREAM, and SWC_LOG_OUT.

Referenced by SWC::Config::Settings::check_dynamic_files().

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

◆ remove()

void SWC::Config::Properties::remove ( const char *  name)

Definition at line 108 of file Properties.cc.

References m_map, and SWC::Condition::str_eq().

+ Here is the call graph for this function:

◆ reset()

void SWC::Config::Properties::reset ( )
noexcept

Definition at line 13 of file Properties.cc.

References m_map.

Referenced by ~Properties().

+ Here is the caller graph for this function:

◆ set()

SWC_SHOULD_NOT_INLINE void SWC::Config::Properties::set ( const char *  name,
Property::Value::Ptr  p 
)

Definition at line 70 of file Properties.cc.

References get_ptr(), SWC::Config::Property::Value::is_default(), m_map, and SWC::Config::Property::Value::make_new().

Referenced by load_from().

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

◆ to_string()

std::string SWC::Config::Properties::to_string ( const char *  name) const

Definition at line 98 of file Properties.cc.

References get_ptr(), and SWC::Config::Property::Value::to_string().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_alias_map

AliasMap SWC::Config::Properties::m_alias_map
private

Definition at line 139 of file Properties.h.

Referenced by alias(), and get_ptr().

◆ m_map

Map SWC::Config::Properties::m_map
private

Definition at line 138 of file Properties.h.

Referenced by get_names(), get_ptr(), print(), remove(), reset(), and set().

◆ mutex

Core::MutexSptd SWC::Config::Properties::mutex

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