70 virtual int Run(
void);
86 arg_desc->AddOptionalKey
88 "GI id of the Seq-Entry to fetch",
91 arg_desc->AddOptionalKey
93 "ID1 request in ASN.1 text format",
95 arg_desc->AddOptionalKey
97 "File to read request(s) from",
101 arg_desc->AddDefaultKey
102 (
"fmt",
"OutputFormat",
103 "Format to dump the resulting data in",
106 "asn",
"asnb",
"xml",
"raw",
"none"));
109 arg_desc->AddDefaultKey
110 (
"out",
"ResultFile",
111 "File to dump the resulting data to",
115 arg_desc->AddOptionalKey
117 "File to post errors and messages to",
122 arg_desc->AddDefaultKey
128 string prog_description =
129 "Fetch SeqEntry from ID server by its GI id";
130 arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
131 prog_description,
false);
159 typedef vector<CRef<CID1server_request> > TReqs;
165 req->SetGetseqidsfromgi(gi);
168 else if ( args[
"req"] ) {
169 string text = args[
"req"].AsString();
171 text =
"ID1server-request ::= " +
text;
178 else if ( args[
"in"] ) {
179 unique_ptr<CObjectIStream> req_input
181 while ( !req_input->EndOfData() ) {
189 string server_name = args[
"server"].AsString();
196 args[
"fmt"].AsString() ==
"none"? 0: &args[
"out"].AsOutputFile();
198 unique_ptr<CObjectOStream> id1_client_output;
200 string fmt = args[
"fmt"].AsString();
203 }
else if (fmt ==
"asnb") {
205 }
else if (fmt ==
"xml") {
215 id1_server_output << **it;
216 id1_server_output.Flush();
221 if ( !id1_client_output.get() && datafile ) {
222 *datafile << id1_server.rdbuf();
227 id1_server_input.UseMemoryPool();
228 id1_server_input >> id1_response;
229 if ( id1_client_output.get() ) {
231 *id1_client_output << id1_response;
233 id1_client_output->FlushBuffer();
259 int main(
int argc,
const char* argv[])
User-defined methods of the data storage class.
User-defined methods of the data storage class.
This stream exchanges data with a named service, in a constraint that the service is implemented as o...
@ID1server_back.hpp User-defined methods of the data storage class.
virtual int Run(void)
Run the application.
virtual int Run(void)
Run the application.
virtual void Exit(void)
Cleanup on application exit.
virtual void Init(void)
Initialize the application.
virtual void Init(void)
Initialize the application.
virtual void Exit(void)
Cleanup on application exit.
CObjectIStreamAsnBinary –.
CObjectOStreamAsnBinary –.
#define GI_FROM(T, value)
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
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.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
@ fBinary
Open as binary file; for eInputFile, eOutputFile, eIOFile.
@ eInputFile
Name of file (must exist and be readable)
@ eIntId
Convertible to TIntId (int or Int8 depending on NCBI_INT8_GI)
@ eString
An arbitrary string.
@ eOutputFile
Name of file (must be writable)
void SetDiagPostFlag(EDiagPostFlag flag)
Set the specified flag (globally).
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
void SetDiagStream(CNcbiOstream *os, bool quick_flush=true, FDiagCleanup cleanup=0, void *cleanup_data=0, const string &stream_name="")
Set diagnostic stream.
@ eDPF_All
All flags (except for the "unusual" ones!)
@ eDiag_Info
Informational message.
#define MSerial_AsnText
I/O stream manipulators –.
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
EIO_Status SOCK_ShutdownAPI(void)
Cleanup; destroy all internal/system data & resources used by the SOCK API.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
void CONNECT_Init(const IRWRegistry *reg=0, CRWLock *lock=0, TConnectInitFlags flag=eConnectInit_OwnNothing, FSSLSetup ssl=0)
Init [X]CONNECT library with the specified "reg" and "lock" (ownership for either or both can be deta...
unsigned int usec
microseconds (modulo 1,000,000)
int main(int argc, const char *argv[])
static void text(MDB_val *v)
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
Process information in the NCBI Registry, including working with configuration files.
std::istream & in(std::istream &in_, double &x_)