Parameters Storage
[CORELIB]

Collaboration diagram for Parameters Storage:


Classes

class  CParamException
 CParamException. More...
class  CParamParser< TDescription >
 CParamParser. More...
class  CParamBase
 CParamBase. More...
class  CParam< TDescription >
 CParam. More...

Defines

#define X_NCBI_PARAM_DECLNAME(section, name)   SNcbiParamDesc_##section##_##name
 Parameter declaration and definition macros.
#define X_NCBI_PARAM_DECLNAME_SCOPE(scope, section, name)   scope::SNcbiParamDesc_##section##_##name
#define X_NCBI_PARAM_ENUMNAME(section, name)   s_EnumData_##section##_##name
#define X_NCBI_PARAM_DESC_DECL(type, desctype)
#define X_NCBI_PARAM_ENUM_PARSER_DECL(type)
#define X_NCBI_PARAM_STATIC_DEF(type, descname, defval)
#define NCBI_PARAM_TYPE(section, name)   CParam< X_NCBI_PARAM_DECLNAME(section, name) >
 Generate typename for a parameter from its {section, name} attributes.
#define NCBI_PARAM_DECL(type, section, name)
 Parameter declaration.
#define expname
#define expname
#define NCBI_PARAM_ENUM_DECL(type, section, name)
 Enum parameter declaration.
#define NCBI_PARAM_DEF(type, section, name, default_value)
 Parameter definition.
#define NCBI_PARAM_DEF_EX(type, section, name, default_value, flags, env)
 Definition of a parameter with additional flags.
#define NCBI_PARAM_DEF_IN_SCOPE(type, section, name, default_value, scope)
 Similar to NCBI_PARAM_DEF except it adds "scope" (class name or namespace) to the parameter's type.
#define NCBI_PARAM_ENUM_ARRAY(type, section, name)   static SEnumDescription< type > X_NCBI_PARAM_ENUMNAME(section, name)[] =
#define NCBI_PARAM_ENUM_DEF(type, section, name, default_value)
 Enum parameter definition.
#define NCBI_PARAM_ENUM_DEF_EX(type, section, name,default_value, flags, env)
 Definition of an enum parameter with additional flags.

Typedefs

typedef int TNcbiParamFlags

Enumerations

enum  ENcbiParamFlags { eParam_Default = 0, eParam_NoLoad = 1 << 0, eParam_NoThread = 1 << 1 }
 ENcbiParamFlags. More...
enum  EParamCacheFlag { eParamCache_Force, eParamCache_Try, eParamCache_Defer }
 Caching default value on construction of a param. More...

Functions

string g_GetConfigString (const char *section, const char *variable, const char *env_var_name, const char *default_value)
 Get string configuration value.
int g_GetConfigInt (const char *section, const char *variable, const char *env_var_name, int default_value)
 Get integer configuration value.
bool g_GetConfigFlag (const char *section, const char *variable, const char *env_var_name, bool default_value)
 Get boolean configuration value.


Define Documentation

#define expname
 

Value:

, type, section, name)           \
    X_NCBI_PARAM_ENUM_PARSER_DECL(type)                                     \
    struct expname X_NCBI_PARAM_DECLNAME(section, name)                     \
    X_NCBI_PARAM_DESC_DECL(type, SParamEnumDescription)
See also:
NCBI_PARAM_DECL

Definition at line 248 of file ncbi_param.hpp.

#define expname
 

Value:

, type, section, name)                \
    struct expname X_NCBI_PARAM_DECLNAME(section, name)                     \
    X_NCBI_PARAM_DESC_DECL(type, SParamDescription)
See also:
NCBI_PARAM_DECL

Definition at line 248 of file ncbi_param.hpp.

#define NCBI_PARAM_DECL type,
section,
name   ) 
 

Value:

Parameter declaration.

Generates struct for storing the parameter. Section and name may be used to set default value through a registry or environment variable section_name.

See also:
NCBI_PARAM_DEF

