A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/ncbi__param_8hpp_source.html below:

NCBI C++ ToolKit: include/corelib/ncbi_param.hpp Source File

1 #ifndef CORELIB___NCBI_PARAM__HPP 2 #define CORELIB___NCBI_PARAM__HPP 96 #define X_NCBI_PARAM_DECLNAME(section, name) \ 97  SNcbiParamDesc_##section##_##name 99 #define X_NCBI_PARAM_DECLNAME_SCOPE(scope, section, name) \ 100  scope::SNcbiParamDesc_##section##_##name 102 #define X_NCBI_PARAM_ENUMNAME(section, name) \ 103  s_EnumData_##section##_##name 107 #define X_NCBI_PARAM_DESC_DECL(type, desctype, tagtype) \ 109  typedef tagtype TTagType; \ 110  typedef type TValueType; \ 111  typedef desctype<TValueType> TDescription; \ 112  typedef TDescription::TStaticValue TStaticValue; \ 113  typedef CStaticTls< type > TTls; \ 114  static TDescription sm_ParamDescription; \ 115  static TStaticValue sm_Default; \ 116  static bool sm_DefaultInitialized; \ 117  static TTls sm_ValueTls; \ 118  static CParamBase::EParamState sm_State; \ 119  static CParamBase::EParamSource sm_Source; \ 125 #define X_NCBI_PARAM_ENUM_PARSER_DECL(type, ptype) \ 126  EMPTY_TEMPLATE inline \ 127  CParamParser< SParamEnumDescription< type >, ptype >::TValueType \ 128  CParamParser< SParamEnumDescription< type >, ptype >:: \ 129  StringToValue(const string& str, \ 130  const TParamDesc& descr) \ 131  { return CEnumParser< type, ptype >::StringToEnum(str, descr); } \ 132  EMPTY_TEMPLATE inline string \ 133  CParamParser< SParamEnumDescription< type >, ptype >:: \ 134  ValueToString(const TValueType& val, \ 135  const TParamDesc& descr) \ 136  { return CEnumParser< type, ptype >::EnumToString(val, descr); } 140 #define X_NCBI_PARAM_STATIC_DEF(descname, defval) \ 141  descname::TStaticValue descname::sm_Default = defval; \ 142  bool descname::sm_DefaultInitialized = false; \ 143  descname::TTls descname::sm_ValueTls; \ 144  CParamBase::EParamState descname::sm_State = CParamBase::eState_NotSet; \ 145  CParamBase::EParamSource descname::sm_Source = CParamBase::eSource_NotSet 149 #define NCBI_PARAM_TYPE(section, name) \ 150  CParam< X_NCBI_PARAM_DECLNAME(section, name) > 157 #define NCBI_PARAM_DECL(type, section, name) \ 158  struct X_NCBI_PARAM_DECLNAME(section, name) \ 159  X_NCBI_PARAM_DESC_DECL(type, SParamDescription, type) 164 #define NCBI_PARAM_DECL_EXPORT(expname, type, section, name) \ 165  struct expname X_NCBI_PARAM_DECLNAME(section, name) \ 166  X_NCBI_PARAM_DESC_DECL(type, SParamDescription, type) 179 #define NCBI_PARAM_ENUM_DECL(type, section, name) \ 180  struct X_NCBI_PARAM_DECLNAME(section, name); \ 181  X_NCBI_PARAM_ENUM_PARSER_DECL(type, X_NCBI_PARAM_DECLNAME(section, name)) \ 182  struct X_NCBI_PARAM_DECLNAME(section, name) \ 183  X_NCBI_PARAM_DESC_DECL(type, SParamEnumDescription, \ 184  X_NCBI_PARAM_DECLNAME(section, name)) 194 #define NCBI_PARAM_ENUM_DECL_EXPORT(expname, type, section, name) \ 195  struct expname X_NCBI_PARAM_DECLNAME(section, name); \ 196  X_NCBI_PARAM_ENUM_PARSER_DECL(type, X_NCBI_PARAM_DECLNAME(section, name)) \ 197  struct expname X_NCBI_PARAM_DECLNAME(section, name) \ 198  X_NCBI_PARAM_DESC_DECL(type, SParamEnumDescription, \ 199  X_NCBI_PARAM_DECLNAME(section, name)) 206 #define NCBI_PARAM_DEF(type, section, name, default_value) \ 207  SParamDescription< type > \ 208  X_NCBI_PARAM_DECLNAME(section, name)::sm_ParamDescription = \ 209  { #section, #name, 0, default_value, NULL, eParam_Default }; \ 210  X_NCBI_PARAM_STATIC_DEF(X_NCBI_PARAM_DECLNAME(section, name), \ 217 #define NCBI_PARAM_DEF_WITH_INIT(type, section, name, default_value, init) \ 218  SParamDescription< type > \ 219  X_NCBI_PARAM_DECLNAME(section, name)::sm_ParamDescription = \ 220  { #section, #name, 0, default_value, init, eParam_Default }; \ 221  X_NCBI_PARAM_STATIC_DEF(X_NCBI_PARAM_DECLNAME(section, name), \ 228 #define NCBI_PARAM_DEF_EX(type, section, name, default_value, flags, env) \ 229  SParamDescription< type > \ 230  X_NCBI_PARAM_DECLNAME(section, name)::sm_ParamDescription = \ 231  { #section, #name, #env, default_value, NULL, flags }; \ 232  X_NCBI_PARAM_STATIC_DEF(X_NCBI_PARAM_DECLNAME(section, name), \ 240 #define NCBI_PARAM_DEF_EX_WITH_INIT(type, section, name, def_value, init, flags, env) \ 241  SParamDescription< type > \ 242  X_NCBI_PARAM_DECLNAME(section, name)::sm_ParamDescription = \ 243  { #section, #name, #env, def_value, init, flags }; \ 244  X_NCBI_PARAM_STATIC_DEF(X_NCBI_PARAM_DECLNAME(section, name), \ 251 #define NCBI_PARAM_DEF_IN_SCOPE(type, section, name, default_value, scope) \ 252  SParamDescription< type > \ 253  X_NCBI_PARAM_DECLNAME_SCOPE(scope, section, name)::sm_ParamDescription = \ 254  { #section, #name, 0, default_value, NULL, eParam_Default }; \ 255  X_NCBI_PARAM_STATIC_DEF( \ 256  X_NCBI_PARAM_DECLNAME_SCOPE(scope, section, name), \ 261 #define NCBI_PARAM_ENUM_ARRAY(type, section, name) \ 262  static SEnumDescription< type > X_NCBI_PARAM_ENUMNAME(section, name)[] = 267 #define NCBI_PARAM_ENUM_DEF(type, section, name, default_value) \ 268  SParamEnumDescription< type > \ 269  X_NCBI_PARAM_DECLNAME(section, name)::sm_ParamDescription = \ 270  { #section, #name, 0, default_value, NULL, eParam_Default, \ 271  X_NCBI_PARAM_ENUMNAME(section, name), \ 272  ArraySize(X_NCBI_PARAM_ENUMNAME(section, name)) }; \ 273  X_NCBI_PARAM_STATIC_DEF(X_NCBI_PARAM_DECLNAME(section, name), \ 280 #define NCBI_PARAM_ENUM_DEF_EX(type, section, name, \ 281  default_value, flags, env) \ 282  SParamEnumDescription< type > \ 283  X_NCBI_PARAM_DECLNAME(section, name)::sm_ParamDescription = \ 284  { #section, #name, #env, default_value, NULL, flags, \ 285  X_NCBI_PARAM_ENUMNAME(section, name), \ 286  ArraySize(X_NCBI_PARAM_ENUMNAME(section, name)) }; \ 287  X_NCBI_PARAM_STATIC_DEF(X_NCBI_PARAM_DECLNAME(section, name), \ 294 #define NCBI_PARAM_STATIC_PROXY(user_type, pod_type) \ 295  template<> class CSafeStatic_Proxy<user_type> { \ 297  typedef user_type TValue; \ 298  typedef pod_type TStaticInit; \ 299  CSafeStatic_Proxy(void) {} \ 300  CSafeStatic_Proxy(TStaticInit init) : m_Value(init) {} \ 301  CSafeStatic_Proxy(TValue value) : m_Value(value) {} \ 302  CSafeStatic_Proxy& operator=(TStaticInit init) { \ 306  CSafeStatic_Proxy& operator=(TValue value) { \ 310  operator TValue& (void) { return m_Value; } \ 312  mutable TValue m_Value; \ 354 template

