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

Go to the SVN repository for this file.

1 #ifndef SRA__READER__SRA__KDBREAD__HPP
2 #define SRA__READER__SRA__KDBREAD__HPP
3 /* $Id: kdbread.hpp 97456 2022-07-19 17:56:42Z vasilche $
4  * ===========================================================================
5  *
6  * PUBLIC DOMAIN NOTICE
7  * National Center for Biotechnology Information
8  *
9  * This software/database is a "United States Government Work" under the
10  * terms of the United States Copyright Act. It was written as part of
11  * the author's official duties as a United States Government employee and
12  * thus cannot be copyrighted. This software/database is freely available
13  * to the public for use. The National Library of Medicine and the U.S.
14  * Government have not placed any restriction on its use or reproduction.
15  *
16  * Although all reasonable efforts have been taken to ensure the accuracy
17  * and reliability of the software and data, the NLM and the U.S.
18  * Government do not and cannot warrant the performance or results that
19  * may be obtained by using this software or data. The NLM and the U.S.
20  * Government disclaim all warranties, express or implied, including
21  * warranties of performance, merchantability or fitness for any particular
22  * purpose.
23  *
24  * Please cite the author in any work or product based on this material.
25  *
26  * ===========================================================================
27  *
28  * Authors: Eugene Vasilchenko
29  *
30  * File Description:
31  * Access to KDB files
32  *
33  */
34 
35 #include <corelib/ncbistd.hpp>
37 #include <sra/readers/sra/sdk.hpp>
38 
39 // SRA SDK structures
40 struct KTable;
41 struct KMetadata;
42 struct KMDataNode;
43 struct KNamelist;
44 
47 
48 
49 class CSeq_entry;
50 
51 DECLARE_SRA_REF_TRAITS(KTable, const);
52 DECLARE_SRA_REF_TRAITS(KMetadata, const);
53 DECLARE_SRA_REF_TRAITS(KMDataNode, const);
55 
56 
57 class CVDB;
58 class CVDBTable;
59 
61  : public CSraRef<const KTable>
62 {
63 public:
64  CKTable(const CVDBTable& table);
65 };
66 
67 
69  : public CSraRef<const KMetadata>
70 {
71 public:
72  explicit CKMetadata(const CKTable& table);
73  CKMetadata(const CVDB& db, const char* table_name);
74 
75 protected:
76  void x_Init(const CKTable& table);
77 };
78 
79 
81  : public CSraRef<const KMDataNode>
82 {
83 public:
84  enum EMissing {
86  eMissing_Allow
87  };
88 
89  CKMDataNode(const CKMetadata& meta,
90  const char* node_name,
91  EMissing missing = eMissing_Throw);
92  CKMDataNode(const CKMDataNode& parent,
93  const char* node_name,
94  EMissing missing = eMissing_Throw);
95 
96  // 'buffer' must be at least 'size' big, may be null if 'size' is 0
97  // 'size' is the requested number of bytes
98  // 'offset' is offset of returned data in the node
99  // returns pair of (actually read bytes, remaining bytes)
100  pair<size_t, size_t>
101  TryToGetData(char* buffer, size_t size, size_t offset = 0) const;
102  // the same as TryToGetData, but verifies that all requested data is read
103  void GetData(char* buffer, size_t size, size_t offset = 0) const;
104 
105  size_t GetSize(void) const {
106  return TryToGetData(NULL, 0, 0).second;
107  }
108 
109  Uint4 GetUint4(void) const;
110  Uint8 GetUint8(void) const;
111 };
112 
113 
115  : public CSraRef<KNamelist>
116 {
117 public:
118  explicit CKNameList(const CKMDataNode& parent);
119 
120  size_t size(void) const
121  {
122  return m_Size;
123  }
124 
125  const char* operator[](size_t index) const;
126 
127 protected:
129 };
130 
131 
134 
135 #endif // SRA__READER__SRA__KDBREAD__HPP
@ eMissing_Throw
Definition: kdbread.hpp:85
size_t GetSize(void) const
Definition: kdbread.hpp:105
size_t size(void) const
Definition: kdbread.hpp:120
uint32_t m_Size
Definition: kdbread.hpp:128
Definition: Seq_entry.hpp:56
Definition: sdk.hpp:85
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const char table_name[]
Definition: bcp.c:249
int offset
Definition: replacements.h:160
Uint4 uint32_t
#define NULL
Definition: ncbistd.hpp:225
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
uint64_t Uint8
8-byte (64-bit) unsigned integer
Definition: ncbitype.h:105
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
#define NCBI_SRAREAD_EXPORT
Definition: ncbi_export.h:1227
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
DECLARE_SRA_REF_TRAITS(KTable, const)
const struct ncbi::grid::netcache::search::fields::SIZE size
static uint8_t * buffer
Definition: pcre2test.c:1016
Modified on Fri Sep 20 14:57:26 2024 by modify_doxy.py rev. 669887