NCBI C++ ToolKit
|
Classes | |
class | CConfigException |
CConfigException –. More... | |
class | CConfig |
Typedefs | |
typedef CTreePair< string, string, PEqualNocase_Conditional > | CConfig::TParamValue |
Instantiation parameters tree. More... | |
typedef TParamValue::TPairTreeNode | CConfig::TParamTree |
Enumerations | |
enum | CConfigException::EErrCode { CConfigException::eParameterMissing , CConfigException::eSynonymDuplicate , CConfigException::eInvalidParameter } |
enum | CConfig::EErrAction { CConfig::eErr_Throw , CConfig::eErr_NoThrow } |
Defines how to behave when parameter is missing. More... | |
Functions | |
virtual const char * | CConfigException::GetErrCodeString (void) const override |
Translate from the error code value to its string representation. More... | |
CConfigException::NCBI_EXCEPTION_DEFAULT (CConfigException, CCoreException) | |
CConfig::CConfig (TParamTree *param_tree, EOwnership own=eTakeOwnership, NStr::ECase use_case=NStr::eNocase) | |
Optionally takes ownership on passed param_tree. More... | |
CConfig::CConfig (const TParamTree *param_tree, NStr::ECase use_case=NStr::eNocase) | |
Construct, take no tree ownership. More... | |
CConfig::CConfig (const IRegistry ®, NStr::ECase use_case=NStr::eNocase) | |
Take registry and create a config tree out of it. More... | |
CConfig::~CConfig () | |
string | CConfig::GetString (const string &driver_name, const string ¶m_name, EErrAction on_error, const string &default_value, const list< string > *synonyms=NULL) |
Utility function to get an element of parameter tree Throws an exception when mandatory parameter is missing (or returns the default value) More... | |
const string & | CConfig::GetString (const string &driver_name, const string ¶m_name, EErrAction on_error, const list< string > *synonyms=NULL) |
This version always defaults to the empty string so that it can safely return a reference. More... | |
int | CConfig::GetInt (const string &driver_name, const string ¶m_name, EErrAction on_error, int default_value, const list< string > *synonyms=NULL) |
Utility function to get an integer element of parameter tree Throws an exception when mandatory parameter is missing (or returns the default value) More... | |
Uint8 | CConfig::GetDataSize (const string &driver_name, const string ¶m_name, EErrAction on_error, unsigned int default_value, const list< string > *synonyms=NULL) |
Utility function to get an integer element of parameter tree Throws an exception when mandatory parameter is missing (or returns the default value) This function understands KB, MB, GB qualifiers at the end of the string. More... | |
bool | CConfig::GetBool (const string &driver_name, const string ¶m_name, EErrAction on_error, bool default_value, const list< string > *synonyms=NULL) |
Utility function to get an integer element of parameter tree Throws an exception when mandatory parameter is missing (or returns the default value) More... | |
double | CConfig::GetDouble (const string &driver_name, const string ¶m_name, EErrAction on_error, double default_value, const list< string > *synonyms=NULL) |
Utility function to get a double element of parameter tree Throws an exception when mandatory parameter is missing (or returns the default value) More... | |
const TParamTree * | CConfig::GetTree () const |
static TParamTree * | CConfig::ConvertRegToTree (const IRegistry ®, NStr::ECase use_case=NStr::eNocase) |
Reconstruct param tree from the application registry. More... | |
string | CConfig::Get (const string &d, const string &p, EErrAction e, const string &v, const list< string > *s=NULL) |
Overloading of getters for generic programming. More... | |
int | CConfig::Get (const string &d, const string &p, EErrAction e, int v, const list< string > *s=NULL) |
bool | CConfig::Get (const string &d, const string &p, EErrAction e, bool v, const list< string > *s=NULL) |
double | CConfig::Get (const string &d, const string &p, EErrAction e, double v, const list< string > *s=NULL) |
CConfig::CConfig (const CConfig &) | |
CConfig & | CConfig::operator= (const CConfig &) |
const string & | CConfig::x_GetString (const string &driver_name, const string ¶m_name, EErrAction on_error, const string &default_value, const list< string > *synonyms) |
Variables | |
AutoPtr< TParamTree > | CConfig::m_ParamTree |
Definition at line 82 of file ncbi_config.hpp.
Instantiation parameters tree.
Plug-in instantiation model is based on class factories. Recursive class factory calls are modeled as tree, where specific subtree is responsible for CF parameters
Definition at line 81 of file ncbi_config.hpp.
enum CConfig::EErrAction |
Defines how to behave when parameter is missing.
Enumerator | |
---|---|
eErr_Throw | Throw an exception on error. |
eErr_NoThrow | Return default value on error. |
Definition at line 103 of file ncbi_config.hpp.
Enumerator | |
---|---|
eParameterMissing | Missing mandatory parameter. |
eSynonymDuplicate | |
eInvalidParameter | Invalid parameter value. |
Definition at line 55 of file ncbi_config.hpp.
|
explicit |
Take registry and create a config tree out of it.
Definition at line 449 of file ncbi_config.cpp.
References _ASSERT, CConfig::ConvertRegToTree(), eTakeOwnership, and CConfig::m_ParamTree.
|
explicit |
Construct, take no tree ownership.
Definition at line 456 of file ncbi_config.cpp.
References eNoOwnership, eTakeOwnership, and CConfig::m_ParamTree.
|
explicit |
Optionally takes ownership on passed param_tree.
Definition at line 440 of file ncbi_config.cpp.
References eTakeOwnership, and CConfig::m_ParamTree.
|
static |
Reconstruct param tree from the application registry.
reg | Application registry (loaded from the INI file) |
Definition at line 264 of file ncbi_config.cpp.
References CTreeNode< TValue, TKeyGetterP >::AddNode(), NStr::CompareNocase(), debug(), entries, IRegistry::EnumerateEntries(), IRegistry::EnumerateSections(), CTreeNode< TValue, TKeyGetterP >::FindOrCreateNode(), NStr::fSplit_MergeDelimiters, NStr::fSplit_Truncate, IRegistry::Get(), CTreeNode< TValue, TKeyGetterP >::GetKey(), CTreeNode< TValue, TKeyGetterP >::GetParent(), ITERATE, kIncludeSections, kNodeName, CTreeNode< TValue, TKeyGetterP >::RemoveNode(), s_AddOrReplaceSubNode(), s_ExpandSubNodes(), s_FindSubNode(), s_IsSubNode(), s_List2Set(), s_ParseSubNodes(), NStr::Split(), TreeDepthFirstTraverse(), and x_Print().
Referenced by CConfig::CConfig(), CID2SNPProcessor_Impl::CID2SNPProcessor_Impl(), CPSGDataLoader_Impl::CPSGDataLoader_Impl(), CIncreasingTime::Init(), CCgiApplicationCached::Init(), MakePluginManagerParamTree(), and CGBDataLoader_Native::x_CreateDriver().
|
inline |
Definition at line 240 of file ncbi_config.hpp.
References CConfig::GetBool().
|
inline |
Overloading of getters for generic programming.
Definition at line 232 of file ncbi_config.hpp.
References CConfig::GetString().
|
inline |
Definition at line 244 of file ncbi_config.hpp.
References CConfig::GetDouble().
|
inline |
Definition at line 236 of file ncbi_config.hpp.
References CConfig::GetInt().
bool CConfig::GetBool | ( | const string & | driver_name, |
const string & | param_name, | ||
EErrAction | on_error, | ||
bool | default_value, | ||
const list< string > * | synonyms = NULL |
||
) |
Utility function to get an integer element of parameter tree Throws an exception when mandatory parameter is missing (or returns the default value)
driver_name | Name of the module requesting parameter (used in diagnostics) |
params | Parameters tree |
param_name | Name of the parameter |
mandatory | Error action |
default_value | Default value for missing parameters |
Definition at line 627 of file ncbi_config.cpp.
References CConfig::eErr_Throw, ERR_POST_X_ONCE, CConfig::GetString(), msg(), NCBI_THROW, and NStr::StringToBool().
Referenced by CCacheReader::CCacheReader(), CPubseq2Reader::CPubseq2Reader(), CPubseqReader::CPubseqReader(), CConfig::Get(), CSimpleClassFactoryImpl< CReader, CCacheReader >::GetParamBool(), CReader::InitParams(), and CCDDDataLoader::SLoaderParams::SLoaderParams().
Uint8 CConfig::GetDataSize | ( | const string & | driver_name, |
const string & | param_name, | ||
EErrAction | on_error, | ||
unsigned int | default_value, | ||
const list< string > * | synonyms = NULL |
||
) |
Utility function to get an integer element of parameter tree Throws an exception when mandatory parameter is missing (or returns the default value) This function understands KB, MB, GB qualifiers at the end of the string.
driver_name | Name of the module requesting parameter (used in diagnostics) |
params | Parameters tree |
param_name | Name of the parameter |
mandatory | Error action |
default_value | Default value for missing parameters |
Definition at line 586 of file ncbi_config.cpp.
References CConfig::eErr_Throw, ERR_POST_X_ONCE, CConfig::GetString(), msg(), NCBI_THROW, and NStr::StringToUInt8_DataSize().
Referenced by CSimpleClassFactoryImpl< CReader, CCacheReader >::GetParamDataSize(), NS_GetDataSize(), NS_ValidateDataSize(), and SPubseqGatewaySettings::x_GetDataSize().
double CConfig::GetDouble | ( | const string & | driver_name, |
const string & | param_name, | ||
EErrAction | on_error, | ||
double | default_value, | ||
const list< string > * | synonyms = NULL |
||
) |
Utility function to get a double element of parameter tree Throws an exception when mandatory parameter is missing (or returns the default value)
driver_name | Name of the module requesting parameter (used in diagnostics) |
params | Parameters tree |
param_name | Name of the parameter |
mandatory | Error action |
default_value | Default value for missing parameters |
Definition at line 667 of file ncbi_config.cpp.
References CConfig::eErr_Throw, ERR_POST_X_ONCE, NStr::fDecimalPosixOrLocal, CConfig::GetString(), msg(), NCBI_THROW, and NStr::StringToDouble().
Referenced by CConfig::Get(), and CSimpleClassFactoryImpl< CReader, CCacheReader >::GetParamDouble().
|
overridevirtual |
Translate from the error code value to its string representation.
Reimplemented from CCoreException.
Definition at line 707 of file ncbi_config.cpp.
References CConfigException::eInvalidParameter, CConfigException::eParameterMissing, CConfigException::eSynonymDuplicate, CCoreException::GetErrCode(), and CException::GetErrCodeString().
int CConfig::GetInt | ( | const string & | driver_name, |
const string & | param_name, | ||
EErrAction | on_error, | ||
int | default_value, | ||
const list< string > * | synonyms = NULL |
||
) |
Utility function to get an integer element of parameter tree Throws an exception when mandatory parameter is missing (or returns the default value)
driver_name | Name of the module requesting parameter (used in diagnostics) |
params | Parameters tree |
param_name | Name of the parameter |
mandatory | Error action |
default_value | Default value for missing parameters |
Definition at line 546 of file ncbi_config.cpp.
References CConfig::eErr_Throw, ERR_POST_X_ONCE, CConfig::GetString(), msg(), NCBI_THROW, and NStr::StringToInt().
Referenced by CID2SNPProcessor_Impl::CID2SNPProcessor_Impl(), CPubseq2Reader::CPubseq2Reader(), CConfig::Get(), CSimpleClassFactoryImpl< CReader, CCacheReader >::GetParamInt(), CReader::InitParams(), CReaderServiceConnector::InitTimeouts(), and CCDDDataLoader::SLoaderParams::SLoaderParams().
const string & CConfig::GetString | ( | const string & | driver_name, |
const string & | param_name, | ||
EErrAction | on_error, | ||
const list< string > * | synonyms = NULL |
||
) |
This version always defaults to the empty string so that it can safely return a reference.
(default_value may be temporary in some cases.)
Definition at line 483 of file ncbi_config.cpp.
References kEmptyStr, and CConfig::x_GetString().
string CConfig::GetString | ( | const string & | driver_name, |
const string & | param_name, | ||
EErrAction | on_error, | ||
const string & | default_value, | ||
const list< string > * | synonyms = NULL |
||
) |
Utility function to get an element of parameter tree Throws an exception when mandatory parameter is missing (or returns the default value)
driver_name | Name of the module requesting parameter (used in diagnostics) |
params | Parameters tree |
param_name | Name of the parameter |
mandatory | Error action |
default_value | Default value for missing parameters |
Definition at line 472 of file ncbi_config.cpp.
References CConfig::x_GetString().
Referenced by CGICacheReader::CGICacheReader(), CId1Reader::CId1Reader(), CId2Reader::CId2Reader(), CPubseq2Reader::CPubseq2Reader(), CPubseqReader::CPubseqReader(), CConfig::Get(), CConfig::GetBool(), CConfig::GetDataSize(), CConfig::GetDouble(), CConfig::GetInt(), IClassFactory< TClass >::GetParam(), CCDDDataLoader::SLoaderParams::SLoaderParams(), and CIncreasingTime::x_GetDoubleParam().
|
inline |
Definition at line 221 of file ncbi_config.hpp.
References CConfig::m_ParamTree.
Referenced by CNetScheduleClientFactory::CreateInstance(), CConfigRegistry::GetSubConfig(), NS_GetDataSize(), NS_ValidateDataSize(), CGenBankUIDataSource::Open(), and SPubseqGatewaySettings::x_GetDataSize().
CConfigException::NCBI_EXCEPTION_DEFAULT | ( | CConfigException | , |
CCoreException | |||
) |
|
protected |
Definition at line 493 of file ncbi_config.cpp.
References CConfig::eErr_NoThrow, ERR_POST_X_ONCE, CTreeNode< TValue, TKeyGetterP >::GetValue(), ITERATE, CConfig::m_ParamTree, msg(), and NCBI_THROW.
Referenced by CConfig::GetString().
CConfig::~CConfig | ( | ) |
Definition at line 467 of file ncbi_config.cpp.
|
protected |
Definition at line 260 of file ncbi_config.hpp.
Referenced by CConfig::CConfig(), CConfig::GetTree(), and CConfig::x_GetString().