<

class

TDescription,

class

TParam>

405  static void

EnableConfigDump(

bool

enable);

445 template

<

class

TDescription>

454  typedef typename

TDescription::TTls

TTls

;

466  CParam

(

const string

& section,

const string

& name);

545  const char

* variable,

546  const char

* env_var_name,

547  const char

* default_value,

569  const char

* variable,

570  const char

* env_var_name,

592  const char

* variable,

593  const char

* env_var_name,

616  const char

* variable,

617  const char

* env_var_name,

618  double

default_value);

static const char * str(char *buf, int n)

virtual const char * GetErrCodeString(void) const override

Translate from the error code value to its string representation.

static void ResetDefault(void)

Reload the global default value from the environment/registry or reset it to the initial value specif...

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

Get integer configuration value.

void Reset(void)

Reset value as if it has not been initialized yet.

EParamState

Current param state flag - indicates which possible sources for the param have been checked.

double g_GetConfigDouble(const char *section, const char *variable, const char *env_var_name, double default_value)

Get double configuration value.

static EParamState GetState(bool *sourcing_complete=nullptr, EParamSource *param_source=nullptr)

Get current state of the param.

CParam< TDescription > TParam

static void SetThreadDefault(const TValueType &val)

Set new thread-local default value.

static bool sx_IsSetFlag(ENcbiParamFlags flag)

