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

Go to the SVN repository for this file.

1 /* $Id: indx_blk.h 103112 2024-09-10 13:39:01Z stakhovv $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
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  */
33 
34 #ifndef _INDEXBLOCK_
35 #define _INDEXBLOCK_
36 
37 #include "ftablock.h"
38 
40 
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 */
45 
47  line(0),
48  pos(0)
49  {
50  str[0] = 0;
51  }
52 };
53 
54 
55 struct IndBlkNode {
58 
60  ibp(ibp_),
61  next(nullptr)
62  {
63  }
64 };
66 
68 
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);
73 
75 bool GetAccession(const Parser* pp, string_view str, IndexblkPtr entry, unsigned skip);
76 // bool GetAccession(const Parser& parseInfo, const CTempString& str, IndexblkPtr entry, unsigned skip);
77 
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);
83 
84 // bool IsValidAccessPrefix(char* acc, char** accpref);
85 
86 void DelNoneDigitTail(char* str);
87 void DelNonDigitTail(string& str);
88 int fta_if_wgs_acc(string_view accession);
89 int CheckSTRAND(const string& str);
90 int CheckTPG(const string& str);
91 Int2 CheckDIV(const char* str);
92 Int4 IsNewAccessFormat(const char* acnum);
93 bool IsSPROTAccession(const char* acc);
94 Int2 XMLCheckSTRAND(string_view str);
95 Int2 XMLCheckTPG(string_view str);
96 Int2 CheckNADDBJ(const char* str);
97 Int2 CheckNA(const char* str);
98 
99 bool CkLocusLinePos(char* offset, Parser::ESource source, LocusContPtr lcp, bool is_mga);
100 
102 bool isSupportedAccession(objects::CSeq_id::E_Choice type);
103 objects::CSeq_id::E_Choice GetNucAccOwner(const CTempString& acc);
104 objects::CSeq_id::E_Choice GetProtAccOwner(const CTempString& acc);
105 // void FreeParser(ParserPtr pp);
107 
108 #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
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
CRef< objects::CDate_std > GetUpdateDate(const char *ptr, Parser::ESource source)
Definition: indx_blk.cpp:610
const Char ** GetAccArray(Parser::ESource source)
Definition: indx_blk.cpp:2207
bool SkipTitleBuf(FileBuf &fileBuf, FinfoBlk &finfo, const CTempString &keyword)
Definition: indx_blk.cpp:357
objects::CSeq_id::E_Choice GetProtAccOwner(const CTempString &acc)
Definition: indx_blk.cpp:2261
bool isSupportedAccession(objects::CSeq_id::E_Choice type)
int fta_if_wgs_acc(string_view accession)
Definition: indx_blk.cpp:1190
int CheckTPG(const string &str)
Definition: indx_blk.cpp:501
void ResetParserStruct(ParserPtr pp)
Definition: indx_blk.cpp:2087
Int2 CheckNA(const char *str)
Definition: indx_blk.cpp:525
bool XReadFileBuf(FileBuf &fileBuf, FinfoBlk &finfo)
Definition: indx_blk.cpp:313
int CheckSTRAND(const string &str)
Definition: indx_blk.cpp:466
IndexblkPtr InitialEntry(ParserPtr pp, FinfoBlk &finfo)
Definition: indx_blk.cpp:787
void MsgSkipTitleFail(const Char *flatfile, FinfoBlk &finfo)
Definition: indx_blk.cpp:2154
void DelNonDigitTail(string &str)
Definition: indx_blk.cpp:958
Int2 XMLCheckTPG(string_view str)
Definition: indx_blk.cpp:490
Int2 CheckDIV(const char *str)
Definition: indx_blk.cpp:531
bool FlatFileIndex(ParserPtr pp, void(*fun)(IndexblkPtr entry, char *offset, Int4 len))
Definition: indx_blk.cpp:2181
Int4 IsNewAccessFormat(const char *acnum)
Definition: indx_blk.cpp:992
bool GetAccession(const Parser *pp, string_view str, IndexblkPtr entry, unsigned skip)
Definition: indx_blk.cpp:1940
void CloseFiles(ParserPtr pp)
Definition: indx_blk.cpp:2139
bool IsSPROTAccession(const char *acc)
Definition: indx_blk.cpp:1254
bool FindNextEntryBuf(bool end_of_file, FileBuf &fileBuf, FinfoBlk &finfo, const CTempString &keyword)
Definition: indx_blk.cpp:2162
Int2 XMLCheckSTRAND(string_view str)
Definition: indx_blk.cpp:484
void DelNoneDigitTail(char *str)
Definition: indx_blk.cpp:944
bool CkLocusLinePos(char *offset, Parser::ESource source, LocusContPtr lcp, bool is_mga)
Definition: indx_blk.cpp:537
bool QSIndex(ParserPtr pp, IndBlkNextPtr ibnp)
Definition: block.cpp:202
Int2 CheckNADDBJ(const char *str)
Definition: indx_blk.cpp:519
objects::CSeq_id::E_Choice GetNucAccOwner(const CTempString &acc)
Definition: indx_blk.cpp:2244
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
FinfoBlk()
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 Fri Sep 20 14:57:03 2024 by modify_doxy.py rev. 669887