65 virtual void Init(
void);
66 virtual int Run (
void);
79 const string&
query,
const string& db);
81 const string&
query,
const string& db);
83 const string&
query,
const string& db,
84 int start,
int max_num);
86 const string&
query,
const string& db,
87 int start,
int max_num);
89 const string&
query,
const string& db);
91 const string&
query,
const string& db);
93 const string&
query,
const string& db);
95 const string&
query,
const string& db);
97 const string&
query,
const string& db);
99 const string&
query,
const string& db);
108 bool parse,
bool uids,
109 int start = -1,
int max_num = -1);
126 arg_desc->AddKey(
"query",
"QueryString",
"Query to submit",
129 arg_desc->AddKey(
"db",
"Database",
"Name of database to query",
132 arg_desc->AddDefaultKey(
"lt",
"Lookup",
"Type of lookup to perform",
134 arg_desc->SetConstraint(
"lt",
149 arg_desc->AddDefaultKey(
"start",
"StartPos",
150 "Starting point in the UID list for retrieval",
152 arg_desc->AddDefaultKey(
"max",
"MaxNum",
153 "Maximum number of records (or UIDs) to retrieve",
156 arg_desc->AddDefaultKey(
"out",
"OutputFile",
"File to dump output to",
159 arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
160 "Entrez2Client command-line demo application");
171 string db = args[
"db"].AsString();
172 string query = args[
"query"].AsString();
173 string lt = args[
"lt"].AsString();
176 int start = args[
"start"].AsInteger();
177 int max_num = args[
"max"].AsInteger();
191 }
else if (
lt ==
"count") {
192 LOG_POST(
Info <<
"performing look-up type: eval-boolean "
195 }
else if (
lt ==
"parse") {
196 LOG_POST(
Info <<
"performing look-up type: eval-boolean"
197 " (show parsed expression)");
199 }
else if (
lt ==
"uids") {
200 LOG_POST(
Info <<
"performing look-up type: eval-boolean"
203 }
else if (
lt ==
"docsum") {
204 LOG_POST(
Info <<
"performing look-up type: get-docsum");
206 }
else if (
lt ==
"termpos") {
207 LOG_POST(
Info <<
"performing look-up type: get-term-pos");
209 }
else if (
lt ==
"termlist") {
210 LOG_POST(
Info <<
"performing look-up type: get-term-list");
212 }
else if (
lt ==
"termhier") {
213 LOG_POST(
Info <<
"performing look-up type: get-term-hierarchy");
215 }
else if (
lt ==
"links") {
218 }
else if (
lt ==
"linked") {
219 LOG_POST(
Info <<
"performing look-up type: get-linked");
221 }
else if (
lt ==
"linkct") {
222 LOG_POST(
Info <<
"performing look-up type: get-link-counts");
248 const string&
query,
const string& db)
261 const string&
query,
const string& db,
262 int start,
int max_num)
291 int start,
int max_num)
300 client.AskGet_docsum(reply->GetUids());
302 *
m_Ostream << reply->GetCount() <<
" records match" << endl;
377 req.
SetUid(NStr::StringToNumeric<TEntrezId>(
query));
381 *
m_Ostream <<
"Link counts: " << reply->GetLink_type_count() << endl;
384 *
m_Ostream <<
" Count: " << (*it)->GetLink_count() << endl;
395 const string&
query,
const string& db,
396 bool parse,
bool uids,
397 int start,
int max_num)
423 exp.
SetExp().push_back(elem);
451 for ( ; !iter.
AtEnd(); ++iter) {
463 int main(
int argc,
const char* argv[])
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.
virtual void Init(void)
Initialize the application.
void x_GetLinks(CEntrez2Client &client, const string &query, const string &db)
void x_FormatReply(CEntrez2_boolean_reply &reply)
void x_GetLinkCounts(CEntrez2Client &client, const string &query, const string &db)
CRef< CEntrez2Client > m_Client
void x_GetTermList(CEntrez2Client &client, const string &query, const string &db)
void x_GetDocsums(CEntrez2Client &client, const string &query, const string &db, int start, int max_num)
void x_GetTermPos(CEntrez2Client &client, const string &query, const string &db)
void x_GetParsedQuery(CEntrez2Client &client, const string &query, const string &db)
void x_GetTermHierarchy(CEntrez2Client &client, const string &query, const string &db)
void x_GetUids(CEntrez2Client &client, const string &query, const string &db, int start, int max_num)
void x_GetLinked(CEntrez2Client &client, const string &query, const string &db)
void x_GetCount(CEntrez2Client &client, const string &query, const string &db)
virtual int Run(void)
Run the application.
void x_GetInfo(CEntrez2Client &client)
unique_ptr< CObjectOStream > m_ObjOstream
CEntrez2_boolean_reply * x_EvalBoolean(CEntrez2Client &client, const string &query, const string &db, bool parse, bool uids, int start=-1, int max_num=-1)
CEntrez2_boolean_element –.
CEntrez2_boolean_reply –.
TConstUidIterator GetConstUidIterator() const
Include a standard set of the NCBI C++ Toolkit most basic headers.
int main(int argc, const char *argv[])
void HideStdArgs(THideStdArgs hide_mask)
Set the hide mask for the Hide Std Flags.
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.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
void DisableArgDescriptions(TDisableArgDesc disable=fDisableStdArgs)
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
@ fHideLogfile
Hide log file description.
@ fHideDryRun
Hide dryrun description.
@ fHideConffile
Hide configuration file description.
@ fHideVersion
Hide version description.
@ fDisableStdArgs
(-logfile, -conffile, -version etc)
@ eString
An arbitrary string.
@ eOutputFile
Name of file (must be writable)
@ eInteger
Convertible into an integer number (int or Int8)
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
void Info(CExceptionArgs_Base &args)
@ eSerial_AsnText
ASN.1 text.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
void Reset(void)
Reset reference object.
TObjectType * Release(void)
Release a reference to the object and return a pointer to the object.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
void SetDb(const TDb &value)
Assign a value to Db data member.
const TUids & GetUids(void) const
Get the Uids member data.
void SetTool(const TTool &value)
Assign a value to Tool data member.
const TQuery & GetQuery(void) const
Get the Query member data.
void SetReturn_parse(TReturn_parse value)
Assign a value to Return_parse data member.
bool CanGetCount(void) const
Check if it is safe to call GetCount method.
virtual TRequest & SetDefaultRequest(void)
bool IsSetUids(void) const
if uids requested Check if a value has been assigned to Uids data member.
void SetLimits(TLimits &value)
Assign a value to Limits data member.
void SetUid(TUid value)
Assign a value to Uid data member.
void SetReturn_UIDs(TReturn_UIDs value)
Assign a value to Return_UIDs data member.
list< CRef< CEntrez2_link_count > > TLinks
TExp & SetExp(void)
Assign a value to Exp data member.
TCount GetCount(void) const
Get the Count member data.
bool IsSetQuery(void) const
if parsed query requested Check if a value has been assigned to Query data member.
void SetQuery(TQuery &value)
Assign a value to Query data member.
void SetDb(const TDb &value)
Assign a value to Db data member.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
static CNamedPipeClient * client