Bitcoin Core  0.20.99
P2P Digital Currency
Classes | Typedefs | Functions
util Namespace Reference

Classes

class  Ref
 Type-safe dynamic reference. More...
 
struct  Settings
 Stored bitcoin settings. More...
 
struct  SettingsSpan
 Accessor for list of settings that skips negated values when iterated over. More...
 

Typedefs

using SettingsValue = UniValue
 Settings value type (string/integer/boolean/null variant). More...
 

Functions

SettingsValue GetSetting (const Settings &settings, const std::string &section, const std::string &name, bool ignore_default_section_config, bool get_chain_name)
 Get settings value from combined sources: forced settings, command line arguments and the read-only config file. More...
 
std::vector< SettingsValueGetSettingsList (const Settings &settings, const std::string &section, const std::string &name, bool ignore_default_section_config)
 Get combined setting value similar to GetSetting(), except if setting was specified multiple times, return a list of all the values specified. More...
 
bool OnlyHasDefaultSectionSetting (const Settings &settings, const std::string &section, const std::string &name)
 Return true if a setting is set in the default config file section, and not overridden by a higher priority command-line or network section value. More...
 
template<typename Map , typename Key >
auto FindKey (Map &&map, Key &&key) -> decltype(&map.at(key))
 Map lookup helper. More...
 
template<typename Tdst , typename Tsrc >
void insert (Tdst &dst, const Tsrc &src)
 Simplification of std insertion. More...
 
template<typename TsetT , typename Tsrc >
void insert (std::set< TsetT > &dst, const Tsrc &src)
 
void ThreadRename (std::string &&)
 Rename a thread both in terms of an internal (in-memory) name as well as its system thread name. More...
 
void ThreadSetInternalName (std::string &&)
 Set the internal (in-memory) name of the current thread only. More...
 
const std::string & ThreadGetInternalName ()
 Get the thread's internal (in-memory) name; used e.g. More...
 

Typedef Documentation

◆ SettingsValue

using util::SettingsValue = typedef UniValue

Settings value type (string/integer/boolean/null variant).

Note
UniValue is used here for convenience and because it can be easily serialized in a readable format. But any other variant type that can be assigned strings, int64_t, and bool values and has get_str(), get_int64(), get_bool(), isNum(), isBool(), isFalse(), isTrue() and isNull() methods can be substituted if there's a need to move away from UniValue. (An implementation with boost::variant was posted at https://github.com/bitcoin/bitcoin/pull/15934/files#r337691812)

Definition at line 25 of file settings.h.

Function Documentation

◆ FindKey()

template<typename Map , typename Key >
auto util::FindKey ( Map &&  map,
Key &&  key 
) -> decltype(&map.at(key))

Map lookup helper.

Definition at line 86 of file settings.h.

Here is the caller graph for this function:

◆ GetSetting()

SettingsValue util::GetSetting ( const Settings settings,
const std::string &  section,
const std::string &  name,
bool  ignore_default_section_config,
bool  get_chain_name 
)

Get settings value from combined sources: forced settings, command line arguments and the read-only config file.

Parameters
ignore_default_section_config- ignore values in the default section of the config file (part before any [section] keywords)
get_chain_name- enable special backwards compatible behavior for GetChainName

Definition at line 52 of file settings.cpp.

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

◆ GetSettingsList()

std::vector< SettingsValue > util::GetSettingsList ( const Settings settings,
const std::string &  section,
const std::string &  name,
bool  ignore_default_section_config 
)

Get combined setting value similar to GetSetting(), except if setting was specified multiple times, return a list of all the values specified.

Definition at line 105 of file settings.cpp.

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

◆ insert() [1/2]

template<typename Tdst , typename Tsrc >
void util::insert ( Tdst &  dst,
const Tsrc &  src 
)
inline

Simplification of std insertion.

Definition at line 423 of file system.h.

Here is the caller graph for this function:

◆ insert() [2/2]

template<typename TsetT , typename Tsrc >
void util::insert ( std::set< TsetT > &  dst,
const Tsrc &  src 
)
inline

Definition at line 427 of file system.h.

◆ OnlyHasDefaultSectionSetting()

bool util::OnlyHasDefaultSectionSetting ( const Settings settings,
const std::string &  section,
const std::string &  name 
)

Return true if a setting is set in the default config file section, and not overridden by a higher priority command-line or network section value.

This is used to provide user warnings about values that might be getting ignored unintentionally.

Definition at line 150 of file settings.cpp.

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

◆ ThreadGetInternalName()

const std::string & util::ThreadGetInternalName ( )

Get the thread's internal (in-memory) name; used e.g.

for identification in logging.

Definition at line 53 of file threadnames.cpp.

Here is the caller graph for this function:

◆ ThreadRename()

void util::ThreadRename ( std::string &&  name)

Rename a thread both in terms of an internal (in-memory) name as well as its system thread name.

Note
Do not call this for the main thread, as this will interfere with UNIX utilities such as top and killall. Use ThreadSetInternalName instead.

Definition at line 57 of file threadnames.cpp.

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

◆ ThreadSetInternalName()

void util::ThreadSetInternalName ( std::string &&  name)

Set the internal (in-memory) name of the current thread only.

Definition at line 63 of file threadnames.cpp.

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