Definition at line 225 of file ncbi_param.hpp.

#define NCBI_PARAM_DEF type,
section,
name,
default_value   ) 
 

Value:

SParamDescription< type >                                               \
    X_NCBI_PARAM_DECLNAME(section, name)::sm_ParamDescription =             \
        { #section, #name, 0, default_value, eParam_Default };              \
    X_NCBI_PARAM_STATIC_DEF(type,                                           \
        X_NCBI_PARAM_DECLNAME(section, name),                               \
        default_value)
Parameter definition.

"value" is used to set the initial parameter value, which may be overriden by registry or environment.

See also:
NCBI_PARAM_DECL

Definition at line 257 of file ncbi_param.hpp.

#define NCBI_PARAM_DEF_EX type,
section,
name,
default_value,
flags,
env   ) 
 

Value:

SParamDescription< type >                                               \
    X_NCBI_PARAM_DECLNAME(section, name)::sm_ParamDescription =             \
        { #section, #name, #env, default_value, flags };                    \
    X_NCBI_PARAM_STATIC_DEF(type,                                           \
        X_NCBI_PARAM_DECLNAME(section, name),                               \
        default_value)
Definition of a parameter with additional flags.

See also:
NCBI_PARAM_DEF

ENcbiParamFlags

Definition at line 269 of file ncbi_param.hpp.

#define NCBI_PARAM_DEF_IN_SCOPE type,
section,
name,
default_value,
scope   ) 
 

Value:

SParamDescription< type >                                                \
    X_NCBI_PARAM_DECLNAME_SCOPE(scope, section, name)::sm_ParamDescription = \
        { #section, #name, 0, default_value, eParam_Default };               \
    X_NCBI_PARAM_STATIC_DEF(type,                                            \
        X_NCBI_PARAM_DECLNAME_SCOPE(scope, section, name),                   \
        default_value)
Similar to NCBI_PARAM_DEF except it adds "scope" (class name or namespace) to the parameter's type.

See also:
NCBI_PARAM_DECL, NCBI_PARAM_DEF

Definition at line 281 of file ncbi_param.hpp.

#define NCBI_PARAM_ENUM_ARRAY type,
section,
name   )     static SEnumDescription< type > X_NCBI_PARAM_ENUMNAME(section, name)[] =
 

Definition at line 291 of file ncbi_param.hpp.

#define NCBI_PARAM_ENUM_DECL type,
section,
name   ) 
 

Value:

Enum parameter declaration.

In addition to NCBI_PARAM_DECL also specializes CParamParser<type> to convert between strings and enum values.

See also:
NCBI_PARAM_ENUM_ARRAY

NCBI_PARAM_ENUM_DEF

Definition at line 241 of file ncbi_param.hpp.

#define NCBI_PARAM_ENUM_DEF type,
section,
name,
default_value   ) 
 

Value:

SParamEnumDescription< type >                                           \
    X_NCBI_PARAM_DECLNAME(section, name)::sm_ParamDescription =             \
        { #section, #name, 0, default_value, eParam_Default,                \
          X_NCBI_PARAM_ENUMNAME(section, name),                             \
          ArraySize(X_NCBI_PARAM_ENUMNAME(section, name)) };                \
    X_NCBI_PARAM_STATIC_DEF(type,                                           \
        X_NCBI_PARAM_DECLNAME(section, name),                               \
        default_value)
Enum parameter definition.

Additional 'enums' argument should provide static array of SEnumDescription<type>.

See also:
NCBI_PARAM_ENUM_ARRAY

Definition at line 297 of file ncbi_param.hpp.

#define NCBI_PARAM_ENUM_DEF_EX type,
section,
name,
default_value,
flags,
env   ) 
 

Value:

