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/asnval_8cpp_source.html below:

NCBI C++ ToolKit: src/app/asnval/asnval.cpp Source File

62 #if __has_include(<multicall/multicall.hpp>) 63  #include <multicall/multicall.hpp> 65  #define asnvalidate_app_main main 68 using namespace ncbi

;

80  void Init

()

override

;

84  void

Setup(

const CArgs

& args);

85  void

x_AliasLogFile();

90  CThreadExitData

xValidateThreadSeparateOutputs(

const string

& filename);

96  size_t

ValidateOneDirectory(

string

dir_name,

106

atomic<size_t> m_NumFiles{0};

117  if

(in_filename.empty()) {

122

path = in_filename.substr(0, pos);

126

path.append(

".val"

);

128  if

(! outputDir.empty()) {

134  return

unique_ptr<CNcbiOstream>(

new

ofstream(path));

145  auto

pOstr =

s_MakeOstream

(filename, m_InputDir, m_OutputDir);

146  return

xValidate(filename, *pOstr);

151  return

xValidateSeparateOutputs(filename);

164  static const string

str_sev[] = {

165  "NOTE"

,

"WARNING"

,

"ERROR"

,

"REJECT"

,

"FATAL"

,

"MAX" 170  if

(sev == 0 && is_xml) {

195  if

(args[

"logfile"

]) {

196  if

(

NStr::Equal

(args[

"L"

].AsString(), args[

"logfile"

].AsString())) {

214

arg_desc->AddOptionalKey

215

(

"indir"

,

"Directory"

,

"Path to ASN.1 Files. '-x' specifies the input-file suffix"

,

218

arg_desc->AddOptionalKey

219

(

"i"

,

"InFile"

,

"Single Input File"

,

224

arg_desc->AddOptionalKey(

225  "outdir"

,

"Directory"

,

"Output directory"

,

230

arg_desc->AddOptionalKey(

231  "o"

,

"OutFile"

,

"Single Output File"

,

233

arg_desc->AddOptionalKey(

234  "f"

,

"Filter"

,

"Substring Filter"

,

236

arg_desc->AddDefaultKey

238

arg_desc->AddFlag(

"u"

,

"Recurse"

);

239

arg_desc->AddDefaultKey(

240  "R"

,

"SevCount"

,

"Severity for Error in Return Code\n\ 248

arg_desc->AddDefaultKey(

249  "Q"

,

"SevLevel"

,

"Lowest Severity for Error to Show\n\ 257

arg_desc->AddDefaultKey(

258  "P"

,

"SevLevel"

,

"Highest Severity for Error to Show\n\ 267

arg_desc->SetConstraint(

"Q"

, constraint);

268

arg_desc->SetConstraint(

"P"

, constraint);

269

arg_desc->SetConstraint(

"R"

, constraint);

270

arg_desc->AddOptionalKey(

271  "E"

,

"String"

,

"Only Error Code to Show"

,

274

arg_desc->AddDefaultKey(

"a"

,

"a"

,

287

arg_desc->AddFlag(

"b"

,

"Input is in binary format; obsolete"

,

289

arg_desc->AddFlag(

"c"

,

"Batch File is Compressed; obsolete"

,

292

arg_desc->AddFlag(

"quiet"

,

"Do not log progress"

);

295

arg_desc->AddFlag(

"annot"

,

"Verify Seq-annots only"

);

297

arg_desc->AddOptionalKey(

298  "L"

,

"OutFile"

,

"Log File"

,

301

arg_desc->AddDefaultKey(

"v"

,

"Verbosity"

,

303  "\t1 Standard Report\n" 304  "\t2 Accession / Severity / Code(space delimited)\n" 305  "\t3 Accession / Severity / Code(tab delimited)\n" 309

arg_desc->SetConstraint(

"v"

, v_constraint);

311

arg_desc->AddFlag(

"cleanup"

,

"Perform BasicCleanup before validating (to match C Toolkit); obsolete"

,

313

arg_desc->AddFlag(

"batch"

,

"Process NCBI release file (Seq-submit or Bioseq-set only)"

);

314

arg_desc->AddFlag(

"huge"

,

"Execute in huge-file mode"

);

315

arg_desc->AddFlag(

"disable-huge"

,

"Explicitly disable huge-files mode"

);

316

arg_desc->SetDependency(

"disable-huge"

,

320

arg_desc->AddOptionalKey(

321  "D"

,

"String"

,

"Path to lat_lon country data files"

,

330

arg_desc->SetUsageContext(

""

,

"ASN Validator"

);

333

SetupArgDescriptions(arg_desc.release());

341  size_t

num_to_process = 0;

347  string

suffix =

".ent"

;

349

suffix = args[

"x"

].AsString();

351  string mask

=

"*"

+ suffix;

355  bool

separate_outputs = !args[

"o"

];

358  if

(!m_OutputDir.empty()) {

359  string

outputDirName =

NStr::Replace

(dir_name, m_InputDir, m_OutputDir, 0, 1);

360  CDir

outputDir(outputDirName);

361  if

(! outputDir.

Exists

()) {

366  if

(separate_outputs) {

368  string

fname = ii->GetName();

370

(!args[

"f"

] ||

NStr::Find

(fname, args[

"f"

].AsString()) !=

NPOS

)) {

375

{

return

xValidateThreadSeparateOutputs(fpath); };

383  string

fname = ii->GetName();

385

(!args[

"f"

] ||

NStr::Find

(fname, args[

"f"

].AsString()) !=

NPOS

)) {

390

{

return

xValidateThreadSingleOutput(fpath, *pMsgHandler); };

401  string

subdir = ii->GetName();

404

num_to_process += ValidateOneDirectory(

subname

, recurse, pMsgHandler);

409  return

num_to_process;

418  auto

fut = m_queue.GetNext();

419  if

(!fut.has_value())

422  auto

exit_data = *fut;

426

combined_exit_data.

mReported

+= exit_data.mReported;

428

combined_exit_data.

mNumRecords

+= exit_data.mNumRecords;

429  if

(exit_data.mLongest > combined_exit_data.

mLongest

) {

430

combined_exit_data.

mLongest

= exit_data.mLongest;

431

combined_exit_data.

mLongestId

= exit_data.mLongestId;

434  return

combined_exit_data;

442  if

(args[

"indir"

]) {

443

m_InputDir = args[

"indir"

].AsString();

446  if

(args[

"outdir"

]) {

447

m_OutputDir = args[

"outdir"

].AsString();

450

mTaxUpdater.reset(

new

edit::CTaxonomyUpdater(

nullptr

));

452  CTime expires

= GetFullVersion().GetBuildInfo().GetBuildTime();

458  NcbiCerr

<<

"This copy of "

<< GetProgramDisplayName()

459

<<

" is more than 1 year old. Please download the current version if it is newer."

<< endl;

465

std::ostream* ValidErrorStream =

nullptr

;

467

ValidErrorStream = &args[

"o"

].AsOutputFile();

471  string

lat_lon_path = args[

"D"

].AsString();

472  if

(! lat_lon_path.empty()) {

473

SetEnvironment(

"NCBI_LAT_LON_DATA_PATH"

, lat_lon_path );

478

cerr <<

"Warning: -b is deprecated; do not use"

<< endl;

481  if

(args[

"cleanup"

]) {

482

cerr <<

"Warning: -cleanup is deprecated; do not use"

<< endl;

486  bool

exception_caught =

false

;

488  if

(!m_InputDir.empty()) {

490  if

(ValidErrorStream) {

494  auto

writer_task = std::async([

this

, &msgHandler] { msgHandler.

Write

(); });

496  auto

combination_task = std::async([

this

, &exit_data]()

499  auto

fut = m_queue.GetNext();

500  if

(fut.has_value()) {

501

auto exitData = *fut;

502

exit_data.mReported += exitData.mReported;

503

exit_data.mNumRecords += exitData.mNumRecords;

504

if (exitData.mLongest > exit_data.mLongest) {

505

exit_data.mLongest = exitData.mLongest;

506

exit_data.mLongestId = exitData.mLongestId;

515

ValidateOneDirectory(m_InputDir, args[

"u"

], &msgHandler);

516

m_queue.request_stop();

518

combination_task.wait();

519

msgHandler.RequestStop();

521

exit_data.

mReported

+= msgHandler.GetNumReported();

524  auto

writer_task = std::async([

this

, ValidErrorStream] {

return

xCombinedStatsTask(); });

526

ValidateOneDirectory(m_InputDir, args[

"u"

]);

527

m_queue.request_stop();

529

exit_data = writer_task.get();

533  string

in_filename = (args[

"i"

]) ? args[

"i"

].AsString() :

""

;

535  if

(ValidErrorStream) {

536

exit_data = xValidate(in_filename, *ValidErrorStream);

539

exit_data = xValidate(in_filename, *pOstr);

545

exception_caught =

true

;

547  if

(m_NumFiles == 0) {

548  ERR_POST

(

"No matching files found"

);

551

time_t stop_time = time(

NULL

);

552  if

(! mAppConfig->mQuiet ) {

554  LOG_POST_XX

(Corelib_App, 1,

"Longest processing time "

<< exit_data.mLongest <<

" seconds on "

<< exit_data.mLongestId);

555  LOG_POST_XX

(Corelib_App, 1,

"Total number of records "

<< exit_data.mNumRecords);

558  return

(exit_data.mReported > 0 || exception_caught);

587

list<string> split_args;

588

vector<const char*> new_argv;

590  if

(argc==2 && argv && argv[1] && strchr(argv[1],

' '

))

594

argc = 1 + split_args.size();

595

new_argv.reserve(argc);

596

new_argv.push_back(argv[0]);

597  for

(

auto

& s : split_args) {

598

new_argv.push_back(s.c_str());

600

std::cerr << s.c_str() <<

" "

;

605

argv = new_argv.data();

string s_GetSeverityLabel(EDiagSev sev, bool is_xml)

#define asnvalidate_app_main

static unique_ptr< CNcbiOstream > s_MakeOstream(const string &in_filename, const string &inputDir=kEmptyStr, const string &outputDir=kEmptyStr)

ncbi::TMaskedQueryRegions mask

CThreadExitData xValidateSeparateOutputs(const string &filename)

int Run() override

Run the application.

void Setup(const CArgs &args)

unique_ptr< edit::CTaxonomyUpdater > mTaxUpdater

CThreadExitData xValidateThreadSingleOutput(const string &filename, CAsyncMessageHandler &msgHandler)

size_t ValidateOneDirectory(string dir_name, bool recurse, CAsyncMessageHandler *pMessageHandler=nullptr)

CThreadExitData xCombinedStatsTask()

CThreadExitData xValidateThreadSeparateOutputs(const string &filename)

CValidatorThreadPool m_thread_pool2

void Init() override

Initialize the application.

CThreadExitData xValidate(const string &filename, CNcbiOstream &ostr)

unique_ptr< CAppConfig > mAppConfig

CValidatorThreadPool m_thread_pool1

CThreadExitData ValidateOneFile(const string &infilename, CNcbiOstream &ostr)

void SetInvokeWrite(bool invokeWrite) 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.

static void SetupArgDescriptions(CArgDescriptions *arg_desc)

Setup core splign argument descriptions for the application.

Include a standard set of the NCBI C++ Toolkit most basic headers.

const CNcbiRegistry & GetConfig(void) const

Get the application's cached configuration parameters (read-only).

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.

@ fHidden

Hide it in Usage.

@ eRequires

One argument requires another.

@ eExcludes

One argument excludes another.

@ eInputFile

Name of file (must exist and be readable)

@ eString

An arbitrary string.

@ eOutputFile

Name of file (must be writable)

@ eInteger

Convertible into an integer number (int or Int8)

bool SetLogFile(const string &file_name, EDiagFileType file_type=eDiagFile_All, bool quick_flush=true)

Set log files.

#define ERR_POST(message)

Error posting with file, line number information but without error codes.

EDiagSev

Severity level for the posted diagnostics.

#define LOG_POST_XX(error_name, err_subcode, message)

@ eDiagSevMin

Verbosity level for min. severity.

@ eDiagSevMax

Verbosity level for max. severity.

void Error(CExceptionArgs_Base &args)

#define NCBI_THROW(exception_class, err_code, message)

Generic macro to throw an exception, given the exception class, error code and message string.

TEntries GetEntries(const string &mask=kEmptyStr, TGetEntriesFlags flags=0) const

Get directory entries based on the specified "mask".

static string MakePath(const string &dir=kEmptyStr, const string &base=kEmptyStr, const string &ext=kEmptyStr)

Assemble a path from basic components.

virtual bool Exists(void) const

Check if directory "dirname" exists.

bool Create(TCreateFlags flags=fCreate_Default) const

Create the directory using "dirname" passed in the constructor.

static CRef< CObjectManager > GetInstance(void)

Return the existing object manager or create one.

IO_PREFIX::ostream CNcbiOstream

Portable alias for ostream.

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.

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.

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.

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.

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.

@ fSplit_CanEscape

Allow \... escaping.

@ fSplit_MergeDelimiters

Merge adjacent delimiters.

@ eReverseSearch

Search in a backward direction.

@ eNocase

Case insensitive compare.

void Run(void)

Enter the main loop.

@ eCurrent

Use current time. See also CCurrentTime.

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.

Defines command line argument related classes.

NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.


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