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

Go to the SVN repository for this file.

1 #ifndef BLOB_ID__HPP_INCLUDED
2 #define BLOB_ID__HPP_INCLUDED
3 /* */
4 
5 /* $Id: blob_id.hpp 102226 2024-04-09 17:27:24Z vasilche $
6 * ===========================================================================
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 * ===========================================================================
27 *
28 * Author: Eugene Vasilchenko
29 *
30 * File Description: Loaded Blob ID
31 *
32 */
33 
34 #include <corelib/ncbiobj.hpp>
35 #include <utility>
36 #include <string>
37 #include <objmgr/blob_id.hpp>
38 
41 
43 {
44 public:
45  CBlob_id(void)
46  : m_Sat(-1), m_SubSat(0), m_SatKey(0)
47  {
48  }
49 
50  explicit CBlob_id(CTempString str_id);
51 
52  typedef Int4 TSat;
53  typedef Int4 TSubSat;
54  typedef Int4 TSatKey;
55 
56  TSat GetSat() const
57  {
58  return m_Sat;
59  }
61  {
62  return m_SubSat;
63  }
65  {
66  return m_SatKey;
67  }
68 
69  CNcbiOstream& Dump(CNcbiOstream& ostr) const;
70  string ToString(void) const;
71  string ToPsgId(void) const;
72  static CBlob_id* CreateFromString(const string& str);
73 
74  bool operator<(const CBlobId& blob_id) const;
75  bool operator==(const CBlobId& blob_id) const;
76 
77  bool operator<(const CBlob_id& blob_id) const
78  {
79  if ( m_Sat != blob_id.m_Sat )
80  return m_Sat < blob_id.m_Sat;
81  if ( m_SubSat != blob_id.m_SubSat )
82  return m_SubSat < blob_id.m_SubSat;
83  return m_SatKey < blob_id.m_SatKey;
84  }
85  bool operator==(const CBlob_id& blob_id) const
86  {
87  return m_SatKey == blob_id.m_SatKey &&
88  m_Sat == blob_id.m_Sat && m_SubSat == blob_id.m_SubSat;
89  }
90  bool operator!=(const CBlob_id& blob_id) const
91  {
92  return !(*this == blob_id);
93  }
94 
95  bool IsEmpty(void) const
96  {
97  return m_Sat < 0;
98  }
99 
100  bool IsMainBlob(void) const
101  {
102  return m_SubSat == 0;
103  }
104 
105  void SetSat(TSat v)
106  {
107  m_Sat = v;
108  }
110  {
111  m_SubSat = v;
112  }
114  {
115  m_SatKey = v;
116  }
117 
118  const string& GetTSEName() const
119  {
120  return m_TSEName;
121  }
122  bool HasTSEName() const
123  {
124  return !m_TSEName.empty();
125  }
126  void SetTSEName(const string& name)
127  {
128  m_TSEName = name;
129  }
130 
131 protected:
135  string m_TSEName;
136 };
137 
138 
139 inline CNcbiOstream& operator<<(CNcbiOstream& ostr, const CBlob_id& id)
140 {
141  return id.Dump(ostr);
142 }
143 
144 
145 typedef int TChunkId;
146 enum {
147  kMain_ChunkId = -1, // not a chunk, but main Seq-entry
148  kMasterWGS_ChunkId = kMax_Int-1, // chunk with master WGS descr
149  kDelayedMain_ChunkId= kMax_Int // main Seq-entry with delayed ext annot
150 };
151 
152 
154 {
155  fBlobHasCore = 1 << 0,
156  fBlobHasDescr = 1 << 1,
157  fBlobHasSeqMap = 1 << 2,
158  fBlobHasSeqData = 1 << 3,
159  fBlobHasIntFeat = 1 << 4,
160  fBlobHasExtFeat = 1 << 5,
165  fBlobHasIntGraph = 1 << 10,
166  fBlobHasExtGraph = 1 << 11,
168  fBlobHasNamedFeat = 1 << 13,
171 
199 
200  fBlobHasAll = (1 << 16)-1
201 };
202 typedef int TBlobContentsMask;
203 
204 
209 };
210 
211 
214 
215 #endif//BLOB_ID__HPP_INCLUDED
void SetSubSat(TSubSat v)
Definition: blob_id.hpp:109
TSat GetSat() const
Definition: blob_id.hpp:56
TSatKey m_SatKey
Definition: blob_id.hpp:134
Int4 TSatKey
Definition: blob_id.hpp:54
bool IsEmpty(void) const
Definition: blob_id.hpp:95
void SetTSEName(const string &name)
Definition: blob_id.hpp:126
bool IsMainBlob(void) const
Definition: blob_id.hpp:100
TSatKey GetSatKey() const
Definition: blob_id.hpp:64
bool operator<(const CBlob_id &blob_id) const
Definition: blob_id.hpp:77
bool operator!=(const CBlob_id &blob_id) const
Definition: blob_id.hpp:90
string m_TSEName
Definition: blob_id.hpp:135
void SetSatKey(TSatKey v)
Definition: blob_id.hpp:113
TSat m_Sat
Definition: blob_id.hpp:132
Int4 TSat
Definition: blob_id.hpp:52
Int4 TSubSat
Definition: blob_id.hpp:53
const string & GetTSEName() const
Definition: blob_id.hpp:118
bool HasTSEName() const
Definition: blob_id.hpp:122
bool operator==(const CBlob_id &blob_id) const
Definition: blob_id.hpp:85
TSubSat GetSubSat() const
Definition: blob_id.hpp:60
CBlob_id(void)
Definition: blob_id.hpp:45
void SetSat(TSat v)
Definition: blob_id.hpp:105
TSubSat m_SubSat
Definition: blob_id.hpp:133
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
bool operator<(const CEquivRange &A, const CEquivRange &B)
bool operator==(const CEquivRange &A, const CEquivRange &B)
static const char * str(char *buf, int n)
Definition: stats.c:84
CNcbiOstream & operator<<(CNcbiOstream &out, const CBlobId &id)
Definition: blob_id.hpp:200
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
#define kMax_Int
Definition: ncbi_limits.h:184
#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
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
#define NCBI_XREADER_EXPORT
Definition: ncbi_export.h:1371
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
int TBlobContentsMask
Definition: blob_id.hpp:202
EGBErrorAction
Definition: blob_id.hpp:205
@ eGBErrorAction_ignore
Definition: blob_id.hpp:206
@ eGBErrorAction_report
Definition: blob_id.hpp:207
@ eGBErrorAction_throw
Definition: blob_id.hpp:208
@ kMain_ChunkId
Definition: blob_id.hpp:147
@ kDelayedMain_ChunkId
Definition: blob_id.hpp:149
@ kMasterWGS_ChunkId
Definition: blob_id.hpp:148
int TChunkId
Definition: blob_id.hpp:145
EBlobContentsMask
Definition: blob_id.hpp:154
@ fBlobHasAnyFeat
Definition: blob_id.hpp:184
@ fBlobHasSeqData
Definition: blob_id.hpp:158
@ fBlobHasNamedFeat
Definition: blob_id.hpp:168
@ fBlobHasNamedAnnot
Definition: blob_id.hpp:178
@ fBlobHasOrphanFeat
Definition: blob_id.hpp:161
@ fBlobHasCore
Definition: blob_id.hpp:155
@ fBlobHasExtGraph
Definition: blob_id.hpp:166
@ fBlobHasIntAnnot
Definition: blob_id.hpp:172
@ fBlobHasAll
Definition: blob_id.hpp:200
@ fBlobHasOrphanAlign
Definition: blob_id.hpp:164
@ fBlobHasAnyAlign
Definition: blob_id.hpp:188
@ fBlobHasExtFeat
Definition: blob_id.hpp:160
@ fBlobHasOrphanGraph
Definition: blob_id.hpp:167
@ fBlobHasOrphanAnnot
Definition: blob_id.hpp:181
@ fBlobHasExtAnnot
Definition: blob_id.hpp:175
@ fBlobHasIntAlign
Definition: blob_id.hpp:162
@ fBlobHasIntFeat
Definition: blob_id.hpp:159
@ fBlobHasAllLocal
Definition: blob_id.hpp:196
@ fBlobHasAnyGraph
Definition: blob_id.hpp:192
@ fBlobHasNamedAlign
Definition: blob_id.hpp:169
@ fBlobHasIntGraph
Definition: blob_id.hpp:165
@ fBlobHasSeqMap
Definition: blob_id.hpp:157
@ fBlobHasExtAlign
Definition: blob_id.hpp:163
@ fBlobHasNamedGraph
Definition: blob_id.hpp:170
@ fBlobHasDescr
Definition: blob_id.hpp:156
void Dump(CSplitCacheApp *app, const C &obj, ESerialDataFormat format, const string &key, const string &suffix=kEmptyStr)
string ToString(const wxRect &rc)
Definition: wx_utils.cpp:773
Modified on Fri Sep 20 14:57:55 2024 by modify_doxy.py rev. 669887