|
NCBI C++ ToolKit
|
Implementations of this interface should provide life-cycle functions as well as functions which satisfy the BlastSeqSrc interface.
These functions must have C linkage, as these functions are invoked by the BlastSeqSrc framework. An initialization function must also be provided, this is intended to be invoked by client code which wants to use a specific BlastSeqSrc implementation through the BlastSeqSrc interface. For example, MyDatabaseFormat implementation would define the following functions:
// Calls BlastSeqSrcNew in behalf of client code, client should free using // BlastSeqSrcFree BlastSeqSrc* MyDatabaseFormatBlastSeqSrcInit(...);
extern "C" { // required signature: BlastSeqSrcConstructor BlastSeqSrc* MyDatabaseFormatNew(BlastSeqSrc*, void*); // required signature: BlastSeqSrcDestructor BlastSeqSrc* MyDatabaseFormatFree(BlastSeqSrc*); // required signature: BlastSeqSrcCopier BlastSeqSrc* MyDatabaseFormatCopy(BlastSeqSrc*); }
extern "C" { // required signature: SetInt4FnPtr void MyDatabaseFormatSetNumberOfThreads(int); // required signature: GetInt4FnPtr Int4 MyDatabaseFormatGetNumSeqs(void*, void*); // required signature: GetInt4FnPtr Int4 MyDatabaseFormatGetNumSeqsStats(void*, void*); // required signature: GetInt4FnPtr Int4 MyDatabaseFormatGetMaxSeqLen(void*, void*); // required signature: GetInt4FnPtr Int4 MyDatabaseFormatGetMinSeqLen(void*, void*); // required signature: GetInt4FnPtr Int4 MyDatabaseFormatGetAvgSeqLen(void*, void*); // required signature: GetInt8FnPtr Int8 MyDatabaseFormatGetTotLen(void*, void*); // required signature: GetInt8FnPtr Int8 MyDatabaseFormatGetTotLenStats(void*, void*); // required signature: GetStrFnPtr const char* MyDatabaseFormatGetName(void*, void*); // required signature: GetBoolFnPtr Boolean MyDatabaseFormatGetIsProt(void*, void*); // required signature: GetSeqBlkFnPtr Int2 MyDatabaseFormatGetSequence(void*, BlastSeqSrcGetSeqArg*); // required signature: GetInt4FnPtr Int4 MyDatabaseFormatGetSeqLen(void*, void*); // required signature: ReleaseSeqBlkFnPtr void MyDatabaseFormatReleaseSequence(void*, BlastSeqSrcGetSeqArg*); // required signature: AdvanceIteratorFnPtr Int4 MyDatabaseFormatItrNext(void*, BlastSeqSrcIterator* itr); // required signature: ResetChunkIteratorFnPtr Int4 MyDatabaseFormatResetChunkIterator(void*); }
Since the life-cycle and BlastSeqSrc interface functions above are called by the BlastSeqSrc framework (BlastSeqSrc* functions declared in blast_seqsrc.h), no exceptions should be thrown in C++ implementations. When not obvious, please see the required signature's documentation for determining what to implement (see blast_seqsrc_impl.h).
For ease of maintenance, please follow the following conventions:
XBlastSeqSrcInit, where X is the name of the implementationseqsrc_X.[hc] or seqsrc_X.[ch]pp, where X is the name of the implementation.
1.7.5.1
Modified on Wed May 23 12:54:33 2012 by modify_doxy.py rev. 337098