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

Go to the SVN repository for this file.

1 #ifndef OBJECTS_OBJMGR_IMPL___BIOSEQ_SET_INFO__HPP
2 #define OBJECTS_OBJMGR_IMPL___BIOSEQ_SET_INFO__HPP
3 
4 /* $Id: bioseq_set_info.hpp 95911 2022-01-14 15:54:47Z vasilche $
5 * ===========================================================================
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 *
29 * Author: Eugene Vasilchenko
30 *
31 * File Description:
32 * Seq_entry info -- entry for data source
33 *
34 */
35 
36 
41 #include <objects/general/Date.hpp>
42 #include <vector>
43 
46 
47 // forward declaration
48 class CBioseq_set;
49 class CSeq_entry_Info;
50 
51 ////////////////////////////////////////////////////////////////////
52 //
53 // CBioseq_set_Info::
54 //
55 // General information and indexes for Bioseq-set object
56 //
57 
58 
60 {
62 public:
63  // 'ctors
64  CBioseq_set_Info(void);
65  explicit CBioseq_set_Info(const CBioseq_set_Info& info,
66  TObjectCopyMap* copy_map);
67  explicit CBioseq_set_Info(CBioseq_set& seqset);
68  virtual ~CBioseq_set_Info(void);
69 
71 
72  CConstRef<TObject> GetCompleteBioseq_set(void) const;
73  CConstRef<TObject> GetBioseq_setCore(void) const;
74 
75  bool IsEmptySeq_set(void) const;
76 
77  // Bioseq-set access
78  typedef TObject::TId TId;
79  bool IsSetId(void) const;
80  bool CanGetId(void) const;
81  const TId& GetId(void) const;
82  void SetId(TId& v);
83  void ResetId(void);
84 
85  bool x_IsSetDescr(void) const;
86  bool x_CanGetDescr(void) const;
87  const TDescr& x_GetDescr(void) const;
88  TDescr& x_SetDescr(void);
89  void x_SetDescr(TDescr& v);
90  void x_ResetDescr(void);
91 
93  bool IsSetColl(void) const;
94  bool CanGetColl(void) const;
95  const TColl& GetColl(void) const;
96  void SetColl(TColl& v);
97  void ResetColl(void);
98 
100  bool IsSetLevel(void) const;
101  bool CanGetLevel(void) const;
102  TLevel GetLevel(void) const;
103  void SetLevel(TLevel v);
104  void ResetLevel(void);
105 
107  bool IsSetClass(void) const;
108  bool CanGetClass(void) const;
109  TClass GetClass(void) const;
110  void SetClass(TClass v);
111  void ResetClass(void);
112 
114  bool IsSetRelease(void) const;
115  bool CanGetRelease(void) const;
116  const TRelease& GetRelease(void) const;
117  void SetRelease(TRelease& v);
118  void ResetRelease(void);
119 
121  bool IsSetDate(void) const;
122  bool CanGetDate(void) const;
123  const TDate& GetDate(void) const;
124  void SetDate(TDate& v);
125  void ResetDate(void);
126 
127  typedef vector< CRef<CSeq_entry_Info> > TSeq_set;
128  bool IsSetSeq_set(void) const;
129  bool CanGetSeq_set(void) const;
130  const TSeq_set& GetSeq_set(void) const;
131  TSeq_set& SetSeq_set(void);
132 
133  // return first already loaded Seq-entry or null
134  CConstRef<CSeq_entry_Info> GetFirstEntry(void) const;
135 
136  CRef<CSeq_entry_Info> AddEntry(CSeq_entry& entry, int index, // index == -1 -> at the end
137  bool set_uniqid = false);
138  void AddEntry(CRef<CSeq_entry_Info> entry, int index = -1,
139  bool set_uniqid = false);
140  void RemoveEntry(CRef<CSeq_entry_Info> entry);
141  // returns -1 if entry is not found
142  int GetEntryIndex(const CSeq_entry_Info& entry) const;
143 
144  // initialization
145  // attaching/detaching to CDataSource (it's in CTSE_Info)
146  virtual void x_DSAttachContents(CDataSource& ds);
147  virtual void x_DSDetachContents(CDataSource& ds);
148 
149  void x_AddBioseqChunkId(TChunkId chunk_id);
150  const TChunkIds& x_GetBioseqChunkIds() const;
151 
152  // attaching/detaching to CTSE_Info
153  virtual void x_TSEAttachContents(CTSE_Info& tse);
154  virtual void x_TSEDetachContents(CTSE_Info& tse);
155 
156  // index
157  void UpdateAnnotIndex(void) const;
158  virtual void x_UpdateAnnotIndexContents(CTSE_Info& tse);
159 
160  // modification
161  void x_AttachEntry(CRef<CSeq_entry_Info> info);
162  void x_DetachEntry(CRef<CSeq_entry_Info> info);
163 
164  void x_SetChunkBioseqs(const list< CRef<CBioseq> >& bioseqs, int chunk_id);
165 
166 protected:
167  friend class CDataSource;
168  friend class CScope_Impl;
169 
170  friend class CTSE_Info;
171  friend class CSeq_entry_Info;
172  friend class CBioseq_Info;
173  friend class CSeq_annot_Info;
174 
175  friend class CSeq_entry_CI;
176  friend class CSeq_entry_I;
177  friend class CSeq_annot_CI;
178  friend class CSeq_annot_I;
179  friend class CAnnotTypes_CI;
180 
181  void x_DSAttachContents(void);
182  void x_DSDetachContents(void);
183 
184  void x_ParentAttach(CSeq_entry_Info& parent);
185  void x_ParentDetach(CSeq_entry_Info& parent);
186 
187  TObject& x_GetObject(void);
188  const TObject& x_GetObject(void) const;
189 
190  void x_SetObject(TObject& obj);
191  void x_SetObject(const CBioseq_set_Info& info, TObjectCopyMap* copy_map);
192 
193  void x_DSMapObject(CConstRef<TObject> obj, CDataSource& ds);
194  void x_DSUnmapObject(CConstRef<TObject> obj, CDataSource& ds);
195 
196  int x_GetBioseq_set_Id(const CObject_id& object_id);
197 
198  TObjAnnot& x_SetObjAnnot(void);
199  void x_ResetObjAnnot(void);
200 
202 
203  static CRef<TObject> sx_ShallowCopy(const TObject& obj);
204 
205  typedef pair<int, TChunkId> TChunkSeqSetsKey; // nucleotides first
206  void x_SetChunkBioseqs2(const list< CRef<CBioseq> >& bioseqs, TChunkSeqSetsKey key);
207 
208 private:
209  // core object
211 
212  // members
214 
215  struct SChunkSeqSet {
216  SChunkSeqSet() : count(0) {}
217 
218  size_t count;
219  CBioseq_set::TSeq_set::iterator first_iter;
220  };
223 
224  //
226 
227  // index information
229 };
230 
231 
232 
233 /////////////////////////////////////////////////////////////////////
234 //
235 // Inline methods
236 //
237 /////////////////////////////////////////////////////////////////////
238 
239 
240 inline
242 {
243  return *m_Object;
244 }
245 
246 
247 inline
249 {
250  return *m_Object;
251 }
252 
253 
254 inline
256 {
257  return m_Object->IsSetId();
258 }
259 
260 
261 inline
263 {
264  return m_Object && m_Object->CanGetId();
265 }
266 
267 
268 inline
270 {
271  m_Object->ResetId();
272 }
273 
274 
275 inline
277 {
278  return m_Object->GetId();
279 }
280 
281 
282 inline
284 {
285  m_Object->SetId(v);
286 }
287 
288 
289 inline
291 {
292  return m_Object->IsSetColl();
293 }
294 
295 
296 inline
298 {
299  return m_Object && m_Object->CanGetColl();
300 }
301 
302 
303 inline
305 {
306  m_Object->ResetColl();
307 }
308 
309 
310 inline
312 {
313  return m_Object->GetColl();
314 }
315 
316 
317 inline
319 {
320  m_Object->SetColl(v);
321 }
322 
323 
324 inline
326 {
327  return m_Object->IsSetLevel();
328 }
329 
330 
331 inline
333 {
334  return m_Object && m_Object->CanGetLevel();
335 }
336 
337 
338 inline
340 {
341  m_Object->ResetLevel();
342 }
343 
344 
345 inline
347 {
348  return m_Object->GetLevel();
349 }
350 
351 
352 inline
354 {
355  m_Object->SetLevel(v);
356 }
357 
358 
359 inline
361 {
362  return m_Object->IsSetClass();
363 }
364 
365 
366 inline
368 {
369  return m_Object && m_Object->CanGetClass();
370 }
371 
372 
373 inline
375 {
376  m_Object->ResetClass();
377 }
378 
379 
380 inline
382 {
383  return m_Object->GetClass();
384 }
385 
386 
387 inline
389 {
390  m_Object->SetClass(v);
391 }
392 
393 
394 inline
396 {
397  return m_Object->IsSetRelease();
398 }
399 
400 
401 inline
403 {
404  return m_Object && m_Object->CanGetRelease();
405 }
406 
407 
408 inline
410 {
411  m_Object->ResetRelease();
412 }
413 
414 
415 inline
417 {
418  return m_Object->GetRelease();
419 }
420 
421 
422 inline
424 {
425  m_Object->SetRelease(v);
426 }
427 
428 
429 inline
431 {
432  return m_Object->IsSetDate();
433 }
434 
435 
436 inline
438 {
439  return m_Object && m_Object->CanGetDate();
440 }
441 
442 
443 inline
445 {
446  m_Object->ResetDate();
447 }
448 
449 
450 inline
452 {
453  return m_Object->GetDate();
454 }
455 
456 
457 inline
459 {
460  m_Object->SetDate(v);
461 }
462 
463 
464 inline
466 {
467  return m_Object->IsSetSeq_set() || x_NeedUpdate(fNeedUpdate_bioseq);
468 }
469 
470 
471 inline
473 {
474  return m_Object &&
475  (m_Object->CanGetSeq_set() || x_NeedUpdate(fNeedUpdate_bioseq));
476 }
477 
478 
479 inline
481 {
483  return m_Seq_set;
484 }
485 
486 
487 inline
489 {
491  return m_Seq_set;
492 }
493 
494 
495 inline
497 {
498  return !x_NeedUpdate(fNeedUpdate_bioseq) &&
499  (!IsSetSeq_set() || GetSeq_set().empty());
500 }
501 
502 
505 
506 #endif//OBJECTS_OBJMGR_IMPL___BIOSEQ_SET_INFO__HPP
virtual bool x_CanGetDescr(void) const =0
virtual void x_ParentAttach(CSeq_entry_Info &parent)
virtual void x_TSEAttachContents(CTSE_Info &tse)
virtual TDescr & x_SetDescr(void)=0
virtual void x_ResetObjAnnot(void)=0
virtual void x_TSEDetachContents(CTSE_Info &tse)
virtual void x_ParentDetach(CSeq_entry_Info &parent)
virtual bool x_IsSetDescr(void) const =0
virtual void x_DSDetachContents(CDataSource &ds)
void x_DoUpdate(TNeedUpdateFlags flags)
virtual void x_DSAttachContents(CDataSource &ds)
void x_UpdateAnnotIndexContents(CTSE_Info &tse)
virtual void x_ResetDescr(void)=0
virtual TObjAnnot & x_SetObjAnnot(void)=0
virtual const TDescr & x_GetDescr(void) const =0
list< CRef< CSeq_annot > > TObjAnnot
const TDate & GetDate(void) const
bool IsSetClass(void) const
TSeq_set & SetSeq_set(void)
map< TChunkSeqSetsKey, SChunkSeqSet > TChunkSeqSets
void SetLevel(TLevel v)
const TRelease & GetRelease(void) const
const TSeq_set & GetSeq_set(void) const
void SetColl(TColl &v)
TObject::TDate TDate
bool IsEmptySeq_set(void) const
bool CanGetClass(void) const
void x_DSAttachContents(void)
bool CanGetLevel(void) const
bool CanGetRelease(void) const
bool IsSetSeq_set(void) const
bool IsSetDate(void) const
CBioseq_set_Info(CBioseq_set &seqset)
void SetRelease(TRelease &v)
TChunkSeqSets m_ChunkSeqSets
TObject::TColl TColl
TObject & x_GetObject(void)
TObject::TLevel TLevel
TObject::TRelease TRelease
void SetClass(TClass v)
bool CanGetColl(void) const
void SetDate(TDate &v)
TClass GetClass(void) const
vector< CRef< CSeq_entry_Info > > TSeq_set
bool IsSetId(void) const
bool IsSetLevel(void) const
pair< int, TChunkId > TChunkSeqSetsKey
bool CanGetDate(void) const
void x_DSDetachContents(void)
const TColl & GetColl(void) const
TObject::TClass TClass
bool CanGetId(void) const
bool IsSetColl(void) const
bool CanGetSeq_set(void) const
TLevel GetLevel(void) const
CBioseq_Base_Info TParent
const TId & GetId(void) const
bool IsSetRelease(void) const
CRef< TObject > m_Object
Definition: Date.hpp:53
Definition: Dbtag.hpp:53
CRef –.
Definition: ncbiobj.hpp:618
CSeq_annot_CI –.
@Seq_descr.hpp User-defined methods of the data storage class.
Definition: Seq_descr.hpp:55
CSeq_entry_CI –.
CSeq_entry_I –.
Definition: Seq_entry.hpp:56
bool x_NeedUpdate(ENeedUpdate flag) const
void x_Update(TNeedUpdateFlags flags) const
vector< TChunkId > TChunkIds
Definition: map.hpp:338
static uch flags
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
#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_XOBJMGR_EXPORT
Definition: ncbi_export.h:1307
static MDB_envinfo info
Definition: mdb_load.c:37
const struct ncbi::grid::netcache::search::fields::KEY key
CBioseq_set::TSeq_set::iterator first_iter
Modified on Thu Jun 06 15:44:49 2024 by modify_doxy.py rev. 669887