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

NCBI C++ ToolKit: src/app/pubseq_gateway/client/psg_client_app.cpp Source File

32 #include <unordered_map> 69  template

<

class

TRequest>

72  template

<

class

TRequest>

75  template

<

class

TRequest>

78  template

<

class

TRequest>

94

s_GetCommand<CPSG_Request_Biodata> (

"biodata"

,

"Request biodata info and data by bio ID"

),

95

s_GetCommand<CPSG_Request_Blob> (

"blob"

,

"Request blob by blob ID"

),

96

s_GetCommand<CPSG_Request_Resolve> (

"resolve"

,

"Request biodata info by bio ID"

,

SCommand::fParallel

),

97

s_GetCommand<CPSG_Request_NamedAnnotInfo>(

"named_annot"

,

"Request named annotations info by bio ID(s)"

),

98

s_GetCommand<CPSG_Request_Chunk> (

"chunk"

,

"Request blob data chunk by chunk ID"

),

99

s_GetCommand<CPSG_Request_IpgResolve> (

"ipg_resolve"

,

"Request IPG info"

,

SCommand::fParallel

),

100

s_GetCommand<CPSG_Request_AccVerHistory> (

"acc_ver_history"

,

"Request accession version history"

),

101

s_GetCommand<SInteractive> (

"interactive"

,

"Interactive JSON-RPC mode"

,

SCommand::fParallel

),

102

s_GetCommand<SInteractiveSchema> (

"interactive_schema"

,

"Output JSON schema for JSON-RPC requests"

,

SCommand::fNoApi

),

103

s_GetCommand<SPerformance> (

"performance"

,

"Performance testing"

,

SCommand::fHidden

),

114

cmd_desc->SetUsageContext(

GetArguments

().GetProgramBasename(),

"PSG client"

);

118

arg_desc->SetUsageContext(

""

,

command

.desc);

135  const auto

& args =

GetArgs

();

136  auto

name = args.GetCommand();

146  return command

.run(

this

, args);

158  for