SParamEnumDescription< type >                                           \
    X_NCBI_PARAM_DECLNAME(section, name)::sm_ParamDescription =             \
        { #section, #name, #env, default_value, flags,                      \
          X_NCBI_PARAM_ENUMNAME(section, name),                             \
          ArraySize(X_NCBI_PARAM_ENUMNAME(section, name)) };                \
    X_NCBI_PARAM_STATIC_DEF(type,                                           \
        X_NCBI_PARAM_DECLNAME(section, name),                               \
        default_value)
Definition of an enum parameter with additional flags.

See also:
NCBI_PARAM_ENUM_DEF

ENcbiParamFlags

Definition at line 312 of file ncbi_param.hpp.

#define NCBI_PARAM_TYPE section,
name   )     CParam< X_NCBI_PARAM_DECLNAME(section, name) >
 

Generate typename for a parameter from its {section, name} attributes.

Definition at line 217 of file ncbi_param.hpp.

Referenced by CId1Reader::CId1Reader(), CId2Reader::CId2Reader(), CollectSNPStat(), CProcessor::CollectStatistics(), CReadDispatcher::CollectStatistics(), CId2ReaderBase::GetDebugLevel(), GetDebugLevel(), GetMaxChunksRequestSize(), CDirEntry::GetTmpNameEx(), CCgiUserAgent::IsBot(), CSeq_descr::PostRead(), ReadFasta(), CDirEntry::Remove(), s_CacheRecompress(), s_GetCacheSize(), s_GetScopeAutoReleaseEnabled(), s_GetScopeAutoReleaseSize(), s_UseMemoryPool(), CFileAPI::SetDeleteReadOnlyFiles(), CFileAPI::SetLogging(), CProcessor::TrySNPSplit(), CProcessor::TrySNPTable(), CProcessor::TryStringPack(), CGBDataLoader::x_GetReaderManager(), CGBDataLoader::x_GetWriterManager(), and CObjectException::x_InitErrCode().

#define X_NCBI_PARAM_DECLNAME section,
name   )     SNcbiParamDesc_##section##_##name
 

Parameter declaration and definition macros.

Each parameter must be declared and defined using the macros

Definition at line 170 of file ncbi_param.hpp.

#define X_NCBI_PARAM_DECLNAME_SCOPE scope,
section,
name   )     scope::SNcbiParamDesc_##section##_##name
 

Definition at line 173 of file ncbi_param.hpp.

#define X_NCBI_PARAM_DESC_DECL type,
desctype   ) 
 

Value:

{                                                                       \
        typedef type TValueType;                                            \
        typedef desctype<TValueType> TDescription;                          \
        typedef CStaticTls< type > TTls;                                    \
        static TDescription sm_ParamDescription;                            \
        static TValueType sm_Default;                                       \
        static bool sm_DefaultInitialized;                                  \
        static TTls sm_ValueTls;                                            \
        static CParamBase::EParamState sm_State;                            \
    }

Definition at line 181 of file ncbi_param.hpp.

#define X_NCBI_PARAM_ENUM_PARSER_DECL type   ) 
 

Value:

EMPTY_TEMPLATE inline                                                   \
    CParamParser< SParamEnumDescription< type > >::TValueType               \
    CParamParser< SParamEnumDescription< type > >::                         \
    StringToValue(const string&     str,                                    \
                  const TParamDesc& descr)                                  \
    { return CEnumParser< type >::StringToEnum(str, descr); }               \
    EMPTY_TEMPLATE inline string                                            \
    CParamParser< SParamEnumDescription< type > >::                         \
    ValueToString(const TValueType& val,                                    \
                  const TParamDesc& descr)                                  \
    { return CEnumParser< type >::EnumToString(val, descr); }

Definition at line 194 of file ncbi_param.hpp.

#define X_NCBI_PARAM_ENUMNAME section,
name   )     s_EnumData_##section##_##name
 

Definition at line 176 of file ncbi_param.hpp.

#define X_NCBI_PARAM_STATIC_DEF type,
descname,
defval   ) 
 

Value:

