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

Go to the SVN repository for this file.

1 #ifndef OBJECTS_OBJMGR_IMPL___BIOSEQ_BASE_INFO__HPP
2 #define OBJECTS_OBJMGR_IMPL___BIOSEQ_BASE_INFO__HPP
3 
4 /* $Id: bioseq_base_info.hpp 100100 2023-06-15 14:04:06Z 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: Aleksey Grichenko, Eugene Vasilchenko
30  *
31  * File Description:
32  * Bioseq info for data source
33  *
34  */
35 
36 #include <corelib/ncbiobj.hpp>
37 #include <corelib/ncbimtx.hpp>
39 
42 
43 #include <vector>
44 #include <list>
45 
48 
49 class CDataSource;
50 class CTSE_Info;
51 class CSeq_entry;
52 class CSeq_entry_Info;
53 class CSeq_annot;
54 class CSeq_annot_Info;
55 class CSeq_descr;
56 class CSeqdesc;
57 
58 // ID-5570 : Set of user object names
60 
61 ////////////////////////////////////////////////////////////////////
62 //
63 // CBioseq_Info::
64 //
65 // Structure to keep bioseq's parent seq-entry along with the list
66 // of seq-id synonyms for the bioseq.
67 //
68 
69 
71 {
73 public:
74  // 'ctors
75  CBioseq_Base_Info(void);
76  CBioseq_Base_Info(const CBioseq_Base_Info& src, TObjectCopyMap* copy_map);
77  virtual ~CBioseq_Base_Info(void);
78 
79  // info tree
80  const CSeq_entry_Info& GetParentSeq_entry_Info(void) const;
81  CSeq_entry_Info& GetParentSeq_entry_Info(void);
82 
83  // member modification
84  // descr
85  typedef CSeq_descr TDescr;
86  bool IsSetDescr(void) const;
87  bool CanGetDescr(void) const;
88  const TDescr& GetDescr(void) const;
89  TDescr& SetDescr(void);
90  void SetDescr(TDescr& v);
91  void ResetDescr(void);
92  bool AddSeqdesc(CSeqdesc& d);
93  CRef<CSeqdesc> RemoveSeqdesc(const CSeqdesc& d);
94  CRef<CSeqdesc> ReplaceSeqdesc(const CSeqdesc& old_desc, CSeqdesc& new_desc);
95  void AddSeq_descr(const TDescr& v);
96 
97  virtual bool x_IsSetDescr(void) const = 0;
98  virtual bool x_CanGetDescr(void) const = 0;
99  virtual const TDescr& x_GetDescr(void) const = 0;
100  virtual TDescr& x_SetDescr(void) = 0;
101  virtual void x_SetDescr(TDescr& v) = 0;
102  virtual void x_ResetDescr(void) = 0;
103 
104  // low level access for CSeqdesc_CI in case sequence is split
106  typedef TDescList::const_iterator TDesc_CI;
107  typedef unsigned TDescTypeMask;
108 
109  const TDescList& x_GetDescList(void) const;
110  TDesc_CI x_GetFirstDesc(TDescTypeMask types) const;
111  TDesc_CI x_GetNextDesc(TDesc_CI iter, TDescTypeMask types) const;
112  bool x_IsEndDesc(TDesc_CI iter) const;
113 
114  const CSeqdesc* x_SearchFirstDesc(TDescTypeMask type) const;
115 
116  TDescTypeMask x_GetExistingDescrMask(void) const;
117 
118  void x_AddExistingUserObjectTypes(TUserObjectTypesSet& uo_types) const;
119 
120  // annot
121  typedef vector< CRef<CSeq_annot_Info> > TAnnot;
122  typedef list< CRef<CSeq_annot> > TObjAnnot;
123  bool IsSetAnnot(void) const;
124  bool HasAnnots(void) const;
125  const TAnnot& GetAnnot(void) const;
126  const TAnnot& GetLoadedAnnot(void) const;
127 
128  void ResetAnnot(void);
129  CRef<CSeq_annot_Info> AddAnnot(CSeq_annot& annot, int chunk_id = 0);
130  void AddAnnot(CRef<CSeq_annot_Info> annot);
131  void RemoveAnnot(CRef<CSeq_annot_Info> annot);
132 
133  // object initialization
134  void x_AttachAnnot(CRef<CSeq_annot_Info> info);
135  void x_DetachAnnot(CRef<CSeq_annot_Info> info);
136 
137  // info tree initialization
138  virtual void x_DSAttachContents(CDataSource& ds);
139  virtual void x_DSDetachContents(CDataSource& ds);
140 
141  virtual void x_TSEAttachContents(CTSE_Info& tse);
142  virtual void x_TSEDetachContents(CTSE_Info& tse);
143 
144  virtual void x_ParentAttach(CSeq_entry_Info& parent);
145  virtual void x_ParentDetach(CSeq_entry_Info& parent);
146 
147  // index support
149 
150  void x_SetAnnot(void);
151  void x_SetAnnot(const CBioseq_Base_Info& info, TObjectCopyMap* copy_map);
152 
153  void x_AddDescrChunkId(const TDescTypeMask& types, TChunkId chunk_id);
154  void x_AddAnnotChunkId(TChunkId chunk_id);
155  const TChunkIds& x_GetDescrChunkIds() const;
156 
157  virtual TObjAnnot& x_SetObjAnnot(void) = 0;
158  virtual void x_ResetObjAnnot(void) = 0;
159 
162 
163  void x_RealLoadDescr(const TDescr& v);
164 
165 protected:
168  bool x_IsEndNextDesc(TDesc_CI iter) const; // internal inlined method
169  TDesc_CI x_FindDesc(TDescrMutexGuard& guard, TDesc_CI iter, TDescTypeMask types) const;
170  void x_PrefetchDesc(TDescrMutexGuard& guard, TDesc_CI last, TDescTypeMask types) const;
171 
172  friend class CAnnotTypes_CI;
173  friend class CSeq_annot_CI;
174 
175  // members
178 
180  typedef vector<TDescTypeMask> TDescTypeMasks;
184 };
185 
186 
187 
188 /////////////////////////////////////////////////////////////////////
189 //
190 // Inline methods
191 //
192 /////////////////////////////////////////////////////////////////////
193 
194 
195 inline
197 {
199 }
200 
201 
202 inline
204 {
206 }
207 
208 
209 inline
211 {
212  return m_ObjAnnot != 0 || x_NeedUpdate(fNeedUpdate_annot);
213 }
214 
215 
216 inline
218 {
219  return !m_Annot.empty() || x_NeedUpdate(fNeedUpdate_annot);
220 }
221 
222 
223 inline
225 {
227  return m_Annot;
228 }
229 
230 inline
232 {
233  return m_Annot;
234 }
235 
236 
239 
240 #endif//OBJECTS_OBJMGR_IMPL___BIOSEQ_BASE_INFO__HPP
set< string > TUserObjectTypesSet
bool IsSetDescr(void) const
TDescr::Tdata TDescList
virtual void x_SetDescr(TDescr &v)=0
TDescList::const_iterator TDesc_CI
virtual bool x_CanGetDescr(void) const =0
CFastMutexGuard TDescrMutexGuard
bool IsSetAnnot(void) const
vector< TDescTypeMask > TDescTypeMasks
const TAnnot & GetAnnot(void) const
bool HasAnnots(void) const
TDescTypeMasks m_DescrTypeMasks
virtual TDescr & x_SetDescr(void)=0
virtual void x_ResetObjAnnot(void)=0
vector< CRef< CSeq_annot_Info > > TAnnot
const TAnnot & GetLoadedAnnot(void) const
virtual bool x_IsSetDescr(void) const =0
bool CanGetDescr(void) const
CTSE_Info_Object TParent
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
CFastMutex –.
Definition: ncbimtx.hpp:667
CSeq_annot_CI –.
@Seq_descr.hpp User-defined methods of the data storage class.
Definition: Seq_descr.hpp:55
Definition: Seq_entry.hpp:56
virtual void x_SetNeedUpdateParent(TNeedUpdateFlags flags)
virtual void x_DoUpdate(TNeedUpdateFlags flags)
virtual void x_DSDetachContents(CDataSource &ds)
bool x_NeedUpdate(ENeedUpdate flag) const
void x_Update(TNeedUpdateFlags flags) const
virtual void x_TSEAttachContents(CTSE_Info &tse)
@ fNeedUpdate_descr
specific fields of this object
virtual void x_DSAttachContents(CDataSource &ds)
virtual void x_TSEDetachContents(CTSE_Info &tse)
virtual void x_UpdateAnnotIndexContents(CTSE_Info &tse)
vector< TChunkId > TChunkIds
Definition: map.hpp:338
static uch flags
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:51
static const struct type types[]
Definition: type.c:22
#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
list< CRef< CSeqdesc > > Tdata
Definition: Seq_descr_.hpp:91
static MDB_envinfo info
Definition: mdb_load.c:37
Multi-threading – mutexes; rw-locks; semaphore.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Definition: type.c:6
Modified on Fri Sep 20 14:57:43 2024 by modify_doxy.py rev. 669887