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

Go to the SVN repository for this file.

1 /* $Id: asnval.cpp 102322 2024-04-23 12:29:28Z foleyjp $
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: Jonathan Kans, Clifford Clausen, Aaron Ucko
27  *
28  * File Description:
29  * validator
30  *
31  */
32 
33 #include <ncbi_pch.hpp>
34 #include <common/ncbi_source_ver.h>
35 #include <corelib/ncbistd.hpp>
36 #include <corelib/ncbistre.hpp>
37 #include <corelib/ncbiapp.hpp>
38 #include <corelib/ncbiargs.hpp>
39 
40 #include <serial/objistr.hpp>
41 
43 #include <connect/ncbi_util.h>
44 
45 // Objects includes
48 
49 // Object Manager includes
52 
54 #include "app_config.hpp"
55 #include "thread_state.hpp"
56 #include "message_handler.hpp"
57 #include <util/message_queue.hpp>
58 #include <future>
59 
60 #include <common/test_assert.h> /* This header must go last */
61 
62 using namespace ncbi;
64 USING_SCOPE(validator);
66 
67 template<class _T>
69 {
70 public:
71  using token_type = _T;
72  TThreadPoolLimited(unsigned num_slots, unsigned queue_depth = 0):
73  m_tasks_semaphore{num_slots, num_slots},
74  m_product_queue{queue_depth == 0 ? num_slots : queue_depth}
75  {}
76 
77  // acquire new slot to run on
78  void acquire() {
79  m_tasks_semaphore.Wait();
80  }
81 
82  // release a slot and send a product down to the queue
83  void release(token_type&& token) {
84  m_tasks_semaphore.Post();
85  m_product_queue.push_back(std::move(token));
86  }
87 
88  auto GetNext() {
89  return m_product_queue.pop_front();
90  }
91 
92  void request_stop() {
93  m_product_queue.push_back({});
94  }
95 
96 private:
98  CMessageQueue<token_type> m_product_queue{8}; // the queue of threads products
99 };
100 
102 {
103 
104 public:
105  CAsnvalApp();
106  ~CAsnvalApp();
107 
108  void Init() override;
109  int Run() override;
110 
111 private:
112  void Setup(const CArgs& args);
113  void x_AliasLogFile();
114 
115  CThreadExitData xValidate(const string& filename, CNcbiOstream& ostr);
116  CThreadExitData xValidateSeparateOutputs(const string& filename);
117 
118  void xValidateThreadSeparateOutputs(const string& filename);
119  void xValidateThreadSingleOutput(const string& filename, CAsyncMessageHandler& msgHandler);
120  CThreadExitData xCombinedStatsTask();
121 
123 
124  size_t ValidateOneDirectory(string dir_name,
125  bool recurse,
126  CAsyncMessageHandler* pMessageHandler=nullptr); // returns the number of processed files
127  TPool m_queue{8};
128 
129  unique_ptr<CAppConfig> mAppConfig;
130  unique_ptr<edit::CRemoteUpdater> mRemoteUpdater;
131  atomic<size_t> m_NumFiles{0};
132  string m_InputDir;
133  string m_OutputDir;
134 };
135 
136 
137 static unique_ptr<CNcbiOstream> s_MakeOstream(const string& in_filename,
138  const string& inputDir=kEmptyStr,
139  const string& outputDir=kEmptyStr)
140 {
141  string path;
142  if (in_filename.empty()) {
143  path = "stdin.val";
144  } else {
145  size_t pos = NStr::Find(in_filename, ".", NStr::eNocase, NStr::eReverseSearch);
146  if (pos != NPOS)
147  path = in_filename.substr(0, pos);
148  else
149  path = in_filename;
150 
151  path.append(".val");
152 
153  if (! outputDir.empty()) {
154  _ASSERT(!inputDir.empty());
155  NStr::ReplaceInPlace(path, inputDir, outputDir, 0, 1);
156  }
157  }
158 
159  return unique_ptr<CNcbiOstream>(new ofstream(path));
160 }
161 
162 CThreadExitData CAsnvalApp::xValidate(const string& filename, CNcbiOstream& ostr)
163 {
164  CAsnvalThreadState mContext(*mAppConfig, mRemoteUpdater->GetUpdateFunc());
165  return mContext.ValidateOneFile(filename, ostr);
166 }
167 
169 {
170  auto pOstr = s_MakeOstream(filename, m_InputDir, m_OutputDir);
171  return xValidate(filename, *pOstr);
172 }
173 
174 void CAsnvalApp::xValidateThreadSeparateOutputs(const string& filename)
175 {
176  CThreadExitData result = xValidateSeparateOutputs(filename);
177  std::promise<CThreadExitData> prom;
178  prom.set_value(std::move(result));
179  auto fut = prom.get_future();
180  m_queue.release(std::move(fut));
181 }
182 
183 
184 void CAsnvalApp::xValidateThreadSingleOutput(const string& filename, CAsyncMessageHandler& msgHandler)
185 {
186  CAsnvalThreadState mContext(*mAppConfig, mRemoteUpdater->GetUpdateFunc());
187  auto exitData = mContext.ValidateOneFile(filename, msgHandler);
188  std::promise<CThreadExitData> prom;
189  prom.set_value(std::move(exitData));
190  auto fut = prom.get_future();
191  m_queue.release(std::move(fut));
192 }
193 
194 
195 string s_GetSeverityLabel(EDiagSev sev, bool is_xml)
196 {
197  static const string str_sev[] = {
198  "NOTE", "WARNING", "ERROR", "REJECT", "FATAL", "MAX"
199  };
200  if (sev < 0 || sev > eDiagSevMax) {
201  return "NONE";
202  }
203  if (sev == 0 && is_xml) {
204  return "INFO";
205  }
206 
207  return str_sev[sev];
208 }
209 
210 
212 {
214  SetVersion(vers);
215 }
216 
217 
219 {
220 }
221 
222 
224 {
225  const CArgs& args = GetArgs();
226 
227  if (args["L"]) {
228  if (args["logfile"]) {
229  if (NStr::Equal(args["L"].AsString(), args["logfile"].AsString())) {
230  // no-op
231  } else {
232  NCBI_THROW(CException, eUnknown, "Cannot specify both -L and -logfile");
233  }
234  } else {
235  SetLogFile(args["L"].AsString());
236  }
237  }
238 }
239 
241 {
242  // Prepare command line descriptions
243 
244  // Create
245  unique_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
246 
247  arg_desc->AddOptionalKey
248  ("indir", "Directory", "Path to ASN.1 Files. '-x' specifies the input-file suffix",
250 
251  arg_desc->AddOptionalKey
252  ("i", "InFile", "Single Input File",
254 
255  arg_desc->SetDependency("indir", CArgDescriptions::eExcludes, "i");
256 
257  arg_desc->AddOptionalKey(
258  "outdir", "Directory", "Output directory",
260 
261  arg_desc->SetDependency("outdir", CArgDescriptions::eRequires, "indir");
262 
263  arg_desc->AddOptionalKey(
264  "o", "OutFile", "Single Output File",
266  arg_desc->AddOptionalKey(
267  "f", "Filter", "Substring Filter",
269  arg_desc->AddDefaultKey
270  ("x", "String", "File Selection Substring", CArgDescriptions::eString, ".ent");
271  arg_desc->AddFlag("u", "Recurse");
272  arg_desc->AddDefaultKey(
273  "R", "SevCount", "Severity for Error in Return Code\n\
274 \tinfo(0)\n\
275 \twarning(1)\n\
276 \terror(2)\n\
277 \tcritical(3)\n\
278 \tfatal(4)\n\
279 \ttrace(5)",
281  arg_desc->AddDefaultKey(
282  "Q", "SevLevel", "Lowest Severity for Error to Show\n\
283 \tinfo(0)\n\
284 \twarning(1)\n\
285 \terror(2)\n\
286 \tcritical(3)\n\
287 \tfatal(4)\n\
288 \ttrace(5)",
290  arg_desc->AddDefaultKey(
291  "P", "SevLevel", "Highest Severity for Error to Show\n\
292 \tinfo(0)\n\
293 \twarning(1)\n\
294 \terror(2)\n\
295 \tcritical(3)\n\
296 \tfatal(4)\n\
297 \ttrace(5)",
300  arg_desc->SetConstraint("Q", constraint);
301  arg_desc->SetConstraint("P", constraint);
302  arg_desc->SetConstraint("R", constraint);
303  arg_desc->AddOptionalKey(
304  "E", "String", "Only Error Code to Show",
306 
307  arg_desc->AddDefaultKey("a", "a",
308  "ASN.1 Type\n\
309 \ta Automatic\n\
310 \tc Catenated\n\
311 \te Seq-entry\n\
312 \tb Bioseq\n\
313 \ts Bioseq-set\n\
314 \tm Seq-submit\n\
315 \td Seq-desc",
317  "",
319 
320  arg_desc->AddFlag("b", "Input is in binary format; obsolete",
322  arg_desc->AddFlag("c", "Batch File is Compressed; obsolete",
324 
325  arg_desc->AddFlag("quiet", "Do not log progress");
326 
328  arg_desc->AddFlag("annot", "Verify Seq-annots only");
329 
330  arg_desc->AddOptionalKey(
331  "L", "OutFile", "Log File",
333 
334  arg_desc->AddDefaultKey("v", "Verbosity",
335  "Verbosity\n"
336  "\t1 Standard Report\n"
337  "\t2 Accession / Severity / Code(space delimited)\n"
338  "\t3 Accession / Severity / Code(tab delimited)\n"
339  "\t4 XML Report",
342  arg_desc->SetConstraint("v", v_constraint);
343 
344  arg_desc->AddFlag("cleanup", "Perform BasicCleanup before validating (to match C Toolkit)");
345  arg_desc->AddFlag("batch", "Process NCBI release file (Seq-submit or Bioseq-set only)");
346  arg_desc->AddFlag("huge", "Execute in huge-file mode");
347  arg_desc->AddFlag("disable-huge", "Explicitly disable huge-files mode");
348  arg_desc->SetDependency("disable-huge",
350  "huge");
351 
352  arg_desc->AddOptionalKey(
353  "D", "String", "Path to lat_lon country data files",
355 
359 
360  // Program description
361  arg_desc->SetUsageContext("", "ASN Validator");
362 
363  // Pass argument descriptions to the application
364  SetupArgDescriptions(arg_desc.release());
365 
366  x_AliasLogFile();
367 }
368 
369 
370 size_t CAsnvalApp::ValidateOneDirectory(string dir_name, bool recurse, CAsyncMessageHandler* pMsgHandler)
371 {
372  size_t num_to_process = 0;
373 
374  const CArgs& args = GetArgs();
375 
376  CDir dir(dir_name);
377 
378  string suffix = ".ent";
379  if (args["x"]) {
380  suffix = args["x"].AsString();
381  }
382  string mask = "*" + suffix;
383 
385 
386  bool separate_outputs = !args["o"];
387 
388  // Create output directory if it doesn't already exist
389  if (!m_OutputDir.empty()) {
390  string outputDirName = NStr::Replace(dir_name, m_InputDir, m_OutputDir, 0, 1);
391  CDir outputDir(outputDirName);
392  if (! outputDir.Exists()) {
393  outputDir.Create();
394  }
395  }
396 
397  if (separate_outputs) {
398  for (CDir::TEntry ii : files) {
399  string fname = ii->GetName();
400  if (ii->IsFile() &&
401  (!args["f"] || NStr::Find(fname, args["f"].AsString()) != NPOS)) {
402  string fpath = CDirEntry::MakePath(dir_name, fname);
403 
404  m_queue.acquire();
405  // start thread detached, it will post results to the queue itself
406  std::thread([this, fpath]()
407  { xValidateThreadSeparateOutputs(fpath); }).detach();
408 
409  ++num_to_process;
410  }
411  }
412  } else {
413  for (CDir::TEntry ii : files) {
414  string fname = ii->GetName();
415  if (ii->IsFile() &&
416  (!args["f"] || NStr::Find(fname, args["f"].AsString()) != NPOS)) {
417  string fpath = CDirEntry::MakePath(dir_name, fname);
418 
419  m_queue.acquire();
420  // start thread detached, it will post results to the queue itself
421  std::thread([this, fpath, separate_outputs, pMsgHandler]()
422  { xValidateThreadSingleOutput(fpath, *pMsgHandler); }).detach();
423 
424  ++num_to_process;
425  }
426  }
427  }
428 
429  if (recurse) {
430  CDir::TEntries subdirs(dir.GetEntries("", CDir::eDir));
431  for (CDir::TEntry ii : subdirs) {
432  string subdir = ii->GetName();
433  if (ii->IsDir() && !NStr::Equal(subdir, ".") && !NStr::Equal(subdir, "..")) {
434  string subname = CDirEntry::MakePath(dir_name, subdir);
435  num_to_process += ValidateOneDirectory(subname, recurse, pMsgHandler);
436  }
437  }
438  }
439 
440  return num_to_process;
441 }
442 
444 {
445  CThreadExitData combined_exit_data;
446 
447  while(true)
448  {
449  auto fut = m_queue.GetNext();
450  if (!fut.valid())
451  break;
452 
453  auto exit_data = fut.get();
454 
455  m_NumFiles++;
456 
457  combined_exit_data.mReported += exit_data.mReported;
458 
459  combined_exit_data.mNumRecords += exit_data.mNumRecords;
460  if (exit_data.mLongest > combined_exit_data.mLongest) {
461  combined_exit_data.mLongest = exit_data.mLongest;
462  combined_exit_data.mLongestId = exit_data.mLongestId;
463  }
464  }
465  return combined_exit_data;
466 }
467 
468 
470 {
471  const CArgs& args = GetArgs();
472  Setup(args);
473  if (args["indir"]) {
474  m_InputDir = args["indir"].AsString();
475  }
476 
477  if (args["outdir"]) {
478  m_OutputDir = args["outdir"].AsString();
479  }
480 
481  mRemoteUpdater.reset(new edit::CRemoteUpdater(nullptr)); //m_logger));
482 
483  CTime expires = GetFullVersion().GetBuildInfo().GetBuildTime();
484  if (!expires.IsEmpty())
485  {
486  expires.AddYear();
488  {
489  NcbiCerr << "This copy of " << GetProgramDisplayName()
490  << " is more than 1 year old. Please download the current version if it is newer." << endl;
491  }
492  }
493 
494  time_t start_time = time(NULL);
495 
496  std::ostream* ValidErrorStream = nullptr;
497  if (args["o"]) { // combined output
498  ValidErrorStream = &args["o"].AsOutputFile();
499  }
500 
501  if (args["D"]) {
502  string lat_lon_path = args["D"].AsString();
503  if (! lat_lon_path.empty()) {
504  SetEnvironment( "NCBI_LAT_LON_DATA_PATH", lat_lon_path );
505  }
506  }
507 
508  if (args["b"]) {
509  cerr << "Warning: -b is deprecated; do not use" << endl;
510  }
511 
512  CThreadExitData exit_data;
513  bool exception_caught = false;
514  try {
515  if (!m_InputDir.empty()) {
516 
517  if (ValidErrorStream) { // '-o' specified
518  CAsyncMessageHandler msgHandler(*mAppConfig, *ValidErrorStream);
519  msgHandler.SetInvokeWrite(false); // don't invoke write inside ValidateOneDirectory()
520 
521  auto writer_task = std::async([this, &msgHandler] { msgHandler.Write(); });
522 
523  auto num_to_process = ValidateOneDirectory(m_InputDir, args["u"], &msgHandler);
524  while (m_NumFiles != num_to_process) {
525  auto fut = m_queue.GetNext();
526  auto exitData = fut.get(); // this forces a wait
527  exit_data.mReported += exitData.mReported;
528  exit_data.mNumRecords += exitData.mNumRecords;
529  if (exitData.mLongest > exit_data.mLongest) {
530  exit_data.mLongest = exitData.mLongest;
531  exit_data.mLongestId = exitData.mLongestId;
532  }
533  ++m_NumFiles;
534  }
535  msgHandler.RequestStop();
536  writer_task.wait();
537  exit_data.mReported += msgHandler.GetNumReported();
538  }
539  else { // write to separate files
540  auto writer_task = std::async([this, ValidErrorStream] { return xCombinedStatsTask(); });
541 
542  auto num_to_process = ValidateOneDirectory(m_InputDir, args["u"]);
543  while (m_NumFiles != num_to_process) {
544  }
545  m_queue.request_stop();
546  exit_data = writer_task.get(); // this will wait writer task completion
547  }
548 
549  } else {
550  string in_filename = (args["i"]) ? args["i"].AsString() : "";
551 
552  if (ValidErrorStream) {
553  exit_data = xValidate(in_filename, *ValidErrorStream);
554  } else {
555  auto pOstr = s_MakeOstream(in_filename);
556  exit_data = xValidate(in_filename, *pOstr);
557  }
558  m_NumFiles++;
559  }
560  } catch (CException& e) {
561  ERR_POST(Error << e);
562  exception_caught = true;
563  }
564  if (m_NumFiles == 0) {
565  ERR_POST("No matching files found");
566  }
567 
568  time_t stop_time = time(NULL);
569  if (! mAppConfig->mQuiet ) {
570  LOG_POST_XX(Corelib_App, 1, "Finished in " << stop_time - start_time << " seconds");
571  LOG_POST_XX(Corelib_App, 1, "Longest processing time " << exit_data.mLongest << " seconds on " << exit_data.mLongestId);
572  LOG_POST_XX(Corelib_App, 1, "Total number of records " << exit_data.mNumRecords);
573  }
574 
575  return (exit_data.mReported > 0 || exception_caught);
576 }
577 
578 
579 void CAsnvalApp::Setup(const CArgs& args)
580 {
581  // Setup application registry and logs for CONNECT library
582  // CORE_SetLOG(LOG_cxx2c());
583  // CORE_SetREG(REG_cxx2c(&GetConfig(), false));
584  // Setup MT-safety for CONNECT library
585  // CORE_SetLOCK(MT_LOCK_cxx2c());
586 
587  mAppConfig.reset(new CAppConfig(args, GetConfig()));
588 
589  // Create object manager
593 }
594 
595 
596 /////////////////////////////////////////////////////////////////////////////
597 // MAIN
598 
599 int main(int argc, const char* argv[])
600 {
601  #ifdef _DEBUG
602  // this code converts single argument into multiple, just to simplify testing
603  list<string> split_args;
604  vector<const char*> new_argv;
605 
606  if (argc==2 && argv && argv[1] && strchr(argv[1], ' '))
607  {
608  NStr::Split(argv[1], " ", split_args);
609 
610  auto it = split_args.begin();
611  while (it != split_args.end())
612  {
613  auto next = it; ++next;
614  if (next != split_args.end() &&
615  ((it->front() == '"' && it->back() != '"') ||
616  (it->front() == '\'' && it->back() != '\'')))
617  {
618  it->append(" "); it->append(*next);
619  next = split_args.erase(next);
620  } else it = next;
621  }
622  for (auto& rec: split_args)
623  {
624  if (rec.front()=='\'' && rec.back()=='\'')
625  rec=rec.substr(1, rec.length()-2);
626  }
627  argc = 1 + split_args.size();
628  new_argv.reserve(argc);
629  new_argv.push_back(argv[0]);
630  for (const string& s : split_args)
631  {
632  new_argv.push_back(s.c_str());
633  std::cerr << s.c_str() << " ";
634  }
635  std::cerr << "\n";
636 
637 
638  argv = new_argv.data();
639  }
640  #endif
641  return CAsnvalApp().AppMain(argc, argv);
642 }
USING_SCOPE(objects)
string s_GetSeverityLabel(EDiagSev sev, bool is_xml)
Definition: asnval.cpp:195
static unique_ptr< CNcbiOstream > s_MakeOstream(const string &in_filename, const string &inputDir=kEmptyStr, const string &outputDir=kEmptyStr)
Definition: asnval.cpp:137
int main(int argc, const char *argv[])
Definition: asnval.cpp:599
ncbi::TMaskedQueryRegions mask
AutoPtr –.
Definition: ncbimisc.hpp:401
CArgAllow_Integers –.
Definition: ncbiargs.hpp:1751
CArgAllow –.
Definition: ncbiargs.hpp:1488
CArgDescriptions –.
Definition: ncbiargs.hpp:541
CArgs –.
Definition: ncbiargs.hpp:379
void xValidateThreadSingleOutput(const string &filename, CAsyncMessageHandler &msgHandler)
Definition: asnval.cpp:184
CThreadExitData xValidateSeparateOutputs(const string &filename)
Definition: asnval.cpp:168
int Run() override
Run the application.
Definition: asnval.cpp:469
void Setup(const CArgs &args)
Definition: asnval.cpp:579
size_t ValidateOneDirectory(string dir_name, bool recurse, CAsyncMessageHandler *pMessageHandler=nullptr)
Definition: asnval.cpp:370
string m_OutputDir
Definition: asnval.cpp:133
CThreadExitData xCombinedStatsTask()
Definition: asnval.cpp:443
void xValidateThreadSeparateOutputs(const string &filename)
Definition: asnval.cpp:174
unique_ptr< edit::CRemoteUpdater > mRemoteUpdater
Definition: asnval.cpp:130
void Init() override
Initialize the application.
Definition: asnval.cpp:240
CAsnvalApp()
Definition: asnval.cpp:211
void x_AliasLogFile()
Definition: asnval.cpp:223
~CAsnvalApp()
Definition: asnval.cpp:218
CThreadExitData xValidate(const string &filename, CNcbiOstream &ostr)
Definition: asnval.cpp:162
string m_InputDir
Definition: asnval.cpp:132
unique_ptr< CAppConfig > mAppConfig
Definition: asnval.cpp:129
CThreadExitData ValidateOneFile(const string &infilename, CNcbiOstream &ostr)
void SetInvokeWrite(bool invokeWrite) override
size_t GetNumReported() const override
void RequestStop() override
static void SetupObjectManager(const CArgs &args, objects::CObjectManager &obj_mgr, TLoaders loaders=fDefault)
Set up the standard object manager data loaders according to the arguments provided above.
static void AddArgumentDescriptions(CArgDescriptions &arg_desc, TLoaders loaders=fDefault)
Add a standard set of arguments used to configure the object manager.
CDir –.
Definition: ncbifile.hpp:1695
CSemaphore –.
Definition: ncbimtx.hpp:1375
CTime –.
Definition: ncbitime.hpp:296
static void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup core splign argument descriptions for the application.
CVersionInfo –.
CSemaphore m_tasks_semaphore
Definition: asnval.cpp:97
void release(token_type &&token)
Definition: asnval.cpp:83
void request_stop()
Definition: asnval.cpp:92
TThreadPoolLimited(unsigned num_slots, unsigned queue_depth=0)
Definition: asnval.cpp:72
std::future< CThreadExitData > token_type
Definition: asnval.cpp:71
Include a standard set of the NCBI C++ Toolkit most basic headers.
static time_t start_time
Definition: timeout.c:14
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:56
static void Init(void)
Definition: cursor6.c:76
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
Definition: ncbiapp.cpp:819
@ fHidden
Hide it in Usage.
Definition: ncbiargs.hpp:662
@ eRequires
One argument requires another.
Definition: ncbiargs.hpp:956
@ eExcludes
One argument excludes another.
Definition: ncbiargs.hpp:957
@ eInputFile
Name of file (must exist and be readable)
Definition: ncbiargs.hpp:595
@ eString
An arbitrary string.
Definition: ncbiargs.hpp:589
@ eOutputFile
Name of file (must be writable)
Definition: ncbiargs.hpp:596
@ eInteger
Convertible into an integer number (int or Int8)
Definition: ncbiargs.hpp:592
#define NULL
Definition: ncbistd.hpp:225
bool SetLogFile(const string &file_name, EDiagFileType file_type=eDiagFile_All, bool quick_flush=true)
Set log files.
Definition: ncbidiag.cpp:7528
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
Definition: ncbidiag.hpp:186
EDiagSev
Severity level for the posted diagnostics.
Definition: ncbidiag.hpp:650
#define LOG_POST_XX(error_name, err_subcode, message)
Definition: ncbidiag.hpp:569
@ eDiagSevMin
Verbosity level for min. severity.
Definition: ncbidiag.hpp:660
@ eDiagSevMax
Verbosity level for max. severity.
Definition: ncbidiag.hpp:661
void Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
TEntries GetEntries(const string &mask=kEmptyStr, TGetEntriesFlags flags=0) const
Get directory entries based on the specified "mask".
Definition: ncbifile.cpp:3846
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
virtual bool Exists(void) const
Check if directory "dirname" exists.
Definition: ncbifile.hpp:4065
bool Create(TCreateFlags flags=fCreate_Default) const
Create the directory using "dirname" passed in the constructor.
Definition: ncbifile.cpp:4071
list< TEntry > TEntries
Definition: ncbifile.hpp:1750
@ eDir
Directory.
Definition: ncbifile.hpp:784
@ eFile
Regular file.
Definition: ncbifile.hpp:783
@ eUnknown
Definition: app_popup.hpp:72
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
#define NcbiCerr
Definition: ncbistre.hpp:544
#define kEmptyStr
Definition: ncbistr.hpp:123
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
Definition: ncbistr.cpp:3461
#define NPOS
Definition: ncbistr.hpp:133
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
Definition: ncbistr.cpp:2891
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
Definition: ncbistr.cpp:3314
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
Definition: ncbistr.hpp:5384
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
Definition: ncbistr.cpp:3405
@ eReverseSearch
Search in a backward direction.
Definition: ncbistr.hpp:1947
@ eNocase
Case insensitive compare.
Definition: ncbistr.hpp:1206
void Run(void)
Enter the main loop.
@ eCurrent
Use current time. See also CCurrentTime.
Definition: ncbitime.hpp:300
static char * subname
Definition: mdb_load.c:26
Definition: fix_pub.hpp:45
const struct ncbi::grid::netcache::search::fields::EXPIRES expires
Magic spell ;-) needed for some weird compilers... very empiric.
#define NCBI_SC_VERSION_PROXY
#define NCBI_TEAMCITY_BUILD_NUMBER_PROXY
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
#define GetArgs
Avoid preprocessor name clash with the NCBI C Toolkit.
Definition: ncbiapp_api.hpp:54
Defines command line argument related classes.
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
The Object manager core.
static const char * suffix[]
Definition: pcregrep.c:408
#define _ASSERT
else result
Definition: token2.c:20
Modified on Wed May 22 11:34:19 2024 by modify_doxy.py rev. 669887