type descname::sm_Default = defval;                                     \
    bool descname::sm_DefaultInitialized = false;                           \
    descname::TTls descname::sm_ValueTls;                                   \
    CParamBase::EParamState descname::sm_State = CParamBase::eState_NotSet  \

Definition at line 209 of file ncbi_param.hpp.


Typedef Documentation

typedef int TNcbiParamFlags
 

Definition at line 410 of file ncbi_param.hpp.


Enumeration Type Documentation

enum ENcbiParamFlags
 

ENcbiParamFlags.

CParam flags

Enumerator:
eParam_Default  Default flags.
eParam_NoLoad  Do not load from registry or environment.
eParam_NoThread  Do not use per-thread values.

Definition at line 404 of file ncbi_param.hpp.

enum EParamCacheFlag
 

Caching default value on construction of a param.

Enumerator:
eParamCache_Force  Force caching currently set default value.
eParamCache_Try  Cache the default value if the application registry is already initialized.
eParamCache_Defer  Do not try to cache the default value.

Definition at line 413 of file ncbi_param.hpp.


Function Documentation

bool g_GetConfigFlag const char *  section,
const char *  variable,
const char *  env_var_name,
bool  default_value
 

Get boolean configuration value.

Parameters:
section Check application configuration named section first if not null.
variable Variable name within application section. If no value found in configuration file, environment variable with name NCBI_CONFIG__section__variable or NCBI_CONFIG__variable will be checked, depending on wether section is null.
env_var_name If not empty, overrides the default NCBI_CONFIG__section__name name of the environment variable.
default_value If no value found neither in configuration file nor in environment, this value will be returned.
Returns:
boolean configuration value.
See also:
g_GetConfigString(), g_GetConfigInt()

Definition at line 111 of file ncbi_param.cpp.

References config_dump, CONFIG_DUMP_VARIABLE, IRegistry::Get(), CNcbiApplication::GetConfig(), CNcbiApplication::HasLoadedConfig(), CNcbiApplication::Instance(), LOG_POST_X, and StringToBool().

int g_GetConfigInt const char *  section,
const char *  variable,
const char *  env_var_name,
int  default_value
 

Get integer configuration value.

Parameters:
section Check application configuration named section first if not null.
variable Variable name within application section. If no value found in configuration file, environment variable with name NCBI_CONFIG__section__variable or NCBI_CONFIG__variable will be checked, depending on wether section is null.
env_var_name If not empty, overrides the default NCBI_CONFIG__section__name name of the environment variable.
default_value If no value found neither in configuration file nor in environment, this value will be returned.
Returns:
integer configuration value.
See also:
g_GetConfigString(), g_GetConfigFlag()

Definition at line 193 of file ncbi_param.cpp.

References config_dump, IRegistry::Get(), CNcbiApplication::GetConfig(), CNcbiApplication::HasLoadedConfig(), CNcbiApplication::Instance(), LOG_POST_X, and NStr::StringToInt().

string g_GetConfigString const char *  section,
const char *  variable,
const char *  env_var_name,
const char *  default_value
 

Get string configuration value.

Parameters:
section Check application configuration named section first if not null.
variable Variable name within application section. If no value found in configuration file, environment variable with name NCBI_CONFIG__section__variable or NCBI_CONFIG__variable will be checked, depending on wether section is null.
env_var_name If not empty, overrides the default NCBI_CONFIG__section__name name of the environment variable.
default_value If no value found neither in configuration file nor in environment, this value will be returned, or empty string if this value is null.
Returns:
string configuration value.
See also:
g_GetConfigInt(), g_GetConfigFlag()

Definition at line 272 of file ncbi_param.cpp.

References config_dump, IRegistry::Get(), CNcbiApplication::GetConfig(), CNcbiApplication::HasLoadedConfig(), CNcbiApplication::Instance(), and LOG_POST_X.

Referenced by CParam< TDescription >::CParam(), and CParam< TDescription >::sx_GetDefault().


Generated on Mon Dec 7 16:01:50 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:24:35 2009 by modify_doxy.py rev. 173732