NCBI C++ ToolKit
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: indx_blk.h 102062 2024-03-25 10:10:54Z stakhovv $
2  * ===========================================================================
3  *
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * File Name: indx_blk.h
27  *
28  * Author: Karl Sirotkin, Hsiu-Chuan Chen
29  *
30  * File Description:
31  *
32  */
34 #ifndef _INDEXBLOCK_
35 #define _INDEXBLOCK_
37 #include "ftablock.h"
41 struct FinfoBlk {
42  Char str[256]; /* the current string data */
43  Int4 line; /* the current line number */
44  size_t pos; /* the current file position */
47  line(0),
48  pos(0)
49  {
50  str[0] = 0;
51  }
52 };
55 struct IndBlkNode {
60  ibp(ibp_),
61  next(nullptr)
62  {
63  }
64 };
69 /**********************************************************/
70 bool XReadFileBuf(FileBuf& fileBuf, FinfoBlk& finfo);
71 bool SkipTitleBuf(FileBuf& fileBuf, FinfoBlk& finfo, const CTempString& keyword);
72 bool FindNextEntryBuf(bool end_of_file, FileBuf& fileBuf, FinfoBlk& finfo, const CTempString& keyword);
75 bool GetAccession(ParserPtr pp, const char* str, IndexblkPtr entry, unsigned skip);
76 // bool GetAccession(const Parser& parseInfo, const CTempString& str, IndexblkPtr entry, unsigned skip);
78 void CloseFiles(ParserPtr pp);
79 void MsgSkipTitleFail(const Char* flatfile, FinfoBlk& finfo);
80 bool FlatFileIndex(ParserPtr pp, void (*fun)(IndexblkPtr entry, char* offset, Int4 len));
82 bool QSIndex(ParserPtr pp, IndBlkNextPtr ibnp);
84 // bool IsValidAccessPrefix(char* acc, char** accpref);
86 void DelNoneDigitTail(char* str);
87 int fta_if_wgs_acc(const CTempString& accession);
88 int CheckSTRAND(const string& str);
89 int CheckTPG(const string& str);
90 Int2 CheckDIV(const char* str);
91 Int4 IsNewAccessFormat(const char* acnum);
92 bool IsSPROTAccession(const char* acc);
93 Int2 XMLCheckSTRAND(const char* str);
94 Int2 XMLCheckTPG(const char* str);
95 Int2 CheckNADDBJ(const char* str);
96 Int2 CheckNA(const char* str);
98 bool CkLocusLinePos(char* offset, Parser::ESource source, LocusContPtr lcp, bool is_mga);
101 bool isSupportedAccession(objects::CSeq_id::E_Choice type);
102 objects::CSeq_id::E_Choice GetNucAccOwner(const CTempString& acc);
103 objects::CSeq_id::E_Choice GetProtAccOwner(const CTempString& acc);
104 // void FreeParser(ParserPtr pp);
107 #endif
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
static const char * str(char *buf, int n)
Definition: stats.c:84
int offset
Definition: replacements.h:160
int16_t Int2
2-byte (16-bit) signed integer
Definition: ncbitype.h:100
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
char Char
Alias for char.
Definition: ncbitype.h:93
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
Define ncbi namespace.
Definition: ncbistl.hpp:100
CRef< objects::CDate_std > GetUpdateDate(const char *ptr, Parser::ESource source)
Definition: indx_blk.cpp:611
const Char ** GetAccArray(Parser::ESource source)
Definition: indx_blk.cpp:2234
bool SkipTitleBuf(FileBuf &fileBuf, FinfoBlk &finfo, const CTempString &keyword)
Definition: indx_blk.cpp:358
objects::CSeq_id::E_Choice GetProtAccOwner(const CTempString &acc)
Definition: indx_blk.cpp:2288
bool isSupportedAccession(objects::CSeq_id::E_Choice type)
Int2 XMLCheckSTRAND(const char *str)
Definition: indx_blk.cpp:485
int CheckTPG(const string &str)
Definition: indx_blk.cpp:502
bool GetAccession(ParserPtr pp, const char *str, IndexblkPtr entry, unsigned skip)
Definition: indx_blk.cpp:1940
void ResetParserStruct(ParserPtr pp)
Definition: indx_blk.cpp:2114
Int2 CheckNA(const char *str)
Definition: indx_blk.cpp:526
bool XReadFileBuf(FileBuf &fileBuf, FinfoBlk &finfo)
Definition: indx_blk.cpp:314
int CheckSTRAND(const string &str)
Definition: indx_blk.cpp:467
IndexblkPtr InitialEntry(ParserPtr pp, FinfoBlk &finfo)
Definition: indx_blk.cpp:788
void MsgSkipTitleFail(const Char *flatfile, FinfoBlk &finfo)
Definition: indx_blk.cpp:2181
Int2 CheckDIV(const char *str)
Definition: indx_blk.cpp:532
bool FlatFileIndex(ParserPtr pp, void(*fun)(IndexblkPtr entry, char *offset, Int4 len))
Definition: indx_blk.cpp:2208
Int4 IsNewAccessFormat(const char *acnum)
Definition: indx_blk.cpp:995
void CloseFiles(ParserPtr pp)
Definition: indx_blk.cpp:2166
bool IsSPROTAccession(const char *acc)
Definition: indx_blk.cpp:1261
int fta_if_wgs_acc(const CTempString &accession)
Definition: indx_blk.cpp:1193
bool FindNextEntryBuf(bool end_of_file, FileBuf &fileBuf, FinfoBlk &finfo, const CTempString &keyword)
Definition: indx_blk.cpp:2189
void DelNoneDigitTail(char *str)
Definition: indx_blk.cpp:946
bool CkLocusLinePos(char *offset, Parser::ESource source, LocusContPtr lcp, bool is_mga)
Definition: indx_blk.cpp:538
bool QSIndex(ParserPtr pp, IndBlkNextPtr ibnp)
Definition: block.cpp:207
Int2 XMLCheckTPG(const char *str)
Definition: indx_blk.cpp:491
Int2 CheckNADDBJ(const char *str)
Definition: indx_blk.cpp:520
objects::CSeq_id::E_Choice GetNucAccOwner(const CTempString &acc)
Definition: indx_blk.cpp:2271
int len
const CharType(& source)[N]
Definition: pointer.h:1149
#define nullptr
Definition: ncbimisc.hpp:45
Char str[256]
Definition: indx_blk.h:42
size_t pos
Definition: indx_blk.h:44
Definition: indx_blk.h:46
Int4 line
Definition: indx_blk.h:43
Indexblk * ibp
Definition: indx_blk.h:56
IndBlkNode * next
Definition: indx_blk.h:57
IndBlkNode(Indexblk *ibp_)
Definition: indx_blk.h:59
Definition: type.c:6
Modified on Sun Apr 14 05:25:48 2024 by rev. 669887