NCBI C++ ToolKit
bdb_util.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: bdb_util.cpp 77790 2017-05-08 13:31:07Z ivanov $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Anatoliy Kuznetsov
27  *
28  * File Description: BDB library utilities.
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 #include <corelib/ncbifile.hpp>
34 #include <db/bdb/bdb_util.hpp>
35 #include <db/bdb/bdb_env.hpp>
36 #include <db/error_codes.hpp>
37 #include <util/strsearch.hpp>
38 
39 
40 #define NCBI_USE_ERRCODE_X Db_Bdb_Util
41 
43 
44 
45 /// Check if field is a variant of string, returns pointer on the
46 /// internal buffer (or NULL).
47 ///
48 /// @internal
49 static
50 const char* BDB_GetStringFieldBuf(const CBDB_Field& fld)
51 {
52  const CBDB_FieldString* str_fld =
53  dynamic_cast<const CBDB_FieldString*>(&fld);
54  if (str_fld) {
55  return (const char*)fld.GetBuffer();
56  } else {
57  const CBDB_FieldLString* lstr_fld =
58  dynamic_cast<const CBDB_FieldLString*>(&fld);
59  if (lstr_fld) {
60  return (const char*)fld.GetBuffer();
61  }
62  }
63  return 0;
64 }
65 
66 /// Search for value in the field buffer
67 ///
68 /// @return -1 if not found, otherwise field number
69 ///
70 /// @internal
71 static
72 int BDB_find_field(const CBDB_BufferManager& buffer_man,
73  const CBoyerMooreMatcher& matcher,
74  string* tmp_str)
75 {
76  int fidx = -1;
77  unsigned int fcount = buffer_man.FieldCount();
78  for (unsigned i = 0; i < fcount; ++i) {
79  const CBDB_Field& fld = buffer_man.GetField(i);
80 
81  if (fld.IsNull()) {
82  continue;
83  }
84 
85  size_t str_buf_len;
86  const char* str_buf = BDB_GetStringFieldBuf(fld);
87 
88  // for string based fields it should be non-0
89 
90  if (str_buf) {
91  str_buf_len = fld.GetDataLength(str_buf);
92  match:
93  if (str_buf_len) {
94  size_t pos = matcher.Search(str_buf, 0, str_buf_len);
95  if (pos == NPOS) {
96  fidx = i;
97  break;
98  }
99  }
100  } else {
101  if (tmp_str) {
102  fld.ToString(*tmp_str);
103  str_buf = tmp_str->c_str();
104  str_buf_len = tmp_str->length();
105  goto match;
106  }
107  }
108 
109 
110  } // for i
111  return fidx;
112 }
113 
115  const CBoyerMooreMatcher& matcher,
116  string* tmp_str)
117 {
119  const CBDB_BufferManager* buffer_man;
120  buffer_man = dbf.GetKeyBuffer();
121  if (buffer_man) {
122  fidx = BDB_find_field(*buffer_man, matcher, tmp_str);
123  if (fidx >= 0) {
124  fidx = BDB_GetUFieldIdx(fidx, true /* key */);
125  return fidx;
126  } else {
127  fidx = 0;
128  }
129  }
130 
131  buffer_man = dbf.GetDataBuffer();
132  if (buffer_man) {
133  fidx = BDB_find_field(*buffer_man, matcher, tmp_str);
134  if (fidx >= 0) {
135  fidx = BDB_GetUFieldIdx(fidx, false /* key */);
136  return fidx;
137  } else {
138  fidx = 0;
139  }
140  }
141 
142  return fidx;
143 }
144 
145 int BDB_get_rowid(const CBDB_File& dbf)
146 {
147  const CBDB_BufferManager* buffer_man;
148  buffer_man = dbf.GetKeyBuffer();
149  if (!buffer_man) {
150  return 0;
151  }
152  const CBDB_Field& fld = buffer_man->GetField(0);
153  {{
154  const CBDB_FieldInt2* fi = dynamic_cast<const CBDB_FieldInt2*>(&fld);
155  if (fi)
156  return fi->Get();
157  }}
158  {{
159  const CBDB_FieldInt4* fi = dynamic_cast<const CBDB_FieldInt4*>(&fld);
160  if (fi)
161  return fi->Get();
162  }}
163  {{
164  const CBDB_FieldUint4* fi = dynamic_cast<const CBDB_FieldUint4*>(&fld);
165  if (fi)
166  return fi->Get();
167  }}
168 
169  return 0;
170 }
171 
172 
173 
174 
175 //////////////////////////////////////////////////////////////////////////////
176 ///
177 /// Log a parameter in a human-readable format
178 ///
179 /// @internal
180 ///
181 template <typename T>
182 void s_LogEnvParam(const string& param_name,
183  const T& param_value,
184  const string& units = kEmptyStr)
185 {
186  LOG_POST_X(1, Info
187  << setw(20) << param_name
188  << " : "
189  << param_value << units);
190 }
191 
192 /// Log a parameter in a human-readable format
193 ///
194 /// @internal
195 static
196 void s_LogEnvParam(const string& param_name,
197  const bool& param_value)
198 {
199  LOG_POST_X(2, Info
200  << setw(20) << param_name
201  << " : "
202  << (param_value ? "true" : "false"));
203 }
204 
205 
206 
207 static const char* kEnvParam_type = "env_type";
208 static const char* kEnvParam_path = "path";
209 static const char* kEnvParam_reinit = "reinit";
210 static const char* kEnvParam_errfile = "error_file";
211 
212 static const char* kEnvParam_mem_size = "mem_size";
213 static const char* kEnvParam_cache_size = "cache_size";
214 static const char* kEnvParam_cache_num = "cache_num";
215 static const char* kEnvParam_log_mem_size = "log_mem_size";
216 static const char* kEnvParam_write_sync = "write_sync";
217 static const char* kEnvParam_direct_db = "direct_db";
218 static const char* kEnvParam_direct_log = "direct_log";
219 static const char* kEnvParam_transaction_log_path = "transaction_log_path";
220 static const char* kEnvParam_log_file_max = "log_file_max";
221 static const char* kEnvParam_log_autoremove = "log_autoremove";
222 static const char* kEnvParam_lock_timeout = "lock_timeout";
223 static const char* kEnvParam_TAS_spins = "tas_spins";
224 static const char* kEnvParam_max_locks = "max_locks";
225 static const char* kEnvParam_max_lock_objects = "max_lock_objects";
226 static const char* kEnvParam_mp_maxwrite = "mp_maxwrite";
227 static const char* kEnvParam_mp_maxwrite_sleep = "mp_maxwrite_sleep";
228 
229 static const char* kEnvParam_checkpoint_interval = "checkpoint_interval";
230 static const char* kEnvParam_enable_checkpoint = "enable_checkpoint";
231 static const char* kEnvParam_checkpoint_kb = "checkpoint_kb";
232 static const char* kEnvParam_checkpoint_min = "checkpoint_min";
233 static const char* kEnvParam_memp_trickle_percent = "memp_trickle_percent";
234 
235 
237  const string& section_name)
238 {
239  unique_ptr<CBDB_Env> env;
240 
242 
243  string env_type =
244  reg.GetString(section_name, kEnvParam_type, "transactional");
245  NStr::ToLower(env_type);
246  if (NStr::EqualNocase(env_type, "locking")) {
247  e_type = CBDB_Env::eEnvLocking;
248  } else if (NStr::EqualNocase(env_type, "transactional")) {
250  } else if (NStr::EqualNocase(env_type, "concurrent")) {
251  e_type = CBDB_Env::eEnvConcurrent;
252  }
253 
254  // path to the environment, re-initialization options
255 
256  string path =
257  reg.GetString(section_name, kEnvParam_path, ".");
259  s_LogEnvParam("BDB env.path", path);
260 
261  bool reinit =
262  reg.GetBool(section_name, kEnvParam_reinit, false, 0,
264 
265 
266  // Make sure our directory exists
267  {{
268  CDir dir(path);
269  if ( !dir.Exists() ) {
270  dir.Create();
271  } else {
272  if (reinit) {
273  s_LogEnvParam("BDB re-initialization", reinit);
274 
275  dir.Remove();
276  dir.Create();
277  }
278  }
279  }}
280 
281  // the error file for BDB errors
282  string err_path = reg.GetString(section_name, kEnvParam_errfile,
283  path + "/bdb_err.log");
284 
285  if (!err_path.empty()) {
286  string dir, base, ext;
287  CDirEntry::SplitPath(err_path, &dir, &base, &ext);
288  if (dir.empty()) {
289  err_path = CDirEntry::MakePath(path, base, ext);
290  }
291  }
292 
293  // cache RAM size
294  string cache_size_str;
295  if (reg.HasEntry(section_name, kEnvParam_cache_size)) {
296  cache_size_str =
297  reg.GetString(section_name, kEnvParam_cache_size, "");
298  } else {
299  cache_size_str =
300  reg.GetString(section_name, kEnvParam_mem_size, "");
301  }
302  Uint8 cache_size =
304 
305  int cache_num =
306  reg.GetInt(section_name, kEnvParam_cache_num, 1, 0,
308 
309  // in-memory log size
310  string log_mem_size_str;
311  log_mem_size_str =
312  reg.GetString(section_name, kEnvParam_log_mem_size, "");
313  Uint8 log_mem_size =
315 
316  // transaction log path
317  string log_path =
318  reg.GetString(section_name, kEnvParam_transaction_log_path,
319  path);
320 
321  // transaction log file max
322  string log_max_str;
323  log_max_str =
324  reg.GetString(section_name, kEnvParam_log_file_max, "200M");
325  Uint8 log_max = NStr::StringToUInt8_DataSize(log_max_str);
326  if (log_max < 1024 * 1024) {
327  log_max = 1024 * 1024;
328  }
329 
330  // automatic log truncation
331  bool log_autoremove =
332  reg.GetBool(section_name, kEnvParam_log_autoremove, true, 0,
334 
335  // transaction sync
336  bool write_sync =
337  reg.GetBool(section_name, kEnvParam_write_sync, false, 0,
339 
340  // direct IO
341  bool direct_db =
342  reg.GetBool(section_name, kEnvParam_direct_db, false, 0,
344 
345  bool direct_log =
346  reg.GetBool(section_name, kEnvParam_direct_log, false, 0,
348 
349  // deadlock detection interval
350  int lock_timeout =
351  reg.GetInt(section_name, kEnvParam_lock_timeout, 0, 0,
353 
354  // BDB spin lock spin count
355  int tas_spins =
356  reg.GetInt(section_name, kEnvParam_TAS_spins, 0, 0,
358 
359  // maximum locks and locked objects
360  // lock starvation is a critical flaw in a transactional situation,
361  // and will lead to deadlocks or worse
362  //
363  int max_locks =
364  reg.GetInt(section_name, kEnvParam_max_locks, 0, 0,
366  int max_lock_objects =
367  reg.GetInt(section_name, kEnvParam_max_lock_objects, 0, 0,
369 
370  // mempool write governors
371  // we can limit the amount written in any sync operation, as well as
372  // determine a sleep time between successive writes
373  //
374  int mp_maxwrite =
375  reg.GetInt(section_name, kEnvParam_mp_maxwrite, 0, 0,
377  int mp_maxwrite_sleep =
378  reg.GetInt(section_name, kEnvParam_mp_maxwrite_sleep, 0, 0,
380 
381  // checkpointing parameters
382  //
383  int checkpoint_interval =
384  reg.GetInt(section_name, kEnvParam_checkpoint_interval, 30, 0,
386 
387  bool enable_checkpoint =
388  reg.GetBool(section_name, kEnvParam_enable_checkpoint, true, 0,
390 
391  int checkpoint_kb =
392  reg.GetInt(section_name, kEnvParam_checkpoint_kb, 256, 0,
394 
395  int checkpoint_min =
396  reg.GetInt(section_name, kEnvParam_checkpoint_min, 5, 0,
398 
399  int memp_trickle_percent =
400  reg.GetInt(section_name, kEnvParam_memp_trickle_percent, 60, 0,
402 
403 
404  //
405  // establish our BDB environment
406  //
407  try {
408  env.reset(new CBDB_Env());
409  s_LogEnvParam("BDB error file)", err_path);
410  env->OpenErrFile(err_path);
411  if (cache_size) {
412  s_LogEnvParam("BDB cache size)", cache_size);
413  env->SetCacheSize(cache_size, cache_num);
414  }
415  if (log_mem_size) {
416  env->SetLogInMemory(true);
417  s_LogEnvParam("BDB log mem size (in-memory log)", log_mem_size);
418  env->SetLogBSize((unsigned)log_mem_size);
419  }
420 
421  if (!log_path.empty() && log_path != path) {
422  s_LogEnvParam("BDB log path", log_path);
423  env->SetLogDir(log_path);
424  }
425 
426  if (log_max) {
427  s_LogEnvParam("BDB log file max size", log_max);
428  env->SetLogFileMax((unsigned)log_max);
429  }
430  s_LogEnvParam("BDB log auto remove", log_autoremove);
431  env->SetLogAutoRemove(log_autoremove);
432 
433  s_LogEnvParam("BDB direct db", direct_db);
434  s_LogEnvParam("BDB direct log", direct_log);
435  env->SetDirectDB(direct_db);
436  env->SetDirectLog(direct_log);
437 
438 
439  if (lock_timeout) {
440  s_LogEnvParam("BDB lock timeout", lock_timeout);
441  env->SetLockTimeout(lock_timeout);
442  }
443  if (tas_spins) {
444  s_LogEnvParam("BDB TAS spins", tas_spins);
445  env->SetTasSpins(tas_spins);
446  }
447  if (max_locks) {
448  s_LogEnvParam("BDB max locks", max_locks);
449  env->SetMaxLocks(max_locks);
450  }
451  if (max_lock_objects) {
452  s_LogEnvParam("BDB max lock objects", max_lock_objects);
453  env->SetMaxLockObjects(max_lock_objects);
454  }
455  s_LogEnvParam("BDB mempool max write", mp_maxwrite);
456  s_LogEnvParam("BDB mempool max write sleep", mp_maxwrite_sleep);
457  env->SetMpMaxWrite(mp_maxwrite, mp_maxwrite_sleep);
458 
459  if (checkpoint_kb) {
460  s_LogEnvParam("BDB checkpoint KB", checkpoint_kb);
461  env->SetCheckPointKB(checkpoint_kb);
462  }
463  if (checkpoint_min) {
464  s_LogEnvParam("BDB checkpoint minitues", checkpoint_min);
465  env->SetCheckPointMin(checkpoint_min);
466  }
467  env->EnableCheckPoint(enable_checkpoint);
468 
469 
470  switch (e_type) {
472  env->OpenWithTrans(path,
474  break;
476  env->OpenWithLocks(path);
477  break;
479  env->OpenConcurrentDB(path);
480  break;
481  default:
482  _ASSERT(0);
483  }
484 
485 
486  if (env->IsTransactional()) {
487  if (write_sync) {
488  s_LogEnvParam("BDB transaction sync", "Sync");
489  env->SetTransactionSync(CBDB_Transaction::eTransSync);
490  } else {
491  s_LogEnvParam("BDB transaction sync", "Async");
492  env->SetTransactionSync(CBDB_Transaction::eTransASync);
493  }
494  // TODO: another parameter to add
495  s_LogEnvParam("BDB deadlock detection", "Default");
496  env->SetLkDetect(CBDB_Env::eDeadLock_Default);
497  }
498 
499 
500  if (checkpoint_interval) {
501  s_LogEnvParam("BDB checkpoint interval (sec)", checkpoint_interval);
502  s_LogEnvParam("BDB trickle percent", memp_trickle_percent);
503  env->RunCheckpointThread(checkpoint_interval, memp_trickle_percent);
504  }
505  }
506  catch (CBDB_ErrnoException& e) {
507  if (e.IsRecovery()) {
508  env.reset();
509  BDB_RecoverEnv(path, true);
510  }
511  throw;
512  }
513 
514  return env.release();
515 }
516 
517 
518 
519 
Wrapper around Berkeley DB environment structure.
static const char * kEnvParam_direct_db
Definition: bdb_util.cpp:217
static const char * kEnvParam_mp_maxwrite_sleep
Definition: bdb_util.cpp:227
static const char * kEnvParam_direct_log
Definition: bdb_util.cpp:218
static const char * kEnvParam_log_file_max
Definition: bdb_util.cpp:220
static const char * kEnvParam_max_lock_objects
Definition: bdb_util.cpp:225
static const char * BDB_GetStringFieldBuf(const CBDB_Field &fld)
Check if field is a variant of string, returns pointer on the internal buffer (or NULL).
Definition: bdb_util.cpp:50
static int BDB_find_field(const CBDB_BufferManager &buffer_man, const CBoyerMooreMatcher &matcher, string *tmp_str)
Search for value in the field buffer.
Definition: bdb_util.cpp:72
static const char * kEnvParam_path
Definition: bdb_util.cpp:208
static const char * kEnvParam_log_autoremove
Definition: bdb_util.cpp:221
static const char * kEnvParam_reinit
Definition: bdb_util.cpp:209
static const char * kEnvParam_TAS_spins
Definition: bdb_util.cpp:223
static const char * kEnvParam_type
Definition: bdb_util.cpp:207
static const char * kEnvParam_errfile
Definition: bdb_util.cpp:210
static const char * kEnvParam_checkpoint_kb
Definition: bdb_util.cpp:231
static const char * kEnvParam_transaction_log_path
Definition: bdb_util.cpp:219
static const char * kEnvParam_write_sync
Definition: bdb_util.cpp:216
static const char * kEnvParam_lock_timeout
Definition: bdb_util.cpp:222
static const char * kEnvParam_memp_trickle_percent
Definition: bdb_util.cpp:233
static const char * kEnvParam_cache_size
Definition: bdb_util.cpp:213
static const char * kEnvParam_mp_maxwrite
Definition: bdb_util.cpp:226
static const char * kEnvParam_mem_size
Definition: bdb_util.cpp:212
static const char * kEnvParam_cache_num
Definition: bdb_util.cpp:214
static const char * kEnvParam_max_locks
Definition: bdb_util.cpp:224
static const char * kEnvParam_enable_checkpoint
Definition: bdb_util.cpp:230
static const char * kEnvParam_log_mem_size
Definition: bdb_util.cpp:215
static const char * kEnvParam_checkpoint_min
Definition: bdb_util.cpp:232
static const char * kEnvParam_checkpoint_interval
Definition: bdb_util.cpp:229
void s_LogEnvParam(const string &param_name, const T &param_value, const string &units=kEmptyStr)
Log a parameter in a human-readable format.
Definition: bdb_util.cpp:182
BDB Data Field Buffer manager class.
Definition: bdb_types.hpp:1768
BDB environment object a collection including support for some or all of caching, locking,...
Definition: bdb_env.hpp:61
BDB errno exception class.
Definition: bdb_expt.hpp:84
Int2 field type.
Definition: bdb_types.hpp:911
Int4 field type.
Definition: bdb_types.hpp:827
Length prefised string field type.
Definition: bdb_types.hpp:1709
String field type designed to work with C-strings (ASCIIZ)
Definition: bdb_types.hpp:1590
Uint4 field type.
Definition: bdb_types.hpp:1267
Base class for constructing BDB fields.
Definition: bdb_types.hpp:297
Berkeley DB file class.
Definition: bdb_file.hpp:445
This implemetation uses the Boyer-Moore alg.
Definition: strsearch.hpp:71
CDir –.
Definition: ncbifile.hpp:1696
CNcbiRegistry –.
Definition: ncbireg.hpp:913
#define T(s)
Definition: common.h:230
static HENV env
Definition: transaction2.c:38
CBDB_File::TUnifiedFieldIndex BDB_GetUFieldIdx(int fidx, bool key)
Make field index in CBDB_File format.
Definition: bdb_file.hpp:710
int TUnifiedFieldIndex
CBDB_File keeps data in two buffers (key buffer and data buffer).
Definition: bdb_file.hpp:542
const CBDB_BufferManager * GetKeyBuffer() const
Get Buffer manager for key section of the file.
Definition: bdb_file.hpp:513
const CBDB_BufferManager * GetDataBuffer() const
Get Buffer manager for data section of the file.
Definition: bdb_file.hpp:516
bool IsNull() const
Return TRUE if field is NULL.
Definition: bdb_types.hpp:2171
Uint4 Get() const
Definition: bdb_types.hpp:1286
unsigned int FieldCount() const
Return number of fields attached using function Bind.
Definition: bdb_types.hpp:2529
virtual size_t GetDataLength(const void *buf) const =0
Return current effective size of the buffer.
const CBDB_Field & GetField(unsigned int idx) const
Definition: bdb_types.hpp:2517
Int4 Get() const
Definition: bdb_types.hpp:846
Int2 Get() const
Definition: bdb_types.hpp:930
virtual void ToString(string &str) const =0
const void * GetBuffer() const
Get pointer to the data. NULL if not yet attached.
Definition: bdb_types.hpp:2213
int BDB_get_rowid(const CBDB_File &dbf)
Return record id (integer key)
Definition: bdb_util.cpp:145
CBDB_Env * BDB_CreateEnv(const CNcbiRegistry &reg, const string &section_name)
Create and configure BDB environment using CNcbiRegistry as a parameter container.
Definition: bdb_util.cpp:236
void BDB_RecoverEnv(const string &path, bool fatal_recover)
Run Berkeley DB recovery in private environment.
Definition: bdb_env.cpp:1145
EEnvType
Environment types.
Definition: bdb_env.hpp:71
bool IsRecovery() const
If it is DB_RUNRECOVERY error.
Definition: bdb_expt.cpp:81
@ eTransASync
Non-durable asyncronous transaction.
Definition: bdb_trans.hpp:70
@ eTransSync
Syncronous transaction.
Definition: bdb_trans.hpp:69
@ eEnvTransactional
Definition: bdb_env.hpp:74
@ eEnvConcurrent
Definition: bdb_env.hpp:73
@ eEnvLocking
Definition: bdb_env.hpp:72
@ eRunRecovery
Run DB recovery first.
Definition: bdb_env.hpp:65
@ eThreaded
corresponds to DB_THREAD
Definition: bdb_env.hpp:64
@ eDeadLock_Default
Default deadlock detector.
Definition: bdb_env.hpp:348
#define LOG_POST_X(err_subcode, message)
Definition: ncbidiag.hpp:553
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
static string MakePath(const string &dir=kEmptyStr, const string &base=kEmptyStr, const string &ext=kEmptyStr)
Assemble a path from basic components.
Definition: ncbifile.cpp:413
static string AddTrailingPathSeparator(const string &path)
Add trailing path separator, if needed.
Definition: ncbifile.cpp:455
virtual bool Exists(void) const
Check if directory "dirname" exists.
Definition: ncbifile.hpp:4066
bool Create(TCreateFlags flags=fCreate_Default) const
Create the directory using "dirname" passed in the constructor.
Definition: ncbifile.cpp:4071
virtual bool Remove(TRemoveFlags flags=eRecursive) const
Delete existing directory.
Definition: ncbifile.cpp:4342
static void SplitPath(const string &path, string *dir=0, string *base=0, string *ext=0)
Split a path string into its basic components.
Definition: ncbifile.cpp:358
uint64_t Uint8
8-byte (64-bit) unsigned integer
Definition: ncbitype.h:105
virtual bool GetBool(const string &section, const string &name, bool default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get boolean value of specified parameter name.
Definition: ncbireg.cpp:391
virtual int GetInt(const string &section, const string &name, int default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get integer value of specified parameter name.
Definition: ncbireg.cpp:362
virtual bool HasEntry(const string &section, const string &name=kEmptyStr, TFlags flags=0) const
Definition: ncbireg.cpp:290
virtual string GetString(const string &section, const string &name, const string &default_value, TFlags flags=0) const
Get the parameter string value.
Definition: ncbireg.cpp:321
@ eReturn
Return default value.
Definition: ncbireg.hpp:203
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
size_t Search(const string &text, size_t pos=0) const
Search for the pattern over text starting at position pos.
Definition: strsearch.hpp:161
#define kEmptyStr
Definition: ncbistr.hpp:123
static Uint8 StringToUInt8_DataSize(const CTempString str, TStringToNumFlags flags=0)
Convert string that can contain "software" qualifiers to Uint8.
Definition: ncbistr.cpp:1530
#define NPOS
Definition: ncbistr.hpp:133
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5347
static string & ToLower(string &str)
Convert string to lower case – string& version.
Definition: ncbistr.cpp:405
@ fConvErr_NoThrow
Do not throw an exception on error.
Definition: ncbistr.hpp:285
Definition of all error codes used in bdb library (bdb.lib and ncbi_xcache_bdb.lib).
int i
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
Definition: pcre2_match.c:594
String search utilities.
#define _ASSERT
Modified on Fri Sep 20 14:58:15 2024 by modify_doxy.py rev. 669887