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

Go to the SVN repository for this file.

1 #ifndef ENTRY_H
2 #define ENTRY_H
3 
4 #include <objects/seq/Bioseq.hpp>
5 
6 #include "ftablock.h"
7 #include "entry.h"
9 
10 // ============================================================================
11 struct Section
12 // ============================================================================
13 {
15  int type_,
16  const vector<string>& textLines) :
17  mType(type_),
18  mTextLines(textLines.begin(), textLines.end()),
20  mDrop(0){};
21 
23  {
24  delete[] mpQscore;
25  for (auto subStr : mSubSections) {
26  delete subStr;
27  }
28  }
29 
30  void DumpText(ostream& ostr) const
31  {
32  ostr << NStr::Join(mTextLines, "\n");
33  ostr << endl
34  << endl;
35  for (auto subPtr : mSubSections) {
36  for (auto line : subPtr->mTextLines) {
37  ostr << ">> " << line << endl;
38  }
39  ostr << endl
40  << endl;
41  }
42  }
43 
44  void xBuildSubBlock(int subtype, const char* subKw);
45  void xBuildFeatureBlocks();
46 
47  int mType; // which keyword block or node type
48  vector<string> mTextLines;
49  vector<Section*> mSubSections;
50  char* mpQscore; // points to quality score buffer
51  bool mDrop;
52 };
54 
55 
56 // ============================================================================
57 struct Entry {
58  // ============================================================================
59 
61  ParserPtr pp,
62  const char* baseData) :
63  mPp(pp),
64  mBaseData(baseData)
65  {
66  }
67 
69  {
70  for (auto sectionPtr : mSections) {
71  delete sectionPtr;
72  }
73  };
74 
76  {
77  for (auto secPtr : mSections) {
78  if (secPtr->mType == type) {
79  return secPtr;
80  }
81  }
82  return nullptr;
83  }
84 
86  {
87  if (secPtr) {
88  mSections.push_back(secPtr);
89  }
90  }
91 
92  bool IsAA() const;
93 
94  bool xInitNidSeqId(objects::CBioseq&, int type, int dataOffset, Parser::ESource);
95  bool xInitSeqInst(const unsigned char* pConvert);
96 
98  string mBaseData;
99  list<SectionPtr> mSections;
101 };
102 using EntryPtr = Entry*;
103 
104 
105 DataBlkPtr LoadEntry(ParserPtr pp, size_t offset, size_t len);
106 EntryPtr LoadEntryGenbank(ParserPtr pp, size_t offset, size_t len);
107 
109 
110 #endif // ENTRY_H
EntryPtr LoadEntryGenbank(ParserPtr pp, size_t offset, size_t len)
Definition: entry.cpp:217
DataBlkPtr LoadEntry(ParserPtr pp, size_t offset, size_t len)
Definition: entry.cpp:300
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
Definition: ncbistr.hpp:2697
int len
#define nullptr
Definition: ncbimisc.hpp:45
int offset
Definition: replacements.h:160
Definition: entry.h:57
list< SectionPtr > mSections
Definition: entry.h:99
bool xInitSeqInst(const unsigned char *pConvert)
Definition: entry.cpp:155
string mBaseData
Definition: entry.h:98
bool xInitNidSeqId(objects::CBioseq &, int type, int dataOffset, Parser::ESource)
Definition: entry.cpp:131
CRef< objects::CSeq_entry > mSeqEntry
Definition: entry.h:100
SectionPtr GetFirstSectionOfType(int type)
Definition: entry.h:75
ParserPtr mPp
Definition: entry.h:97
bool IsAA() const
Definition: entry.cpp:145
~Entry()
Definition: entry.h:68
Entry(ParserPtr pp, const char *baseData)
Definition: entry.h:60
void AppendSection(SectionPtr secPtr)
Definition: entry.h:85
Definition: entry.h:13
Section(int type_, const vector< string > &textLines)
Definition: entry.h:14
char * mpQscore
Definition: entry.h:50
void xBuildSubBlock(int subtype, const char *subKw)
Definition: entry.cpp:56
void DumpText(ostream &ostr) const
Definition: entry.h:30
bool mDrop
Definition: entry.h:51
int mType
Definition: entry.h:47
vector< Section * > mSubSections
Definition: entry.h:49
vector< string > mTextLines
Definition: entry.h:48
void xBuildFeatureBlocks()
Definition: entry.cpp:86
~Section()
Definition: entry.h:22
Definition: type.c:6
Modified on Sun Mar 03 03:16:52 2024 by modify_doxy.py rev. 669887