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

Go to the SVN repository for this file.

1 #ifndef OBJECTS_OBJMGR_IMPL___ANNOT_OBJECT_INDEX__HPP
2 #define OBJECTS_OBJMGR_IMPL___ANNOT_OBJECT_INDEX__HPP
3 
4 /* $Id: annot_object_index.hpp 74559 2016-09-13 11:58:16Z ivanov $
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 * Annot objecty index structures
33 *
34 */
35 
36 
37 #include <corelib/ncbistd.hpp>
38 #include <corelib/ncbiobj.hpp>
39 #include <objmgr/annot_name.hpp>
43 
44 #include <util/rangemap.hpp>
45 
46 #include <vector>
47 #include <deque>
48 
51 
52 class CHandleRange;
53 class CAnnotObject_Info;
54 
55 ////////////////////////////////////////////////////////////////////
56 //
57 // CTSE_Info::
58 //
59 // General information and indexes for top level seq-entries
60 //
61 
62 
63 // forward declaration
64 
65 
69 };
70 
71 
73 {
75  : m_AnnotObject_Info(0),
78  {
79  }
80 
81  enum EFlags {
87  fMultiId = 1 << 2,
88  fPartial = 1 << 3,
90  fLocation_Point = 1 << 4,
92  fLocation_Whole = 3 << 4
93  };
94  typedef Uint1 TFlags;
95 
96  bool GetMultiIdFlag(void) const
97  {
98  return (m_Flags & fMultiId) != 0;
99  }
100  void SetMultiIdFlag(void)
101  {
102  m_Flags |= fMultiId;
103  }
104  bool IsPartial(void) const
105  {
106  return (m_Flags & fPartial) != 0;
107  }
108  void SetPartial(bool partial)
109  {
110  if ( partial ) {
111  m_Flags |= fPartial;
112  }
113  }
114  bool LocationIsSimple(void) const
115  {
116  return (m_Flags & fSimpleLocation_Mask) != 0;
117  }
118  bool LocationIsPoint(void) const
119  {
121  }
122  bool LocationIsInterval(void) const
123  {
125  }
126  bool LocationIsWhole(void) const
127  {
129  }
131  {
133  }
135  {
137  }
139  {
141  }
142 
147 };
148 
149 
151 {
152  SAnnotObjectsIndex(void);
153  SAnnotObjectsIndex(const CAnnotName& name);
155  ~SAnnotObjectsIndex(void);
156 
157  typedef deque<CAnnotObject_Info> TObjectInfos;
158  typedef vector<SAnnotObject_Key> TObjectKeys;
159 
160  void SetName(const CAnnotName& name);
161  const CAnnotName& GetName(void) const;
162 
163  bool IsIndexed(void) const;
164  void SetIndexed(void);
165 
166  bool IsEmpty(void) const;
167  // reserve space for size annot objects
168  // keys will be reserved for size*keys_factor objects
169  // this is done to avoid reallocation and invalidation
170  // of m_Infos in AddInfo() method
171  void Clear(void);
172 
173  void ReserveInfoSize(size_t size);
174  void AddInfo(const CAnnotObject_Info& info);
175 
176  TObjectInfos& GetInfos(void);
177  const TObjectInfos& GetInfos(void) const;
178 
179  void ReserveMapSize(size_t size);
180  void AddMap(const SAnnotObject_Key& key, const SAnnotObject_Index& index);
181  void RemoveLastMap(void);
182 
183  void PackKeys(void);
184 
185  const TObjectKeys& GetKeys(void) const;
186  const SAnnotObject_Key& GetKey(size_t i) const;
187 
188 private:
191  bool m_Indexed;
193 
195 };
196 
197 
198 inline
200 {
201  return m_Name;
202 }
203 
204 
205 inline
207 {
208  return m_Indexed;
209 }
210 
211 
212 inline
214 {
215  _ASSERT(!IsIndexed());
216  m_Indexed = true;
217 }
218 
219 
220 inline
222 {
223  return m_Infos.empty();
224 }
225 
226 
227 inline
230 {
231  return m_Infos;
232 }
233 
234 
235 inline
238 {
239  return m_Infos;
240 }
241 
242 
243 inline
246 {
247  return m_Keys;
248 }
249 
250 
251 inline
252 const SAnnotObject_Key&
254 {
255  _ASSERT(i < m_Keys.size());
256  return m_Keys[i];
257 }
258 
259 
262 
263 #endif// OBJECTS_OBJMGR_IMPL___ANNOT_OBJECT_INDEX__HPP
@ eFeatId_id
@ eFeatId_xref
CRef –.
Definition: ncbiobj.hpp:618
Include a standard set of the NCBI C++ Toolkit most basic headers.
uint8_t Uint1
1-byte (8-bit) unsigned integer
Definition: ncbitype.h:99
uint16_t Uint2
2-byte (16-bit) unsigned integer
Definition: ncbitype.h:101
#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
int i
static MDB_envinfo info
Definition: mdb_load.c:37
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
bool LocationIsWhole(void) const
CRef< CObjectFor< CHandleRange > > m_HandleRange
CAnnotObject_Info * m_AnnotObject_Info
bool GetMultiIdFlag(void) const
bool LocationIsSimple(void) const
void SetPartial(bool partial)
bool LocationIsInterval(void) const
bool LocationIsPoint(void) const
bool IsPartial(void) const
bool IsIndexed(void) const
TObjectInfos & GetInfos(void)
const SAnnotObject_Key & GetKey(size_t i) const
const CAnnotName & GetName(void) const
bool IsEmpty(void) const
SAnnotObjectsIndex & operator=(const SAnnotObjectsIndex &)
vector< SAnnotObject_Key > TObjectKeys
deque< CAnnotObject_Info > TObjectInfos
const TObjectKeys & GetKeys(void) const
void ReserveInfoSize(size_t size)
#define _ASSERT
Modified on Sun Jul 21 04:15:48 2024 by modify_doxy.py rev. 669887