CParamParser< TParamDescription, TTagType > TParamParser

NCBI_EXCEPTION_DEFAULT(CParamException, CCoreException)

TParamDescription::TValueType TValueType

void Set(const TValueType &val)

Set new parameter value (this instance only).

static TValueType GetThreadDefault(void)

Get thread-local default value if set or global default value.

static bool sx_CanGetDefault(void)

EParamCacheFlag

Caching default value on construction of a param.

static SSystemMutex & s_GetLock(void)

static TTls & sx_GetTls(void)

static string ValueToString(const TValueType &val, const TParamDesc &descr)

static EParamSource & sx_GetSource(void)

TValueType Get(void) const

Get current parameter value.

TDescription::TTagType TTagType

ENcbiParamFlags

ENcbiParamFlags.

TDescription::TValueType TValueType

CParam(const string &section, const string &name)

Load parameter value from registry or environment.

static void ResetThreadDefault(void)

Reset thread default value as if it has not been set.

CParam(const TValueType &val)

Create parameter with a given value, ignore defaults.

string g_GetConfigString(const char *section, const char *variable, const char *env_var_name, const char *default_value, CParamBase::EParamSource *src=nullptr)

Helper functions for getting values from registry/environment.

static void SetDefault(const TValueType &val)

Set new global default value.

static EParamState & sx_GetState(void)

EParamSource

Source of the value returned by CParam::GetDefault().

static TValueType GetDefault(void)

Get global default value.

static TValueType & sx_GetDefault(bool force_reset=false)

TDescription::TDescription TParamDescription

atomic< bool > m_ValueSet

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

Get boolean configuration value.

static TValueType StringToValue(const string &str, const TParamDesc &descr)

@ eNoThreadValue

Per-thread value is prohibited by flags.

@ eParserError

Can not convert string to value.

@ eBadValue

Unexpected parameter value.

@ eParamCache_Try

Cache the default value if the application registry is already initialized.

@ eParamCache_Force

Force caching currently set default value.

@ eParamCache_Defer

Do not try to cache the default value.

@ eParam_NoLoad

Do not load from registry or environment.

@ eParam_NoThread

Do not use per-thread values.

@ eParam_Default

Default flags.

@ eSource_EnvVar

Environment.

@ eSource_NotSet

Not fully initialized.

@ eSource_Func

Initialization function.

@ eSource_Default

Hardcoded default.

@ eSource_User

User code.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

#define NCBI_XNCBI_EXPORT

Multi-threading – classes, functions, and features.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4