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

Go to the SVN repository for this file.

1 /* $Id: gc_cli.cpp 98903 2023-01-23 13:17:12Z xiangcha $
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  * Authors: Vinay Kumar
27  *
28  * File Description:
29  * Client for accessing the genomic_collection service.
30  *
31  */
32 
33 #include <ncbi_pch.hpp>
34 #include <corelib/ncbiapp.hpp>
35 #include <corelib/ncbienv.hpp>
36 #include <corelib/ncbiargs.hpp>
37 
38 #include <serial/serial.hpp>
39 #include <serial/objostr.hpp>
40 
53 
57 
58 #include <sstream>
59 #include <numeric>
60 
61 using namespace ncbi;
62 using namespace ncbi::objects;
63 using namespace std;
64 
66 {
67 public:
68  CGencollService(const string& cgi_url, bool nocache)
69  : cgiUrl(cgi_url + (nocache ? "?nocache=true" :""))
70  {
71  }
72 
73  CGencollService(bool nocache)
74  {
75  if(nocache)
76  {
77  string service_name(GetService());
78  CNcbiApplication::Instance()->SetEnvironment().Set((NStr::ToUpper(service_name) + "_CONN_ARGS").c_str(), "nocache=true");
79  }
80  }
81 
83  {
84  }
85 
86 private:
87  virtual string x_GetURL() { return cgiUrl; }
88 
89  virtual void x_Connect()
90  {
91  CUrlArgs args(m_RetryCtx.GetArgs());
92  if(args.IsSetValue("cache_request_id"))
93  cout << "cache_request_id=" << args.GetValue("cache_request_id") << endl;
94 
95 #ifdef _DEBUG
96  LOG_POST(Info << "Connecting to url:" << x_GetURL().c_str());
97 #endif
98  if(x_GetURL().empty())
100  else
101  x_ConnectURL(x_GetURL());
102  }
103 
104  const string cgiUrl;
105 };
106 
108 {
109 public:
110  CDirectCGIExec(const string& cgi_path, bool nocache)
111  : cgiPath(cgi_path)
112  {
113  if(nocache)
114  {
115  cgiArgs.push_back("-nocache");
116  cgiArgs.push_back("true");
117  }
118  }
119 
120  virtual void Ask(const CGCClientRequest& request, CGCClientResponse& reply)
121  {
122  cout << "\nDirectly invoking CGI with following post request :\n" << MSerial_AsnText << request << endl;
123 
124  ostringstream errStr;
125  stringstream outStr(ios::in|ios::out|ios::binary);
126  stringstream inStr (ios::in|ios::out|ios::binary);
127  inStr << MSerial_AsnBinary << request;
128 
129  int exitCode = -1;
130  const char* env[] = {"REQUEST_METHOD=POST", 0};
131 
132  CPipe::EFinish retVal = CPipe::ExecWait(cgiPath, cgiArgs, inStr, outStr, errStr, exitCode, kEmptyStr, env);
133 
134  if(retVal != CPipe::eDone || exitCode != 0)
135  {
136  cout << "Process Killed or Aborted. CPipe::ExecWait return value " << retVal
137  << ". Process Exit code: " << exitCode << endl;
138  exit(exitCode);
139  }
140 
141  cout << "OutStream size = " << outStr.str().size() << endl;
142 
143  cout << "ErrStream >>>>>>>>>" << endl
144  << errStr.str() << endl
145  << "<<<<<<<<< ErrStream" << endl;
146 
147  SkipHeader(outStr);
148 
149  outStr >> MSerial_AsnBinary >> reply;
150  }
151 
152 private:
153  const string cgiPath;
154  vector<string> cgiArgs;
155 
156  void SkipHeader(istream& is)
157  {
158  char buffer[1000];
159  bool discarding = true; int linesDiscarded = 0;
160  while(discarding)
161  {
162  is.getline(buffer, sizeof(buffer)-1);
163  discarding = !( (strlen(buffer) == 0) || (strlen(buffer) == 1 && buffer[0] == 13));
164  if(discarding)
165  cout << "Discarding header line " << ++linesDiscarded << " : " << buffer << endl;
166  }
167  }
168 };
169 
170 
172 {
173 private:
174  virtual void Init(void);
175  virtual int Run(void);
176 
177  int RunWithService(CGenomicCollectionsService& service, const CArgs& args, CNcbiOstream& ostr);
178 };
179 
181 {
182  auto AddCommonArgs = [](CArgDescriptions* arg_desc)
183  {
184  arg_desc->AddOptionalKey("url", "url_to_service", "URL to genemic collections service.cgi", CArgDescriptions::eString);
185  arg_desc->AddOptionalKey("cgi", "path_to_cgi", "Directly calls the CGI instead of using the gencoll client", CArgDescriptions::eString);
186  arg_desc->SetDependency("cgi", arg_desc->eExcludes, "url");
187  arg_desc->AddOptionalKey("retries", "retry_count", "Max times to retry asking the CGI for a response.", CArgDescriptions::eInteger);
188  arg_desc->SetDependency("retries", arg_desc->eExcludes, "cgi");
189  arg_desc->AddDefaultKey("o", "OutputFile", "File for report", CArgDescriptions::eOutputFile, "-");
190  arg_desc->AddDefaultKey( "f", "format", "Output Format. - ASN1 or XML", CArgDescriptions::eString, "ASN1");
191  arg_desc->SetConstraint("f", &(*new CArgAllow_Strings,"XML","XML1","xml","xml1","ASN.1","ASN1","asn1","asn.1"));
192  arg_desc->AddFlag("nocache", "Do not use database cache; force fresh data");
193  };
194 
195  auto AddSeqAcc = [](CArgDescriptions* arg_desc)
196  {
197  arg_desc->AddKey("acc", "ACC_VER", "Comma or semi-colon separated list of sequences", CArgDescriptions::eString);
198  arg_desc->AddKey("acc_file", "acc_file", "File with list of sequences - comma or semi-colon separated ids on each line. empty line or line started with # are ignored", CArgDescriptions::eInputFile);
199  arg_desc->SetDependency("acc_file", arg_desc->eExcludes, "acc");
200  arg_desc->AddFlag("roles", "Add sequence role data to output");
201  };
202 
203  auto AddAccRelId = [&](CArgDescriptions* arg_desc)
204  {
205  arg_desc->AddKey("acc", "ACC_VER", "Comma-separated list of assembly accessions", CArgDescriptions::eString);
206  arg_desc->AddKey("acc_file", "acc_file", "File with list of assembly accessions - one per line", CArgDescriptions::eInputFile);
207  arg_desc->SetDependency("acc_file", arg_desc->eExcludes, "acc");
208  arg_desc->AddKey("rel_id", "release_id", "Comma-separated list of assembly release id's'", CArgDescriptions::eString);
209  arg_desc->SetDependency("rel_id", arg_desc->eExcludes, "acc");
210  arg_desc->SetDependency("rel_id", arg_desc->eExcludes, "acc_file");
211  arg_desc->AddKey("rel_file", "rel_file", "File with list of assembly release_ids - one per line", CArgDescriptions::eInputFile);
212  arg_desc->SetDependency("rel_file", arg_desc->eExcludes, "acc");
213  arg_desc->SetDependency("rel_file", arg_desc->eExcludes, "acc_file");
214  arg_desc->SetDependency("rel_file", arg_desc->eExcludes, "rel_id");
216  };
217 
218  auto AddFilterSort = [](CArgDescriptions* arg_desc)
219  {
220  arg_desc->AddOptionalKey("-filter", "filter",
221  "Get assembly by sequence - filters could be: latest, refseq, genbank, major; can be combined using comma separated list of filters",
223  arg_desc->AddOptionalKey("-sort", "sort", "Get assembly by sequence - sort", CArgDescriptions::eString);
224  };
225 
226  unique_ptr<CCommandArgDescriptions> cmds_desc(new CCommandArgDescriptions());
227  cmds_desc->SetUsageContext(GetArguments().GetProgramBasename(), "Genomic Collections Service client application");
228 
229  unique_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
230  arg_desc->SetUsageContext("", "Validate chromosome type and location");
231  arg_desc->AddKey("type", "chr_type", "chromosome type", CArgDescriptions::eString);
232  arg_desc->AddKey("loc", "chr_loc", "chromosome location", CArgDescriptions::eString);
233  AddCommonArgs(arg_desc.get());
234  cmds_desc->AddCommand("get-chrtype-valid", arg_desc.release(), "vc");
235 
236  arg_desc.reset(new CArgDescriptions);
237  arg_desc->SetUsageContext("", "Get assembly");
238  arg_desc->AddDefaultKey("-mode", "AllSequences", "Assembly retrieval mode", CArgDescriptions::eString, "AssemblyOnly");
239  AddAccRelId(arg_desc.get());
240  AddCommonArgs(arg_desc.get());
241  cmds_desc->AddCommand("get-assembly", arg_desc.release(), "ga");
242 
243  arg_desc.reset(new CArgDescriptions);
244  arg_desc->SetUsageContext("", "Get assemblies containing sequence");
245  arg_desc->AddFlag("top_asm", "Return top assembly only");
246  AddSeqAcc(arg_desc.get());
247  AddFilterSort(arg_desc.get());
248  AddCommonArgs(arg_desc.get());
249  cmds_desc->AddCommand("get-assembly-by-sequence", arg_desc.release(), "gas");
250 
251  arg_desc.reset(new CArgDescriptions);
252  arg_desc->SetUsageContext("", "Get assemblies equivalent to a given one");
253  arg_desc->AddKey("acc", "ACC_VER", "Assembly accession", CArgDescriptions::eString);
254  arg_desc->AddKey("equiv", "equivalency", "Get equivalent assemblies - equivalency type", CArgDescriptions::eInteger);
255  AddCommonArgs(arg_desc.get());
256  cmds_desc->AddCommand("get-equivalent-assemblies", arg_desc.release(), "gea");
257 
258  SetupArgDescriptions(cmds_desc.release());
259 }
260 
261 /////////////////////////////////////////////////////////////////////////////
263 {
264  const CArgs& args = GetArgs();
265  CNcbiOstream& ostr = args["o"].AsOutputFile();
266 
267  if(args["f"] && NStr::FindNoCase(args["f"].AsString(),"XML") != NPOS)
268  ostr << MSerial_Xml;
269  else
270  ostr << MSerial_AsnText;
271 
273 
274  if(args["cgi"]) service.Reset(new CDirectCGIExec(args["cgi"].AsString(), args["nocache"]));
275  else if(args["url"]) service.Reset(new CGencollService(args["url"].AsString(), args["nocache"]));
276  else if(args.Exist("gc-cache") && args["gc-cache"])
277  service.Reset(new CGencollService(args));
278  else service.Reset(new CGencollService(args["nocache"]));
279 
280  if (args["retries"]) service->SetTryLimit(args["retries"].AsInteger());
281 
282  return RunWithService(*service, args, ostr);
283 }
284 
285 static
287 {
288  return assembly->IsAssembly_set() && assembly->GetAssembly_set().IsSetDesc() ? &assembly->SetAssembly_set().SetDesc() :
289  assembly->IsUnit() && assembly->GetUnit().IsSetDesc() ? &assembly->SetUnit().SetDesc() :
290  NULL;
291 
292 }
293 
294 static
296 {
297  return desc->IsUser() &&
298  desc->GetUser().IsSetType() &&
299  desc->GetUser().GetType().IsStr() &&
300  desc->GetUser().GetType().GetStr() == "versions";
301 }
302 
303 static
305 {
306  CGC_AssemblyDesc* desc = GetAssebmlyDesc(assembly);
307  if (desc && desc->CanGetDescr())
308  {
309  list< CRef<CSeqdesc> >& l = desc->SetDescr().Set();
310  l.erase(remove_if(l.begin(), l.end(),
312  l.end());
313  }
314 
315  return assembly;
316 }
317 
318 static list<string> GetIDs(const string& ids)
319 {
320  list<string> id_list;
321  NStr::Split(ids, ";, ", id_list, NStr::fSplit_Tokenize);
322  id_list.sort();
323  id_list.unique();// return no duplicates
324  return id_list;
325 }
326 
327 static list<string> GetIDsFromFile(CNcbiIstream& istr)
328 {
329  list<string> accessions;
330  string line;
331  while (NcbiGetlineEOL(istr, line)) {
333  // empty line or started with # will be skipped.
334  if (line.empty() || line[0] == '#') {
335  continue;
336  }
337  // each line could be comma or semi-colon seperated ids.
338  list<string> tlst=GetIDs(line);
339  // append the list ids to the end
340  accessions.splice(accessions.end(),tlst);
341  }
342  // remove duplicates
343  accessions.sort();
344  accessions.unique();
345  return accessions;
346 }
347 
348 static list<string> GetAccessions(const CArgs& args)
349 {
350  return args["acc"].HasValue() ? GetIDs(args["acc"].AsString()) :
351  args["acc_file"].HasValue() ? GetIDsFromFile(args["acc_file"].AsInputFile()) :
352  list<string>();
353 }
354 static list<string> GetReleaseIds(const CArgs& args)
355 {
356  return args["rel_id"].HasValue() ? GetIDs(args["rel_id"].AsString()) :
357  args["rel_file"].HasValue() ? GetIDsFromFile(args["rel_file"].AsInputFile()) :
358  list<string>();
359 }
360 
362 {
363  try {
364  if(args.GetCommand() == "get-chrtype-valid")
365  {
366  ostr << service.ValidateChrType(args["type"].AsString(), args["loc"].AsString());
367  }
368  else if(args.GetCommand() == "get-assembly")
369  {
370  if (args["acc"] || args["acc_file"])
371  for (auto acc: GetAccessions(args)) ostr << *RemoveVersions(service.GetAssembly(acc, args["-mode"].AsString()));
372  else if (args["rel_id"] || args["rel_file"])
373  for (auto rel_id: GetReleaseIds(args)) ostr << *RemoveVersions(service.GetAssembly(NStr::StringToInt(rel_id), args["-mode"].AsString()));
374  else
375  ERR_POST(Error << "Either accession or release id should be provided");
376  }
377  else if(args.GetCommand() == "get-assembly-by-sequence")
378  {
379  list<string> filter_s;
380  NStr::Split(args["filter"] ? args["filter"].AsString() : "all", ",", filter_s, NStr::fSplit_Tokenize);
381 
382  const int filter = accumulate(filter_s.begin(), filter_s.end(), 0, [](int acc, const string& f)
383  {
384  return acc | ENUM_METHOD_NAME(EGCClient_GetAssemblyBySequenceFilter)()->FindValue(f);
385  });
386  const int sort = args["sort"] ? CGCClient_GetAssemblyBySequenceRequest::ENUM_METHOD_NAME(ESort)()->FindValue(args["sort"].AsString()) : CGCClient_GetAssemblyBySequenceRequest::eSort_default;
387  const bool with_roles = args["roles"];
388  list seqlist=GetAccessions(args);
389  if(!seqlist.empty()){
390  if (args["top_asm"].HasValue())
391  ostr << *service.FindOneAssemblyBySequences(seqlist, filter, CGCClient_GetAssemblyBySequenceRequest::ESort(sort), with_roles);
392  else
393  ostr << *service.FindAssembliesBySequences( seqlist, filter, CGCClient_GetAssemblyBySequenceRequest::ESort(sort), with_roles);
394  }
395  }
396  else if(args.GetCommand() == "get-equivalent-assemblies")
397  {
398  ostr << *service.GetEquivalentAssemblies(args["acc"].AsString(), args["equiv"].AsInteger());
399  }
400  } catch (CException& ex) {
401  ERR_POST(Error << "Caught an exception from client library ..." << ex.what());
402  return 1;
403  }
404 
405  return 0;
406 }
407 
408 int main(int argc, const char* argv[])
409 {
412 }
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
void remove_if(Container &c, Predicate *__pred)
Definition: chainer.hpp:69
CArgAllow_Strings –.
Definition: ncbiargs.hpp:1641
CArgDescriptions –.
Definition: ncbiargs.hpp:541
CArgs –.
Definition: ncbiargs.hpp:379
int RunWithService(CGenomicCollectionsService &service, const CArgs &args, CNcbiOstream &ostr)
Definition: gc_cli.cpp:361
virtual int Run(void)
Run the application.
Definition: gc_cli.cpp:262
virtual void Init(void)
Initialize the application.
Definition: gc_cli.cpp:180
CCommandArgDescriptions –.
Definition: ncbiargs.hpp:1381
virtual void Ask(const CGCClientRequest &request, CGCClientResponse &reply)
Definition: gc_cli.cpp:120
void SkipHeader(istream &is)
Definition: gc_cli.cpp:156
vector< string > cgiArgs
Definition: gc_cli.cpp:154
const string cgiPath
Definition: gc_cli.cpp:153
CDirectCGIExec(const string &cgi_path, bool nocache)
Definition: gc_cli.cpp:110
CGCClientRequest –.
CGCClientResponse –.
CGC_AssemblyDesc –.
const string cgiUrl
Definition: gc_cli.cpp:104
CGencollService(const CArgs &args)
Definition: gc_cli.cpp:82
CGencollService(const string &cgi_url, bool nocache)
Definition: gc_cli.cpp:68
virtual string x_GetURL()
Definition: gc_cli.cpp:87
CGencollService(bool nocache)
Definition: gc_cli.cpp:73
virtual void x_Connect()
These run with m_Mutex already acquired.
Definition: gc_cli.cpp:89
CRef< CGCClient_EquivalentAssemblies > GetEquivalentAssemblies(const string &acc, int equivalency)
static void AddArguments(CArgDescriptions &arg_desc)
CRef< CGCClient_AssembliesForSequences > FindAssembliesBySequences(const string &sequence_acc, int filter, CGCClient_GetAssemblyBySequenceRequest::ESort sort=CGCClient_GetAssemblyBySequenceRequest::eSort_default, bool with_roles=false)
Find assemblies by sequence accession.
CRef< CGC_Assembly > GetAssembly(const string &acc, const string &mode)
CRef< CGCClient_AssemblyInfo > FindOneAssemblyBySequences(const string &sequence_acc, int filter, CGCClient_GetAssemblyBySequenceRequest::ESort sort=CGCClient_GetAssemblyBySequenceRequest::eSort_default)
Find assembly by sequence accession.
string ValidateChrType(const string &chrType, const string &chrLoc)
static CNcbiApplication * Instance(void)
Singleton method.
Definition: ncbiapp.cpp:264
CRef –.
Definition: ncbiobj.hpp:618
CUrlArgs::
Definition: ncbi_url.hpp:240
std::ofstream out("events_result.xml")
main entry point for tests
static void Init(void)
Definition: cursor6.c:76
static HENV env
Definition: transaction2.c:38
static CGC_AssemblyDesc * GetAssebmlyDesc(CRef< CGC_Assembly > &assembly)
Definition: gc_cli.cpp:286
static list< string > GetAccessions(const CArgs &args)
Definition: gc_cli.cpp:348
static list< string > GetReleaseIds(const CArgs &args)
Definition: gc_cli.cpp:354
static list< string > GetIDs(const string &ids)
Definition: gc_cli.cpp:318
static list< string > GetIDsFromFile(CNcbiIstream &istr)
Definition: gc_cli.cpp:327
int main(int argc, const char *argv[])
Definition: gc_cli.cpp:408
static CRef< CGC_Assembly > RemoveVersions(CRef< CGC_Assembly > assembly)
Definition: gc_cli.cpp:304
static bool isVersionsObject(CRef< CSeqdesc > desc)
Definition: gc_cli.cpp:295
User-defined methods of the data storage class.
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
#define CNcbiApplication
bool Exist(const string &name) const
Check existence of argument description.
Definition: ncbiargs.cpp:1813
string GetCommand(void) const
Get current command.
Definition: ncbiargs.hpp:465
@ 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
CDiagContext & GetDiagContext(void)
Get diag context instance.
Definition: logging.cpp:818
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
Definition: ncbidiag.hpp:186
static void SetOldPostFormat(bool value)
Set old/new format flag.
Definition: ncbidiag.cpp:3352
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
void Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
Definition: ncbiexpt.cpp:342
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
#define MSerial_AsnBinary
Definition: serialbase.hpp:697
#define MSerial_Xml
Definition: serialbase.hpp:698
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
#define MSerial_AsnText
I/O stream manipulators –.
Definition: serialbase.hpp:696
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
EFinish
ExecWait return code.
Definition: ncbi_pipe.hpp:437
static EFinish ExecWait(const string &cmd, const vector< string > &args, CNcbiIstream &in, CNcbiOstream &out, CNcbiOstream &err, int &exit_code, const string &current_dir=kEmptyStr, const char *const envp[]=0, IProcessWatcher *watcher=0, const STimeout *kill_timeout=0, size_t pipe_size=0)
Execute a command with a vector of arguments, and wait for its completion.
Definition: ncbi_pipe.cpp:2139
@ eDone
Process finished normally.
Definition: ncbi_pipe.hpp:438
CNcbiIstream & NcbiGetlineEOL(CNcbiIstream &is, string &str, string::size_type *count=NULL)
Read from "is" to "str" the next line (taking into account platform specifics of End-of-Line)
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
Definition: ncbistre.hpp:146
#define kEmptyStr
Definition: ncbistr.hpp:123
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
Definition: ncbistr.cpp:630
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
static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
Definition: ncbistr.cpp:2993
#define NPOS
Definition: ncbistr.hpp:133
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
Definition: ncbistr.cpp:3201
static string & ToUpper(string &str)
Convert string to upper case – string& version.
Definition: ncbistr.cpp:424
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
Definition: ncbistr.hpp:2508
void Run(void)
Enter the main loop.
bool IsSetValue(const string &name) const
Check if an argument with the given name exists.
Definition: ncbi_url.hpp:281
const string & GetValue(const string &name, bool *is_found=0) const
Get value for the given name.
Definition: ncbi_url.cpp:256
bool IsStr(void) const
Check if variant Str is selected.
Definition: Object_id_.hpp:291
bool IsSetType(void) const
type of object within class Check if a value has been assigned to Type data member.
const TStr & GetStr(void) const
Get the variant data.
Definition: Object_id_.hpp:297
const TType & GetType(void) const
Get the Type member data.
const TUnit & GetUnit(void) const
Get the variant data.
void SetDesc(TDesc &value)
Assign a value to Desc data member.
bool IsSetDesc(void) const
descriptors live in a shared data block Check if a value has been assigned to Desc data member.
bool IsAssembly_set(void) const
Check if variant Assembly_set is selected.
bool CanGetDescr(void) const
Check if it is safe to call GetDescr method.
void SetDesc(TDesc &value)
Assign a value to Desc data member.
const TAssembly_set & GetAssembly_set(void) const
Get the variant data.
bool IsSetDesc(void) const
descriptors live in a shared data block Check if a value has been assigned to Desc data member.
TUnit & SetUnit(void)
Select the variant.
bool IsUnit(void) const
Check if variant Unit is selected.
TAssembly_set & SetAssembly_set(void)
Select the variant.
void SetDescr(TDescr &value)
Assign a value to Descr data member.
const TUser & GetUser(void) const
Get the variant data.
Definition: Seqdesc_.cpp:384
bool IsUser(void) const
Check if variant User is selected.
Definition: Seqdesc_.hpp:1122
exit(2)
constexpr auto sort(_Init &&init)
constexpr bool empty(list< Ts... >) noexcept
Magic spell ;-) needed for some weird compilers... very empiric.
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.
Defines unified interface to application:
std::istream & in(std::istream &in_, double &x_)
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
static pcre_uint8 * buffer
Definition: pcretest.c:1051
Modified on Wed Apr 17 13:10:32 2024 by modify_doxy.py rev. 669887