(
void);
88 virtual int Run(
void);
89 virtual void Exit(
void);
130(
"gi",
"SeqEntryID",
131 "GI id of the Seq-Entry to fetch",
135(
"id",
"SeqEntryID",
136 "Seq-id of the Seq-Entry to fetch",
140(
"blob_id",
"BlobID",
141 "Blob id of the Seq-Entry to fetch (sat,sat-key)",
145(
"req",
"Request",
146 "ID2 request in ASN.1 text format",
149(
"packet",
"Packet",
150 "ID2 request packet in ASN.1 text format",
153(
"in",
"RequestFile",
154 "File to read request(s) from",
157arg_desc->
AddFlag(
"verbose",
"Verbose output");
159arg_desc->
AddFlag(
"skip_data",
"Skip blob data");
161arg_desc->
AddFlag(
"copy_data",
"Copy blob data");
163arg_desc->
AddFlag(
"parse_data",
"Parse blob data");
165arg_desc->
AddFlag(
"pipe_data",
"Pipe parsing blob data");
168arg_desc->
AddFlag(
"show_init",
"Show init reply");
172(
"fmt",
"OutputFormat",
173 "Format to dump server reply in",
176 "asn",
"asnb",
"xml",
"none"));
180(
"out",
"ResultFile",
181 "File to dump the resulting data to",
186(
"raw",
"RawFile",
187 "File to dump the raw ID2 data to",
192(
"data",
"DataFile",
193 "File to save blob data to",
198(
"log",
"LogFile",
199 "File to post errors and messages to",
205(
"server",
"Server",
211(
"pubseqos",
"PubSeqOS",
212 "PubSeqOS server name",
214arg_desc->
AddFlag(
"HUP",
"Set cubby_user");
218(
"count",
"Count",
219 "Repeat request number of times",
223 stringprog_description =
224 "Fetch SeqEntry from ID server by its GI id";
226prog_description,
false);
239(server_name,
fSERV_Any, 0, 0, &tmout));
244 LOG_POST(
" connection description: "<< descr);
256args[
"packet"]=
"3584";
257args[
"version"]=
"125";
261 ERR_FATAL(
"Failed to create ftds context: "<<errmsg);
266 ERR_FATAL(
"Failed to open PubSeqOS connection: "<<server_name);
278 LOG_POST(
"Setting cubby_user = "<<user_name);
298packet.
Set().push_back(
Ref(&req));
307 while(
result.Fetch() ) {
308 for(
unsignedpos = 0; pos <
result.NofItems(); ++pos ) {
309 if(
result.ItemName(pos) == name ) {
339 if( !sx_FetchNextItem(*
m_DB_Result,
"asnout") ) {
369id2_server_output << packet;
370id2_server_output.
Flush();
386 ERR_FATAL(
"PubSeqOS: packet size overflow");
388 size= mem_str.pcount();
398 cmd->SetParam(
"@service", &service);
399 cmd->SetParam(
"@asnin", &short_asn);
400 cmd->SetParam(
"@text", &text_in);
401 cmd->SetParam(
"@out_text", &text_out);
402 cmd->SetParam(
"@asnin_long", &long_asn);
406 while(
cmd->HasMoreResults() ) {
407 if(
cmd->HasFailed() ) {
410dbr =
cmd->Result();
414 if( sx_FetchNextItem(*dbr,
"asnout") ) {
423 ERR_FATAL(
"PubSeqOS: no more results");
429 classCOSSReader :
public IReader 432 typedefvector<char> TOctetString;
433 typedeflist<TOctetString*> TOctetStringSequence;
435COSSReader(
constTOctetStringSequence&
in)
437m_CurVec(
in.begin())
444 size_t* bytes_read = 0)
446 size_tpending = x_Pending();
449*bytes_read =
count;
451 if( pending == 0 ) {
463 size_tpending = x_Pending();
469 voidx_SetVec(
void)
472m_CurSize = m_CurVec == m_Input.end()? 0: (**m_CurVec).size();
474 size_tx_Pending(
void)
477 while( (
size= m_CurSize - m_CurPos) == 0 &&
478m_CurVec != m_Input.end() ) {
485 constTOctetStringSequence& m_Input;
486TOctetStringSequence::const_iterator m_CurVec;
504 while( (
count= block.Read(
buf,
sizeof(
buf))) != 0 ) {
513 classCOSSPipeReader :
public IReader 519m_Iter(
in, member.GetMemberType()) {
525}
while( x_OpenBlock() );
530 size_t* bytes_read = 0) {
532 if( m_Block.get() ) {
533 size_t count= m_Block->Read(
buffer, buffer_size);
536*bytes_read =
count;
545 if( !x_OpenBlock() ) {
558 boolx_OpenBlock(
void) {
565 voidx_CloseBlock(
void) {
566 if( m_Block.get() ) {
569m_Iter.NextElement();
590 switch(
data.GetData_type() ) {
592obj_type = CSeq_entry::GetTypeInfo();
595obj_type = CSeq_annot::GetTypeInfo();
598obj_type = CID2S_Split_Info::GetTypeInfo();
601obj_type = CID2S_Chunk::GetTypeInfo();
604 ERR_FATAL(
"Unknown data type in ID2_Reply_Data");
608 switch(
data.GetData_format() ) {
619 ERR_FATAL(
"Unknown data format in ID2_Reply_Data");
623COSSPipeReader reader(
in, member);
627 switch(
data.GetData_compression() ) {
645 ERR_FATAL(
"Unknown data compression in ID2_Reply_Data");
664id2_server_input >> reply;
668id2_server_input >> reply;
683id2_server_input >> reply;
687id2_server_input >> reply;
689 object= hook->m_Object;
699packet.
Set().push_back(
Ref(&request));
714 if(
false&&
dump) {
717 LOG_POST(
"\nProcessing request:\n"<< ostr.rdbuf());
722 size_tremaining_count = packet.
Set().size();
726 doubletime_first = 0;
727 while( remaining_count > 0 ) {
731 if( !time_first ) time_first =
sw.
Elapsed();
738 if( !time_first ) time_first =
sw.
Elapsed();
741 if( iter && iter->IsSetData() ) {
756*id2_client_output << reply;
765 LOG_POST(
"Packet processed in "<<
sw.
Elapsed()<<
" first at "<<time_first);
774 switch(
data.GetData_type() ) {
776obj_type = CSeq_entry::GetTypeInfo();
779obj_type = CSeq_annot::GetTypeInfo();
782obj_type = CID2S_Split_Info::GetTypeInfo();
785obj_type = CID2S_Chunk::GetTypeInfo();
788 ERR_FATAL(
"Unknown data type in ID2_Reply_Data");
792 switch(
data.GetData_format() ) {
803 ERR_FATAL(
"Unknown data format in ID2_Reply_Data");
807COSSReader reader(
data.GetData());
820COSSReader reader(
data.GetData());
824 switch(
data.GetData_compression() ) {
839 ERR_FATAL(
"Unknown data compression in ID2_Reply_Data");
849copier.
Copy(obj_type);
854 if( out_stream.
get() ) {
870out_stream->
Write(
object.GetObjectPtr(),
object.GetTypeInfo());
884 if( args[
"log"] ) {
899 if( args[
"fmt"].AsString() !=
"none") {
900 if( args[
"data"] ) {
903 if( !
m_DataFile|| args[
"out"].AsString() !=
"-") {
904 m_OutFile= &args[
"out"].AsOutputFile();
907 if( args[
"raw"] ) {
908 m_RawFile= &args[
"raw"].AsOutputFile();
910 const string& fmt = args[
"fmt"].AsString();
913}
else if(fmt ==
"asnb") {
915}
else if(fmt ==
"xml") {
924 int count= args[
"count"].AsInteger();
926 if( args[
"pubseqos"] ) {
933 typedefvector<CRef<CID2_Request_Packet> > TReqs;
936 if( args[
"gi"] ) {
939reqs.push_back(packet);
941packet->Set().push_back(req);
943req->
SetRequest().SetGet_blob_info().SetBlob_id().SetResolve().
944SetRequest().SetSeq_id().SetSeq_id().SetSeq_id().SetGi(gi);
945req->
SetRequest().SetGet_blob_info().SetGet_data();
947 else if( args[
"id"] ) {
950reqs.push_back(packet);
952packet->Set().push_back(req);
954req->
SetRequest().SetGet_blob_info().SetBlob_id().SetResolve().
955SetRequest().SetSeq_id().SetSeq_id().SetSeq_id(*
id);
956req->
SetRequest().SetGet_blob_info().SetGet_data();
958 else if( args[
"blob_id"] ) {
960 NStr::Split(args[
"blob_id"].AsString(),
",", vv);
961 if( vv.size() != 2 ) {
962 ERR_FATAL(
"Bad blob_id format: "<<args[
"blob_id"]);
967reqs.push_back(packet);
969packet->Set().push_back(req);
971req->
SetRequest().SetGet_blob_info().SetBlob_id().SetBlob_id();
974req->
SetRequest().SetGet_blob_info().SetGet_data();
976 else if( args[
"req"] ) {
978reqs.push_back(packet);
980packet->Set().push_back(req);
982 string text= args[
"req"].AsString();
983 if(
text.find(
"::=") ==
NPOS) {
989 else if( args[
"packet"] ) {
991reqs.push_back(packet);
993 string text= args[
"packet"].AsString();
994 if(
text.find(
"::=") ==
NPOS) {
995 text=
"ID2-Request-Packet ::= "+
text;
1001 else if( args[
"in"] ) {
1007 if(
type==
"ID2-Request") {
1009reqs.push_back(packet);
1011packet->Set().push_back(req);
1016 else if(
type==
"ID2-Request-Packet") {
1018reqs.push_back(packet);
1020req_input->
Read(packet, packet->GetThisTypeInfo(),
1024 ERR_FATAL(
"Object type must be ID2-Request or ID2-Request-Packet.");
1029 ERR_FATAL(
"No ID2-Request specified.");
1034 for(
int i= 0;
i<
count; ++
i) {
1056 int main(
intargc,
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.
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...
ERW_Result PendingCount(size_t *)
Via parameter "count" (which is guaranteed to be supplied non-NULL) return the number of bytes that a...
ERW_Result Read(void *buf, size_t count, size_t *bytes_read)
Read as many as "count" bytes into a buffer pointed to by the "buf" argument.
CDB_Result_Reader(CDB_Result *db_result)
Reading (iterating through) elements of containers (SET OF, SEQUENCE OF).
unique_ptr< I_DriverContext > m_Context
void x_InitConnection(bool show_init)
virtual int Run(void)
Run the application.
CNcbiOstream * m_DataFile
void x_SendRequestPacket(CID2_Request_Packet &packet)
void x_InitPubSeqConnection(const string &server_name, bool show_init)
void x_SaveDataObject(const CObjectInfo &object, CNcbiOstream &out)
void x_ProcessRequest(CID2_Request &request, bool dump=true)
virtual void Init(void)
Initialize the application.
AutoPtr< CDB_Connection > m_PubSeqOS
AutoPtr< CNcbiIstream > m_PubSeqOSReply
ESerialDataFormat m_Format
void x_ProcessData(const CID2_Reply_Data &data)
virtual void Exit(void)
Cleanup on application exit.
AutoPtr< CConn_ServiceStream > m_ID2Conn
void x_ReadReply(CID2_Reply &reply)
Helper class: installs hooks in constructor, and uninstalls in destructor.
CObjectIStreamAsnBinary â.
CObjectOStreamAsnBinary â.
Note about the "buf_size" parameter for streams in this API.
Read hook for data member of a containing object (eg, SEQUENCE)
static string GetUserName(void)
Get actual user name for the current process.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
Template class for iteration on objects of class C.
CZipStreamDecompressor â zlib based decompression stream processor.
A very basic data-read interface.
std::ofstream out("events_result.xml")
main entry point for tests
void reset(element_type *p=0, EOwnership ownership=eTakeOwnership)
Reset will delete the old pointer (if owned), set content to the new value, and assume the ownership ...
#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.
element_type * get(void) const
Get pointer.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
element_type * release(void)
Release will release ownership of pointer to caller.
@ eTakeOwnership
An object can take ownership of another.
void AddFlag(const string &name, const string &comment, CBoolEnum< EFlagValue > set_value=eFlagHasValueIfSet, TFlags flags=0)
Add description for flag argument.
void SetConstraint(const string &name, const CArgAllow *constraint, EConstraintNegate negate=eConstraint)
Set additional user defined constraint on argument value.
void SetUsageContext(const string &usage_name, const string &usage_description, bool usage_sort_args=false, SIZE_TYPE usage_width=78)
Set extra info to be used by PrintUsage().
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 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.
@ 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)
@ eInteger
Convertible into an integer number (int or Int8)
char * CONN_Description(CONN conn)
Return a human-readable description of the connection as a character '\0'-terminated string.
EIO_Status CONN_Wait(CONN conn, EIO_Event event, const STimeout *timeout)
Block on the connection until it becomes available for either reading or writing (depending on "event...
I_DriverContext * GetDriverContext(const string &driver_name, string *err_msg=0, const map< string, string > *attr=0)
virtual EDB_ResType ResultType() const
Get type of the result.
virtual CDB_LangCmd * LangCmd(const string &lang_query)
Make language command.
virtual size_t ReadItem(void *buffer, size_t buffer_size, bool *is_null=0)
Read a result item body (for BLOB columns, mostly).
virtual CDB_RPCCmd * RPC(const string &rpc_name)
Make remote procedure call command.
void SetValue(const void *v, size_t v_size)
#define ERR_FATAL(message)
Posting fatal error and abort.
void SetDiagPostFlag(EDiagPostFlag flag)
Set the specified flag (globally).
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
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.
void Read(CObjectIStream &in, TObjectPtr object, const CTypeRef &type)
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
#define MSerial_AsnText
I/O stream manipulators â.
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
CBeginInfo Begin(C &obj)
Get starting point of object hierarchy.
void Read(const CObjectInfo &object)
Read object of know type.
virtual bool EndOfData(void)
Check if there is still some meaningful data that can be read; in text streams this function will ski...
CObjectTypeInfo GetMemberType(void) const
Get data type information.
TObjectPtr GetObjectPtr(void) const
Get pointer to object.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
virtual string ReadFileHeader(void)
Read file header.
const CObjectInfo & GetClassObject(void) const
Get containing class data.
void Write(const CConstObjectInfo &object)
TTypeInfo GetTypeInfo(void) const
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
void Copy(const CObjectTypeInfo &type)
Copy data.
virtual void ReadClassMember(CObjectIStream &in, const CObjectInfoMI &member)=0
This method will be called at approriate time when the object of requested type is to be read.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
EIO_Status SOCK_ShutdownAPI(void)
Cleanup; destroy all internal/system data & resources used by the SOCK API.
ERW_Result
Result codes for I/O operations.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
@ eRW_NotImplemented
Action / information is not available.
@ eRW_Eof
End of data, should be considered permanent.
@ eRW_Success
Everything is okay, I/O completed.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
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.
static CStringUTF8 SQLEncode(const CStringUTF8 &str, ESqlEncode flag)
SQL-encode string.
@ eSqlEnc_TagNonASCII
Produce N'...' when input's not pure ASCII.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
@ eStart
Start timer immediately after creating.
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)
void SetSerial_number(TSerial_number value)
Assign a value to Serial_number data member.
void SetSat_key(TSat_key value)
Assign a value to Sat_key data member.
bool IsSetSerial_number(void) const
request's serial number, can be used in asynchronic clients server should copy it to corresponding fi...
Tdata & Set(void)
Assign a value to data member.
list< CRef< CID2_Request > > Tdata
void SetSat(TSat value)
Assign a value to Sat data member.
void SetRequest(TRequest &value)
Assign a value to Request data member.
bool IsSetEnd_of_reply(void) const
true if this reply is the last one for the request false if more replies will follow Check if a value...
@ eData_type_id2s_split_info
@ eData_format_asn_binary
int main(int argc, const char *argv[])
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
static void text(MDB_val *v)
const struct ncbi::grid::netcache::search::fields::SIZE size
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_)
Reader-writer based streams.
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