43 #include <misc/error_codes.hpp>
49 #include <type_traits>
51 #define NCBI_USE_ERRCODE_X Misc_EutilsClient
66 const vector<string>& args,
71 static const STimeout five_seconds = { 5, 0 };
74 if ( !
data.empty() ) {
97 return "Phrase not found";
99 return "Field not found";
101 return "Phrase ignored";
103 return "Quoted phrase not found";
105 return "Output message";
107 return "Unknown error";
111 template<
class T>
static void s_FormatIds(ostream& osm,
const vector<T>& uids) {
115 for (
auto it = uids.begin()+1; it != uids.end(); ++it) {
124 for (
auto it = uids.begin(); it != uids.end(); ++it) {
125 if (it != uids.begin()) {
132 "Argument list contains seq-ids of mixed types");
139 "Argument list contains seq-ids of mixed types");
142 osm << seh.GetSeqId()->GetSeqIdString(
true);
153 for (
auto it = uids.begin()+1; it != uids.end(); ++it) {
157 osm <<
"&idtype=acc";
162 return NStr::StringToNumeric<T>(
str);
187 const string & message)
const
201 const string& message)
const
217 const string& message)
const
224 !IsTaxidQuery(message))
277 void GetErrors(list<string>& errors) { errors = m_Errors; }
289 m_Text_chunks.clear();
291 if ( !m_Path.empty() ) {
300 bool result = OnEndElement();
302 string::size_type pos = m_Path.find_last_of(
"/");
303 if (pos != string::npos) {
309 bool text(
const string& contents)
311 m_Text_chunks.push_back(contents);
339 : m_MessageHandler(message_handler)
362 ITERATE(list<TMessage>,
i, m_ResultWarnings) {
364 i->first,
i->second);
366 m_ResultWarnings.clear();
367 ITERATE(list<TMessage>,
i, m_ResultErrors) {
369 i->first,
i->second);
371 m_ResultErrors.clear();
375 typedef pair<CEUtilsException::EErrCode, string>
TMessage;
380 string::size_type pos = s.rfind(suffix);
381 return (pos != string::npos && pos == s.size() - strlen(suffix));
387 string contents = GetText();
389 if (m_Path ==
"eSearchResult/Count") {
392 else if (x_IsSuffix(m_Path,
"/IdList/Id")) {
393 m_Uids.push_back(s_ParseId<T>(contents));
395 else if (x_IsSuffix(m_Path,
"/ErrorList/PhraseNotFound")) {
397 m_ResultErrors.push_back(message);
399 else if (x_IsSuffix(m_Path,
"/ErrorList/FieldNotFound")) {
401 m_ResultErrors.push_back(message);
403 else if (x_IsSuffix(m_Path,
"/WarningList/PhraseIgnored")) {
405 m_ResultWarnings.push_back(message);
407 else if (x_IsSuffix(m_Path,
"/WarningList/QuotedPhraseNotFound")) {
409 m_ResultWarnings.push_back(message);
411 else if (x_IsSuffix(m_Path,
"/WarningList/OutputMessage")) {
413 m_ResultWarnings.push_back(message);
415 else if (m_Path ==
"ERROR" || m_Path ==
"eSearchResult/ERROR") {
417 m_Errors.push_back(contents);
446 : m_LinkName(dbfrom +
"_" + dbto)
455 m_LinkName = link_name;
464 if (name ==
"LinkSetDb") {
473 if ( GetText() == m_LinkName) {
478 m_Uids.push_back(s_ParseId<T>( GetText() ));
494 #define EUTILS_CLIENT_SECTION "eutils_client"
496 #define DEFAULT_MAX_RETRIES 9
497 #define DEFAULT_WAIT_TIME 0
498 #define DEFAULT_WAIT_TIME_MULTIPLIER 1
499 #define DEFAULT_WAIT_TIME_INCREMENT 0.5
500 #define DEFAULT_WAIT_TIME_MAX 3
515 "wait_time_multiplier",
520 "wait_time_increment",
538 : m_CachedHostNameCount(0),
606 if (!max_retries.empty()) {
608 m_MaxRetries = NStr::StringToNumeric<unsigned int>(max_retries);
611 ERR_POST(
"Invalid max_retries value: " << max_retries);
616 if (!timeout.empty()) {
621 ERR_POST(
"Invalid conn_timeout value: " << timeout);
640 catch ( exception& exc ) {
647 LOG_POST(
Warning<<
"CEutilsClient: waiting " << wait_sec <<
"s before retry");
660 params +=
"&retmode=xml&retmax=1";
666 LOG_POST(
Trace <<
"Executing: db=" << db <<
" query=" << term);
674 "failed to execute query: " + term);
683 string path =
"/entrez/eutils/esearch.fcgi";
699 "error parsing xml: " + msgs.
print());
717 vector<CSeq_id_Handle>& uids)
723 vector<string>& uids)
729 vector<TEntrezId>& uids)
744 "error parsing xml: " + msgs.
print());
753 "error returned from query: " +
msg);
769 vector<CSeq_id_Handle>& uids)
775 vector<string>& uids)
781 vector<TEntrezId>& uids)
793 "failed to open file: " + xml_file);
802 const string& xml_path)
804 return x_Search(db, term, uids, xml_path);
810 vector<CSeq_id_Handle>& uids,
811 const string& xml_path)
813 return x_Search(db, term, uids, xml_path);
818 vector<string>& uids,
819 const string& xml_path)
821 return x_Search(db, term, uids, xml_path);
827 vector<TEntrezId>& uids,
828 const string& xml_path)
830 return x_Search(db, term, uids, xml_path);
837 const string& xml_path)
842 params +=
"&retmode=xml";
850 params +=
"&idtype=gi";
852 params +=
"&idtype=acc";
856 LOG_POST(
Trace <<
"Executing: db=" << db <<
" query=" << term);
861 return CallWithRetry(bind(&CEutilsClient::x_SearchOnce<T>,
this, cref(params), ref(uids), cref(xml_path)),
"Search");
865 "failed to execute query: " + term);
875 const string& xml_path)
879 string path =
"/entrez/eutils/esearch.fcgi";
888 if(!xml_path.empty()) {
897 "Failure while writing entrez xml response"
898 " to file: " + xml_file);
932 oss <<
"&usehistory=y";
935 x_Get(
"/entrez/eutils/esearch.fcgi", oss.str(), ostr);
941 const string& web_env,
957 oss <<
"&usehistory=y"
964 const string& web_env,
971 if ( query_key > 0 ) {
976 x_Get(
"/entrez/eutils/esearch.fcgi", oss.str(), ostr);
981 const string& web_env,
988 oss <<
"&query_key=" << query_key <<
"&idtype=acc";
990 x_Get(
"/entrez/eutils/esearch.fcgi", oss.str(), ostr);
995 const string& web_env,
996 const string& query_key,
1002 oss <<
"&query_key=" << query_key <<
"&idtype=acc";
1004 x_Get(
"/entrez/eutils/esearch.fcgi", oss.str(), ostr);
1008 #define HOST_NAME_REFRESH_FREQ 100
1026 static const char kEutils[] =
"eutils.ncbi.nlm.nih.gov";
1027 static const char kEutilsLB[] =
"eutils_lb";
1041 string scheme(
"http");
1045 buf,
sizeof(
buf), kEutils);
1046 host =
string(web && *web ? web : kEutils);
1056 string const& params,
1061 string extra_params{ params };
1068 msg <<
"Failed to execute request: "
1084 istr << extra_params;
1086 ostringstream reply;
1090 string reply_str = reply.str();
1091 istringstream reply_istr(reply.str());
1092 vector<TEntrezId> uids;
1106 const string& db_to,
1107 const vector<int>& uids_from,
1108 vector<int>& uids_to,
1109 const string& xml_path,
1113 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1118 const string& db_to,
1119 const vector<CSeq_id_Handle>& uids_from,
1120 vector<CSeq_id_Handle>& uids_to,
1121 const string& xml_path,
1124 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1128 const string& db_to,
1129 const vector<string>& uids_from,
1130 vector<string>& uids_to,
1131 const string& xml_path,
1134 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1138 const string& db_to,
1139 const vector<TEntrezId>& uids_from,
1140 vector<TEntrezId>& uids_to,
1141 const string& xml_path,
1144 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1149 const string& db_to,
1150 const vector<int>& uids_from,
1151 vector<TEntrezId>& uids_to,
1152 const string& xml_path,
1155 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1159 const string& db_to,
1160 const vector<TEntrezId>& uids_from,
1161 vector<int>& uids_to,
1162 const string& xml_path,
1165 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1170 const string& db_to,
1171 const vector<TEntrezId>& uids_from,
1172 vector<CSeq_id_Handle>& uids_to,
1173 const string& xml_path,
1176 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1180 const string& db_to,
1181 const vector<CSeq_id_Handle>& uids_from,
1182 vector<TEntrezId>& uids_to,
1183 const string& xml_path,
1186 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1189 template<
class T1,
class T2>
1191 const string& db_to,
1192 const vector<T1>& uids_from,
1193 vector<T2>& uids_to,
1194 const string& xml_path,
1197 std::ostringstream oss;
1204 string params = oss.str();
1212 cref(db_from), cref(db_to), ref(uids_to), cref(xml_path), cref(params)),
"Link");
1216 "failed to execute elink request: " + params);
1223 const string& db_to,
1225 const string& xml_path,
1226 const string& params)
1228 string path =
"/entrez/eutils/elink.fcgi";
1241 if(!xml_path.empty()) {
1252 "Failure while writing entrez xml response"
1253 " to file: " + xml_file);
1268 "error parsing xml: " + msgs.
print());
1275 const string& db_to,
1276 const vector<int>& uids_from,
1285 const string& db_to,
1286 const vector<CSeq_id_Handle>& uids_from,
1294 const string& db_to,
1295 const vector<string>& uids_from,
1303 const string& db_to,
1304 const vector<TEntrezId>& uids_from,
1313 const string& db_to,
1314 const vector<T>& uids_from,
1318 std::ostringstream oss;
1325 string params = oss.str();
1335 "failed to execute elink request: " + params);
1342 string path =
"/entrez/eutils/elink.fcgi";
1357 const string& db_to,
1358 const string& web_env,
1362 std::ostringstream oss;
1367 <<
"&WebEnv=" << web_env
1368 <<
"&query_key=" << query_key;
1370 x_Get(
"/entrez/eutils/elink.fcgi", oss.str(), ostr);
1374 const string& db_to,
1375 const string& web_env,
1379 std::ostringstream oss;
1384 <<
"&WebEnv=" << web_env
1385 <<
"&query_key=" << query_key
1388 x_Get(
"/entrez/eutils/elink.fcgi", oss.str(), ostr);
1392 const string& db_to,
1393 const string& web_env,
1394 const string& query_key,
1397 std::ostringstream oss;
1402 <<
"&WebEnv=" << web_env
1403 <<
"&query_key=" << query_key
1406 x_Get(
"/entrez/eutils/elink.fcgi", oss.str(), ostr);
1411 const vector<int>& uids,
1421 const vector<objects::CSeq_id_Handle>& uids,
1429 const vector<string>& uids,
1437 const vector<TEntrezId>& uids,
1445 const vector<T>& uids,
1454 string params = oss.str();
1464 "failed to execute esummary request: " + params);
1471 string path =
"/entrez/eutils/elink.fcgi?";
1473 string url =
x_BuildUrl(hostname, path, params);
1478 m_Url.push_back(url);
1487 string docstr(sb.str());
1497 const vector<int>& uids,
1506 const vector<CSeq_id_Handle>& uids,
1514 const vector<string>& uids,
1522 const vector<TEntrezId>& uids,
1531 const vector<T>& uids,
1543 string params = oss.str();
1553 "failed to execute esummary request: " + params);
1560 string path =
"/entrez/eutils/esummary.fcgi?";
1562 string url =
x_BuildUrl(hostname, path, params);
1567 m_Url.push_back(url);
1576 string docstr(sb.str());
1580 docsums.
swap(xmldoc);
1586 const string& web_env,
1593 <<
"&WebEnv=" << web_env;
1595 if ( retstart > 0 ) {
1596 oss <<
"&retstart=" << retstart;
1600 oss <<
"&retmax=" << retmax;
1610 const string& web_env,
1618 oss <<
"&query_key=" << query_key;
1619 x_Get(
"/entrez/eutils/esummary.fcgi?", oss.str(), ostr);
1623 const string& web_env,
1631 oss <<
"&query_key=" << query_key
1633 x_Get(
"/entrez/eutils/esummary.fcgi?", oss.str(), ostr);
1637 const string& web_env,
1638 const string& query_key,
1645 oss <<
"&query_key=" << query_key
1647 x_Get(
"/entrez/eutils/esummary.fcgi?", oss.str(), ostr);
1652 const vector<int>& uids,
1654 const string& retmode)
1656 x_Fetch(db, uids, ostr, retmode);
1661 const vector<CSeq_id_Handle>& uids,
1663 const string& retmode)
1665 x_Fetch(db, uids, ostr, retmode);
1669 const vector<string>& uids,
1671 const string& retmode)
1673 x_Fetch(db, uids, ostr, retmode);
1677 const vector<TEntrezId>& uids,
1679 const string& retmode)
1681 x_Fetch(db, uids, ostr, retmode);
1686 const vector<T>& uids,
1688 const string& retmode)
1695 string params = oss.str();
1705 "failed to execute efetch request: " + params);
1712 string path =
"/entrez/eutils/efetch.fcgi";
1728 switch (content_type) {
1746 const string& web_env,
1753 <<
"&WebEnv=" << web_env;
1754 if ( retstart > 0 ) {
1755 oss <<
"&retstart=" << retstart;
1759 oss <<
"&retmax=" << retmax;
1764 const string& web_env,
1772 oss <<
"&query_key=" << query_key;
1774 x_Get(
"/entrez/eutils/efetch.fcgi", oss.str(), ostr);
1778 const string& web_env,
1781 EContentType content_type,
1786 oss <<
"&query_key=" << query_key
1789 x_Get(
"/entrez/eutils/efetch.fcgi", oss.str(), ostr);
1793 const string& web_env,
1794 const string& query_key,
1801 oss <<
"&query_key=" << query_key
1804 x_Get(
"/entrez/eutils/efetch.fcgi", oss.str(), ostr);
1818 const string ¶ms)
1820 string url = host + path;
1821 if(!params.empty()) {
1822 url +=
'?' + params;
1833 oss <<
'&' << param.first <<
'=' << param.second;
1835 params += oss.str();
Helper hook-up class that installs default logging/registry/locking (but only if they have not yet be...
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
CConn_PipeStream for command piping.
void SetLinkName(const string &link_name)
bool end_element(const string &name)
CELinkParser(const string &dbfrom, const string &dbto, vector< T > &uids)
pair< CEUtilsException::EErrCode, string > TMessage
CEutilsClient::CMessageHandler & m_MessageHandler
list< TMessage > m_ResultErrors
List of error messages from the E-Utils request.
Uint8 GetCount(void) const
bool x_IsSuffix(const string &s, const char *suffix)
CESearchParser(vector< T > &uids, CEutilsClient::CMessageHandler &message_handler)
void ProcessMessages(void)
Processes the warning and error messages from E-Utils, delivering them to the message handler and cle...
list< TMessage > m_ResultWarnings
List of warning messages from the E-Utils request.
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
bool end_element(const string &name)
void GetErrors(list< string > &errors)
virtual bool OnEndElement(void)
bool text(const string &contents)
string GetText(void) const
bool start_element(const string &name, const attrs_type &attrs)
list< string > m_Errors
List of parsing errors.
list< string > m_Text_chunks
bool error(const string &message)
bool HasError(void) const
Subclass this to override how messages (warnings and errors) are handled.
const list< CTime > GetTime(void) const
void LinkOut(const string &db, const vector< objects::CSeq_id_Handle > &uids, xml::document &docsums, const string &cmd="llinks")
Uint8 x_CountOnce(const string ¶ms)
void Fetch(const string &db, const vector< objects::CSeq_id_Handle > &uids, CNcbiOstream &ostr, const string &retmode="xml")
void SetMaxReturn(int ret_max)
int m_CachedHostNameCount
CRef< CMessageHandler > m_MessageHandler
void x_SummaryOnce(xml::document &docsums, const string ¶ms)
void SearchHistory(const string &db, const string &term, const string &web_env, Int8 query_key, int retstart, CNcbiOstream &ostr)
Uint8 Search(const string &db, const string &term, vector< objects::CSeq_id_Handle > &uids, const string &xml_path=kEmptyStr)
TParamList m_AdditionalParams
const list< string > GetUrl(void) const
static string x_BuildUrl(const string &host, const string &path, const string ¶ms)
void x_AddAdditionalParameters(string ¶ms)
void x_Fetch(const string &db, const vector< T > &uids, CNcbiOstream &ostr, const string &retmode="xml")
void x_Summary(const string &db, const vector< T > &uids, xml::document &docsums, const string &version="")
void AddParameter(const string &name, const string &value)
CIncreasingTime m_WaitTime
void Summary(const string &db, const vector< objects::CSeq_id_Handle > &uids, xml::document &docsums, const string &version="")
unsigned int m_MaxRetries
void SetLinkName(const string &link_name)
void ClearAddedParameters()
void x_Link(const string &db_from, const string &db_to, const vector< T1 > &uids_from, vector< T2 > &uids_to, const string &xml_path, const string &command)
Uint8 x_Search(const string &db, const string &term, vector< T > &uids, const string &xml_path=kEmptyStr)
void x_FetchOnce(CNcbiOstream &ostr, const string ¶ms)
std::invoke_result< Call >::type CallWithRetry(Call &&call, const char *name)
void SetMessageHandlerDiagPost(void)
Equivalent to: ERR_POST(Warning|Error << ...).
void x_Get(string const &path, string const ¶ms, CNcbiOstream &ostr)
Uint8 x_ParseSearchResults(const string &xml_file, vector< T > &uids)
void x_LinkOnce(CNcbiOstream &ostr, const string ¶ms)
void SetMessageHandlerThrowOnError(void)
Equivalent to: NCBI_THROW, ERR_POST, LOG_POST as appropriate.
void Link(const string &db_from, const string &db_to, const vector< objects::CSeq_id_Handle > &uids_from, vector< objects::CSeq_id_Handle > &uids_to, const string &xml_path=kEmptyStr, const string &command="neighbor")
const string & x_GetHostName(void) const
void x_LinkOnceT(const string &db_from, const string &db_to, vector< T > &uids_to, const string &xml_path, const string ¶ms)
void SetMessageHandler(CMessageHandler &message_handler)
Set custom message handler.
void x_GetOnce(string const &path, string const &extra_params, CNcbiOstream &ostr)
void SetMessageHandlerDefault(void)
Default is to log all messages at informational level.
void SetUserTag(const string &tag)
Uint8 x_SearchOnce(const string ¶ms, vector< T > &uids, const string &xml_path)
Uint8 ParseSearchResults(CNcbiIstream &istr, vector< objects::CSeq_id_Handle > &uids)
void FetchHistory(const string &db, const string &web_env, Int8 query_key, int retstart, EContentType content_type, CNcbiOstream &ostr)
void LinkHistory(const string &db_from, const string &db_to, const string &web_env, Int8 query_key, CNcbiOstream &ostr)
Uint8 Count(const string &db, const string &term)
void x_LinkOutOnce(xml::document &doc, const string ¶ms)
void SummaryHistory(const string &db, const string &web_env, Int8 query_key, int retstart, const string &version, CNcbiOstream &ostr)
void x_LinkOut(const string &db, const vector< T > &uids, xml::document &doc, const string &cmd)
double GetTime(int step) const
void Init(CConfig &conf, const string &driver_name, const SAllParams ¶ms)
virtual void HandleMessage(EDiagSev severity, CEUtilsException::EErrCode err_code, const string &message) const
Pure virtual function, to be implemented by subclass.
virtual void HandleMessage(EDiagSev severity, CEUtilsException::EErrCode err_code, const string &message) const
Pure virtual function, to be implemented by subclass.
bool IsTaxidQuery(const string &message) const
virtual void HandleMessage(EDiagSev severity, CEUtilsException::EErrCode err_code, const string &message) const
Pure virtual function, to be implemented by subclass.
container_type::value_type value_type
The xml::document class is used to hold the XML tree and various bits of information about it.
void swap(document &other)
Swap one xml::document object for another.
The xml::error_messages class is used to store all the error message which are collected while parsin...
bool has_fatal_errors(void) const
Check if there are fatal errors in the error messages.
bool has_errors(void) const
Check if there are errors in the error messages.
std::string print(void) const
Convert error messages into a single printable string.
The xml::event_parser is used to parse an XML document by calling member functions when certain thing...
std::map< std::string, std::string > attrs_type
a type for holding XML node attributes
bool parse_stream(std::istream &stream, error_messages *messages, warnings_as_errors_type how=type_warnings_not_errors)
Parse what ever data that can be read from the given stream.
bool parse_file(const char *filename, error_messages *messages, warnings_as_errors_type how=type_warnings_not_errors)
Call this member function to parse the given file.
The NCBI C++ standard methods for dealing with std::string.
void s_FormatIds< string >(ostream &osm, const vector< string > &uids)
static const char * s_GetErrCodeString(CEUtilsException::TErrCode err_code)
#define DEFAULT_WAIT_TIME_MAX
static CIncreasingTime::SAllParams s_WaitTimeParams
string s_ParseId< string >(const string &str)
void s_FormatIds< CSeq_id_Handle >(ostream &osm, const vector< CSeq_id_Handle > &uids)
static void s_SearchHistoryQuery(ostringstream &oss, const string &db, const string &term, const string &web_env, int retstart, int retmax)
#define DEFAULT_WAIT_TIME_MULTIPLIER
CSeq_id_Handle s_ParseId< CSeq_id_Handle >(const string &str)
static string s_GetContentType(CEutilsClient::EContentType content_type)
#define DEFAULT_WAIT_TIME_INCREMENT
static void s_FetchHistoryQuery(ostream &oss, const string &db, const string &web_env, int retstart, int retmax, CEutilsClient::EContentType content_type)
#define HOST_NAME_REFRESH_FREQ
#define EUTILS_CLIENT_SECTION
static void s_SummaryHistoryQuery(ostream &oss, const string &db, const string &web_env, int retstart, const string version, int retmax)
static void s_FormatIds(ostream &osm, const vector< T > &uids)
#define DEFAULT_MAX_RETRIES
#define DEFAULT_WAIT_TIME
static T s_ParseId(const string &str)
This file contains the definition of the xml::event_parser class.
static const char * str(char *buf, int n)
static CNcbiApplicationGuard InstanceGuard(void)
Singleton method.
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
int GetStatusCode(void) const
Get the last seen HTTP status code, if available.
CPipe & GetPipe(void)
Return an underlying CPipe; it's valid for as long as the stream exists.
@ fHTTP_AutoReconnect
See HTTP_CreateConnectorEx()
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
const CNcbiDiag & GetRef(void) const
Some compilers (e.g.
static const char * SeverityName(EDiagSev sev)
Get a common symbolic name for the severity levels.
#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(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error – guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
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.
void Trace(CExceptionArgs_Base &args)
void Warning(CExceptionArgs_Base &args)
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
EIO_Status CloseHandle(EChildIOHandle handle)
Close the specified child's pipe handle (even for CPipe opened with OpenSelf()).
@ fStdErr_Share
Keep stderr (share it with child)
uint32_t Uint4
4-byte (32-bit) unsigned integer
int64_t Int8
8-byte (64-bit) signed integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
virtual string GetString(const string §ion, const string &name, const string &default_value, TFlags flags=0) const
Get the parameter string value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
SSERV_Info * SERV_GetInfo(const char *service, TSERV_Type types, unsigned int preferred_host, const SConnNetInfo *net_info)
Same as "SERV_GetInfoEx(., ., ., ., 0, 0, 0)" – i.e.
static string ntoa(unsigned int host)
BSD-like API. NB: when int, "host" must be in network byte order.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
bool NcbiStreamCopy(CNcbiOstream &os, CNcbiIstream &is)
Copy the entire contents of stream "is" to stream "os".
size_t NcbiStreamToString(string *s, CNcbiIstream &is, size_t pos=0)
Input the entire contents of an istream into a string (NULL causes drain).
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static Uint8 StringToUInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to Uint8.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static string URLEncode(const CTempString str, EUrlEncode flag=eUrlEnc_SkipMarkChars)
URL-encode string.
static string & ToLower(string &str)
Convert string to lower case – string& version.
@ fDecimalPosixOrLocal
StringToDouble*(): For decimal point, try both C and current locale.
void Set(EType type)
Set special value.
@ eCurrent
Use current time. See also CCurrentTime.
@ eDefault
Default timeout (to be interpreted by the client code)
const STimeout * g_CTimeoutToSTimeout(const CTimeout &cto, STimeout &sto)
CTimeout/STimeout adapters.
const char * ConnNetInfo_GetValue(const char *service, const char *param, char *value, size_t value_size, const char *def_value)
SConnNetInfo * ConnNetInfo_Create(const char *service)
void ConnNetInfo_Destroy(SConnNetInfo *net_info)
@ e_Gi
GenInfo Integrated Database.
@ e_not_set
No variant selected.
const string version
version string
string Execute(const string &cmmd, const vector< string > &args, const string &data=kEmptyStr)
const GenericPointer< typename T::ValueType > T2 value
Parameters initialization model.
void SleepMilliSec(unsigned long ml_sec, EInterruptOnSignal onsignal=eRestartOnSignal)
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)