A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/id2__fetch__simple_8cpp_source.html below:

NCBI C++ ToolKit: src/app/id2_fetch/id2_fetch_simple.cpp Source File

87  virtual void Init

(

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"

,

157

arg_desc->

AddFlag

(

"verbose"

,

"Verbose output"

);

159

arg_desc->

AddFlag

(

"skip_data"

,

"Skip blob data"

);

161

arg_desc->

AddFlag

(

"copy_data"

,

"Copy blob data"

);

163

arg_desc->

AddFlag

(

"parse_data"

,

"Parse blob data"

);

165

arg_desc->

AddFlag

(

"pipe_data"

,

"Pipe parsing blob data"

);

168

arg_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"

,

214

arg_desc->

AddFlag

(

"HUP"

,

"Set cubby_user"

);

218

(

"count"

,

"Count"

,

219  "Repeat request number of times"

,

223  string

prog_description =

224  "Fetch SeqEntry from ID server by its GI id"

;

226

prog_description,

false

);

239

(server_name,

fSERV_Any

, 0, 0, &tmout));

244  LOG_POST

(

" connection description: "

<< descr);

256

args[

"packet"

]=

"3584"

;

257

args[

"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);

298

packet.

Set

().push_back(

Ref

(&req));

307  while

(

result

.Fetch() ) {

308  for

(

unsigned

pos = 0; pos <

result

.NofItems(); ++pos ) {

309  if

(

result

.ItemName(pos) == name ) {

339  if

( !sx_FetchNextItem(*

m_DB_Result

,

"asnout"

) ) {

369

id2_server_output << packet;

370

id2_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() ) {

410

dbr =

cmd

->Result();

414  if

( sx_FetchNextItem(*dbr,

"asnout"

) ) {

423  ERR_FATAL

(

"PubSeqOS: no more results"

);

429  class

COSSReader :

public IReader 432  typedef

vector<char> TOctetString;

433  typedef

list<TOctetString*> TOctetStringSequence;

435

COSSReader(

const

TOctetStringSequence&

in

)

437

m_CurVec(

in

.begin())

444  size_t

* bytes_read = 0)

446  size_t

pending = x_Pending();

449

*bytes_read =

count

;

451  if

( pending == 0 ) {

463  size_t

pending = x_Pending();

469  void

x_SetVec(

void

)

472

m_CurSize = m_CurVec == m_Input.end()? 0: (**m_CurVec).size();

474  size_t

x_Pending(

void

)

477  while

( (

size

= m_CurSize - m_CurPos) == 0 &&

478

m_CurVec != m_Input.end() ) {

485  const

TOctetStringSequence& m_Input;

486

TOctetStringSequence::const_iterator m_CurVec;

504  while

( (

count

= block.Read(

buf

,

sizeof

(

buf

))) != 0 ) {

513  class

COSSPipeReader :

public IReader 519

m_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  bool

x_OpenBlock(

void

) {

565  void

x_CloseBlock(

void

) {

566  if

( m_Block.get() ) {

569

m_Iter.NextElement();

590  switch

(

data

.GetData_type() ) {

592

obj_type = CSeq_entry::GetTypeInfo();

595

obj_type = CSeq_annot::GetTypeInfo();

598

obj_type = CID2S_Split_Info::GetTypeInfo();

601

obj_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"

);

623

COSSPipeReader reader(

in

, member);

627  switch

(

data

.GetData_compression() ) {

645  ERR_FATAL

(

"Unknown data compression in ID2_Reply_Data"

);

664

id2_server_input >> reply;

668

id2_server_input >> reply;

683

id2_server_input >> reply;

687

id2_server_input >> reply;

689  object

= hook->m_Object;

699

packet.

Set

().push_back(

Ref

(&request));

714  if

(

false

&&

dump

) {

717  LOG_POST

(

"\nProcessing request:\n"

<< ostr.rdbuf());

722  size_t

remaining_count = packet.

Set

().size();

726  double

time_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() ) {

776

obj_type = CSeq_entry::GetTypeInfo();

779

obj_type = CSeq_annot::GetTypeInfo();

782

obj_type = CID2S_Split_Info::GetTypeInfo();

785

obj_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"

);

807

COSSReader reader(

data

.GetData());

820

COSSReader reader(

data

.GetData());

824  switch

(

data

.GetData_compression() ) {

839  ERR_FATAL

(

"Unknown data compression in ID2_Reply_Data"

);

849

copier.

Copy

(obj_type);

854  if

( out_stream.

get

() ) {

870

out_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  typedef

vector<CRef<CID2_Request_Packet> > TReqs;

936  if

( args[

"gi"

] ) {

939

reqs.push_back(packet);

941

packet->Set().push_back(req);

943

req->

SetRequest

().SetGet_blob_info().SetBlob_id().SetResolve().

944

SetRequest().SetSeq_id().SetSeq_id().SetSeq_id().SetGi(gi);

945

req->

SetRequest

().SetGet_blob_info().SetGet_data();

947  else if

( args[

"id"

] ) {

950

reqs.push_back(packet);

952

packet->Set().push_back(req);

954

req->

SetRequest

().SetGet_blob_info().SetBlob_id().SetResolve().

955

SetRequest().SetSeq_id().SetSeq_id().SetSeq_id(*

id

);

956

req->

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"

]);

967

reqs.push_back(packet);

969

packet->Set().push_back(req);

971

req->

SetRequest

().SetGet_blob_info().SetBlob_id().SetBlob_id();

974

req->

SetRequest

().SetGet_blob_info().SetGet_data();

976  else if

( args[

"req"

] ) {

978

reqs.push_back(packet);

980

packet->Set().push_back(req);

982  string text

= args[

"req"

].AsString();

983  if

(

text

.find(

"::="

) ==

NPOS

) {

989  else if

( args[

"packet"

] ) {

991

reqs.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"

) {

1009

reqs.push_back(packet);

1011

packet->Set().push_back(req);

1016  else if

(

type

==

"ID2-Request-Packet"

) {

1018

reqs.push_back(packet);

1020

req_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

(

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.

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