(

auto i

= data_flags.begin();

i

!= data_flags.end(); ++

i

) {

161  for

(

auto

j =

i

+ 1; j != data_flags.end(); ++j) {

169  auto names

= {

"First"

,

"Last"

,

"All"

};

172  for

(

string

name :

names

) {

175  for

(

string

excluded :

names

) {

176  if

(name != excluded) {

182

arg_desc.

AddAlias

(

"latency"

,

"last-latency"

);

197

arg_desc.

AddFlag

(

"include-hup"

,

"Include HUP data"

);

198

arg_desc.

AddFlag

(

"https"

,

"Enable HTTPS"

);

200

arg_desc.

AddFlag

(

"verbose"

,

"Verbose output"

);

205  const auto

name = blob_only ?

"blob-only"

:

"annot-only"

;

206  const auto

comment = blob_only ?

"Output blob data only"

:

"Output annot info only"

;

207

arg_desc.

AddFlag

(name, comment);

213 template

<

class

TRequest>

220

arg_desc.

AddFlag

(

"no-bio-id-resolution"

,

"Do not try to resolve provided bio ID(s) before use"

);

231

arg_desc.

AddAlias

(

"id-file"

,

"input-file"

);

232

arg_desc.

AddFlag

(

"server-mode"

,

"Output one response per line"

);

236

arg_desc.

AddFlag

(

"no-bio-id-resolution"

,

"Do not try to resolve provided bio ID(s) before use"

);

255 void

CPsgClientApp::s_InitRequest<CPSG_Request_NamedAnnotInfo>(

CArgDescriptions

& arg_desc)

261

arg_desc.

AddFlag

(

"no-bio-id-resolution"

,

"Do not try to resolve provided bio ID(s) before use"

);

286

arg_desc.

AddFlag

(

"server-mode"

,

"Output one response per line"

);

292 void

CPsgClientApp::s_InitRequest<CPSG_Request_AccVerHistory>(

CArgDescriptions

& arg_desc)

304

arg_desc.

AddFlag

(

"server-mode"

,

"Output one JSON-RPC response per line and always output reply statuses"

);

305

arg_desc.

AddFlag

(

"echo"

,

"Echo all incoming requests"

);

324

arg_desc.

AddFlag

(

"local-queue"

,

"Whether user threads to use separate queues"

);

325

arg_desc.

AddFlag

(

"report-immediately"

,

"Whether to report metrics immediately (or at the end)"

);

334

arg_desc.

AddFlag

(

"single-doc"

,

"Treat input as a single JSON document (instead of one per line)"

);

341  if

(args[

"io-threads"

].

HasValue

()) {

342  auto

io_threads = args[

"io-threads"

].AsInteger();

346  if

(args[

"requests-per-io"

].

HasValue

()) {

347  auto

requests_per_io = args[

"requests-per-io"

].AsInteger();

349

}

else if

(parallel) {

353  if

(args[

"max-streams"

].

HasValue

()) {

354  auto

max_streams = args[

"max-streams"

].AsInteger();

358  if

(args[

"use-cache"

].

HasValue

()) {

359  auto

use_cache = args[

"use-cache"

].AsString();

363  if

(args[

"timeout"

].

HasValue

()) {

364  auto

timeout = args[

"timeout"

].AsInteger();

365

TPSG_RequestTimeout::SetDefault(timeout);

369

TPSG_Https::SetDefault(

true

);

372  if

(args[

"debug-printout"

].

HasValue

()) {

373  auto

debug_printout = args[

"debug-printout"

].AsString();

377  if

(args[

"test-identity"

].

HasValue

()) {

378  const auto

&

test_identity

= args[

"test-identity"

].AsString();

386 template

<

class

TParams>

389  template

<

class

... TInitArgs>

392

args[

"service"

].

HasValue

() ? args[

"service"

].AsString() :

string

(),

395

std::forward<TInitArgs>(init_args)...

412

args[

"debug-printout"

].

HasValue

(),

430  return

(args.

Exist

(

"blob-only"

) && args[

"blob-only"

].HasValue()) ||

431

(args.

Exist

(

"annot-only"

) && args[

"annot-only"

].HasValue());

436  if

(args.

Exist

(

"output-fmt"

) && args[

"output-fmt"

].HasValue()) {

437  const auto

&

format

= args[

"output-fmt"

].AsString();

450 template

<

class

TParams>

453  template

<

class

... TInitArgs>

457

args[

"rate"

].AsDouble(),

458  max

(1,

min

(10, args[

"worker-threads"

].AsInteger())),

459

args[

"input-file"

].AsString() ==

"-"

,

460

args[

"server-mode"

].AsBoolean(),

461

std::forward<TInitArgs>(init_args)...

487  static_cast<size_t>

(args[

"preview-size"

].AsInt8()),

489

args[

"one-server"

].HasValue(),

490

args[

"testing"

].HasValue()

506  static_cast<size_t>

(args[

"user-threads"

].AsInteger()),

507

args[

"delay"

].AsDouble(),

508

args[

"local-queue"

].AsBoolean(),

509

args[

"report-immediately"

].AsBoolean(),

535  void

ForEachTSE(

TExclude

exclude)

const

;

539  auto GetSNPScaleLimit

()

const

{

return input

[

"snp-scale-limit"

].HasValue() ? objects::CSeq_id::GetSNPScaleLimit_Value(

input

[

"snp-scale-limit"

].AsString()) : CPSG_Request_NamedAnnotInfo::ESNPScaleLimit::eSNPScaleLimit_Default; }

540  void

SetRequestFlags(shared_ptr<CPSG_Request> request)

const

;

546  return

[&](

const string

& name) {

547  return input

[name].HasValue();

553  const size_t n

=

input

.GetNExtra();

557  for

(

size_t i

= 1;

i

<=

n

; ++

i

) {

561

rv.emplace_back(

input

[

i

].AsString());

570  const auto

&

id

=

input

[

"ID"

].AsString();

571  const auto

& last_modified =

input

[

"last-modified"

];

572  return

last_modified.HasValue() ?

CPSG_BlobId

(

id

, last_modified.AsInt8()) : id;

577  return

{

input

[

"ID2_CHUNK"

].AsInteger(),

input

[

"ID2_INFO"

].AsString() };

584  auto

blob_ids =

input

[

"exclude-blob"

].GetStringList();

586  for

(

const auto

& blob_id : blob_ids) {

598 template

<

class

TRequest>

601  auto

request = SRequestBuilder::Build<TRequest>(args);

606 int

CPsgClientApp::RunRequest<CPSG_Request_Resolve>(

const CArgs

& args)

608  const auto

single_request = args[

"ID"

].HasValue();

610  if

(single_request) {

611  auto

request = SRequestBuilder::Build<CPSG_Request_Resolve>(args);

619 int

CPsgClientApp::RunRequest<CPSG_Request_IpgResolve>(

const CArgs

& args)

621  const auto

single_request = args[

"protein"

].HasValue() || args[

"ipg"

].HasValue() || args[

"nucleotide"

].HasValue();

623  if

(single_request) {

624  auto

request = SRequestBuilder::Build<CPSG_Request_IpgResolve>(args);

632 int

CPsgClientApp::RunRequest<SInteractive>(

const CArgs

& args)

636  if

(params_builder.

testing

) {

637

GetRWConfig().SetValue(

"log"

,

"issued_subhit_limit"

, 0);

644 int

CPsgClientApp::RunRequest<SInteractiveSchema>(

const CArgs

& args)

646  SIoRedirector

ior(cout, args[

"output-file"

].AsOutputFile());

652 int

CPsgClientApp::RunRequest<SPerformance>(

const CArgs

& args)

659 int

CPsgClientApp::RunRequest<SJsonCheck>(

const CArgs

& args)

661  const auto

&

schema

= args[

"schema-file"

];

662  const auto

single_doc = args[

"single-doc"

].HasValue();

667 template

<

class

TRequest>

670  return

{ std::move(name), std::move(desc), s_InitRequest<TRequest>, s_RunRequest<TRequest>,

flags

};

673 int main

(

int

argc,

const char

* argv[])

static const NStr::TNumToStringFlags kFlags

CCommandArgDescriptions –.

bool Write(std::ostream &out, TJson_Write_Flags flags=fJson_Write_IndentWithSpace, unsigned int indent_char_count=4) const

Write JSON data into a stream.

Bio-id (such as accession)

static void SetTestIdentity(const string &identity)

CNullable< string > TNucleotide

Request to the PSG server (see "CPSG_Request_*" below)

static int OneRequest(const SOneRequestParams &params, shared_ptr< CPSG_Request > request)

static int ParallelProcessing(const TParams &params, istream &is=cin)

static CJson_Document RequestSchema()

static int Performance(const SPerformanceParams &params)

static int JsonCheck(istream *schema_is, bool single_doc)

int RunRequest(const CArgs &args)

static void s_InitRequest(CArgDescriptions &arg_desc)

virtual int Run()

Run the application.

static int s_RunRequest(CPsgClientApp *that, const CArgs &args)

virtual void Init()

Initialize the application.

vector< SCommand > m_Commands

static SCommand s_GetCommand(string name, string desc, int flags=SCommand::eDefault)

CTimeout – Timeout interval.

static const struct name_t names[]

static const char * schema

virtual const CArgs & GetArgs(void) const

Get parsed command line arguments.

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.

virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)

Setup the command line argument descriptions.

const CNcbiArguments & GetArguments(void) const

Get the application's cached unprocessed command-line arguments.

void AddFlag(const string &name, const string &comment, CBoolEnum< EFlagValue > set_value=eFlagHasValueIfSet, TFlags flags=0)

Add description for flag argument.

void AddExtra(unsigned n_mandatory, unsigned n_optional, const string &comment, EType type, TFlags flags=0)

Add description for the extra, unnamed positional arguments.

void SetConstraint(const string &name, const CArgAllow *constraint, EConstraintNegate negate=eConstraint)

Set additional user defined constraint on argument value.

void SetDependency(const string &arg1, EDependency dep, const string &arg2)

Define a dependency.

bool Exist(const string &name) const

Check existence of argument description.

void AddKey(const string &name, const string &synopsis, const string &comment, EType type, TFlags flags=0)

Add description for mandatory key.

void AddAlias(const string &alias, const string &arg_name)

Add argument alias.

void AddPositional(const string &name, const string &comment, EType type, TFlags flags=0)

Add description for mandatory positional argument.

void AddOptionalKey(const string &name, const string &synopsis, const string &comment, EType type, TFlags flags=0)

Add description for optional key without default value.

void AddOptionalPositional(const string &name, const string &comment, EType type, TFlags flags=0)

Add description for optional positional argument without default value.

void AddDefaultKey(const string &name, const string &synopsis, const string &comment, EType type, const string &default_value, TFlags flags=0, const string &env_var=kEmptyStr, const char *display_value=nullptr)

Add description for optional key with default value.

@ fAllowMultiple

Repeated key arguments are legal (use with AddKey)

@ fHidden

Hide it in Usage.

@ eHidden

Hide command in Usage.

@ eRequires

One argument requires another.

@ eExcludes

One argument excludes another.

@ eNoSortCommands

On PrintUsage, keep commands unsorted.

@ eCommandOptional

Command is not necessary.

@ eInt8

Convertible into an integer number (Int8 only)

@ eInputFile

Name of file (must exist and be readable)

@ eDouble

Convertible into a floating point number (double)

@ eDataSize

Integer number with possible "software" qualifiers (KB, KiB, et al)

@ eString

An arbitrary string.

@ eOutputFile

Name of file (must be writable)

@ eInteger

Convertible into an integer number (int or Int8)

static bool StrToSeverityLevel(const char *str_sev, EDiagSev &sev)

Get severity from string.

@ eDiag_Warning

Warning message.

#define NCBI_THROW(exception_class, err_code, message)

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

ESerialDataFormat

Data file format.

@ eSerial_AsnText

ASN.1 text.

@ eSerial_AsnBinary

ASN.1 binary.

static string & ToLower(string &str)

Convert string to lower case – string& version.

@ eDefault

Default timeout (to be interpreted by the client code)

unsigned int

A callback function used to compare two keys in a database.

The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format

const GenericPointer< typename T::ValueType > T2 value

Defines the CNcbiApplication and CAppException classes for creating NCBI applications.

double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)

@ Default

Substitute always (default)

vector< CPSG_BioId > CPSG_BioIds

EPSG_BioIdResolution

Whether to try to resolve provided seq-ids before use.

@ Resolve

Try to resolve provided seq-ids.

@ NoResolve

Use provided seq-ids as is.

void s_AddLatencyOptions(CArgDescriptions &arg_desc)

void s_InitPsgOptions(CArgDescriptions &arg_desc)

void s_InitDataOnly(CArgDescriptions &arg_desc, bool blob_only=true)

void s_InitDataFlags(CArgDescriptions &arg_desc)

void s_SetPsgDefaults(const CArgs &args, bool parallel)

int main(int argc, const char *argv[])

SBase(const CArgs &args, TInitArgs &&... init_args)

SBatchResolve(const CArgs &args)

SInteractive(const CArgs &args)

static size_t GetDataLimit(const CArgValue &value)

CLogLatencies::EWhich GetLatency(const CArgs &args)

static ESerialDataFormat GetDataOnlyOutputFormat(const CArgs &args)

SOneRequest(const CArgs &args)

static bool GetDataOnlyEnabled(const CArgs &args)

SParallelProcessing(const CArgs &args, TInitArgs &&... init_args)

SPerformance(const CArgs &args)

SCommand(string n, string d, TInit i, TRun r, int f)

function< void(CArgDescriptions &)> TInit

function< int(CPsgClientApp *, const CArgs &)> TRun

SIoRedirector(ios &what, ios &to)

static void SetImplicitDefault(const T &value)

static void SetDefault(const T &value)

Arbitrary request URL arguments.

SPSG_UserArgs GetUserArgs() const

CPSG_BioId GetBioId() const

auto GetAccSubstitution() const

auto GetBioIdType() const

vector< string > GetNamedAnnots() const

CTimeout GetResendTimeout() const

auto GetNucleotide() const

EPSG_BioIdResolution GetBioIdResolution() const

auto GetSNPScaleLimit() const

static CPSG_BioId::TType GetBioIdType(const string &type)

function< void(string)> TExclude

static EPSG_AccSubstitution GetAccSubstitution(const string &acc_substitution)

static SResolveParams GetResolveParams(const TInput &input)

static const initializer_list< SInfoFlag > & GetInfoFlags()

static const initializer_list< SDataFlag > & GetDataFlags()

function< bool(const string &)> TSpecified


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