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

Go to the SVN repository for this file.

1 #ifndef SCOPE_INFO__HPP
2 #define SCOPE_INFO__HPP
3 
4 /* $Id: scope_info.hpp 100066 2023-06-12 15:57:33Z 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 * Structures used by CScope
33 *
34 */
35 
36 #include <corelib/ncbiobj.hpp>
37 #include <corelib/ncbimtx.hpp>
38 
40 #include <util/mutex_pool.hpp>
41 #include <objmgr/impl/tse_lock.hpp>
44 #include <objmgr/tse_handle.hpp>
45 #include <objmgr/blob_id.hpp>
47 
48 #include <set>
49 #include <map>
50 #include <vector>
51 
54 
55 class CObjectManager;
56 class CDataSource;
57 class CDataLoader;
58 class CSeqMap;
59 
60 class CScope;
61 class CScope_Impl;
62 class CSynonymsSet;
63 
64 class CTSE_Info_Object;
65 class CSeq_entry_Info;
66 class CSeq_annot_Info;
67 class CBioseq_Info;
68 class CBioseq_set_Info;
69 
71 class CTSE_ScopeInfo;
72 class CBioseq_ScopeInfo;
73 
74 class CTSE_Handle;
75 
76 class CScopeInfo_Base;
80 class CBioseq_ScopeInfo;
81 
82 struct SSeqMatch_Scope;
83 struct SSeqMatch_DS;
84 struct SSeq_id_ScopeInfo;
85 
86 class CSeq_entry;
87 class CSeq_annot;
88 class CBioseq;
89 class CBioseq_set;
90 class CSeq_feat;
91 
92 template<typename Key, typename Value>
94 {
95 public:
96  typedef Key key_type;
97  typedef Value value_type;
98  typedef vector<value_type> TUnlockSet;
99 
100  explicit CDeleteQueue(size_t max_size = 0)
101  : m_MaxSize(max_size)
102  {
103  }
104 
105  bool Contains(const key_type& key) const
106  {
107  _ASSERT(m_Queue.size() == m_Index.size());
108  return m_Index.find(key) != m_Index.end();
109  }
110 
112  {
113  value_type ret;
114 
115  _ASSERT(m_Queue.size() == m_Index.size());
116  TIndexIter iter = m_Index.find(key);
117  if ( iter != m_Index.end() ) {
118  ret = iter->second->second;
119  m_Queue.erase(iter->second);
120  m_Index.erase(iter);
121  _ASSERT(m_Queue.size() == m_Index.size());
122  }
123 
124  return ret;
125  }
126  void Erase(const key_type& key)
127  {
128  _ASSERT(m_Queue.size() == m_Index.size());
129  TIndexIter iter = m_Index.find(key);
130  if ( iter != m_Index.end() ) {
131  m_Queue.erase(iter->second);
132  m_Index.erase(iter);
133  _ASSERT(m_Queue.size() == m_Index.size());
134  }
135  }
136  void Put(const key_type& key, const value_type& value,
137  value_type* unlock_ptr)
138  {
139  _ASSERT(m_Queue.size() == m_Index.size());
141 
142  TQueueIter queue_iter =
143  m_Queue.insert(m_Queue.end(), TQueueValue(key, value));
144 
145  _VERIFY(m_Index.insert(TIndexValue(key, queue_iter)).second);
146 
147  _ASSERT(m_Queue.size() == m_Index.size());
148 
149  if ( m_Index.size() > m_MaxSize ) {
150  _VERIFY(m_Index.erase(m_Queue.front().first) == 1);
151  if ( unlock_ptr ) {
152  *unlock_ptr = m_Queue.front().second;
153  }
154  m_Queue.pop_front();
155  _ASSERT(m_Queue.size() == m_Index.size());
156  }
157  }
158  void Put(const key_type& key, const value_type& value,
159  TUnlockSet* unlock_set = 0)
160  {
161  _ASSERT(m_Queue.size() == m_Index.size());
163 
164  TQueueIter queue_iter =
165  m_Queue.insert(m_Queue.end(), TQueueValue(key, value));
166 
167  _VERIFY(m_Index.insert(TIndexValue(key, queue_iter)).second);
168 
169  _ASSERT(m_Queue.size() == m_Index.size());
170 
171  while ( m_Index.size() > m_MaxSize ) {
172  _VERIFY(m_Index.erase(m_Queue.front().first) == 1);
173  if ( unlock_set ) {
174  unlock_set->push_back(m_Queue.front().second);
175  }
176  m_Queue.pop_front();
177  _ASSERT(m_Queue.size() == m_Index.size());
178  }
179  }
180 
181  void Clear(TUnlockSet* unlock_set = 0)
182  {
183  if ( unlock_set ) {
184  ITERATE ( typename TQueue, it, m_Queue ) {
185  unlock_set->push_back(it->second);
186  }
187  }
188  m_Queue.clear();
189  m_Index.clear();
190  }
191 
192 private:
193  typedef pair<key_type, value_type> TQueueValue;
194  typedef list<TQueueValue> TQueue;
195  typedef typename TQueue::iterator TQueueIter;
196 
198  typedef typename TIndex::value_type TIndexValue;
199  typedef typename TIndex::iterator TIndexIter;
200 
201  size_t m_MaxSize;
204 };
205 
206 
208 {
209 public:
216  typedef CDeleteQueue<const CTSE_ScopeInfo*,
218 
220  ~CDataSource_ScopeInfo(void);
221 
222  CScope_Impl& GetScopeImpl(void) const;
223  void DetachScope(void);
224 
225  void ResetDS(void);
226  void ResetHistory(int action_if_locked);//CScope_Impl::EActionIfLocked
227 
229  const TTSE_InfoMap& GetTSE_InfoMap(void) const;
230  TTSE_InfoMapMutex& GetTSE_InfoMapMutex(void) const;
231 
233  const TTSE_LockSet& GetTSE_LockSet(void) const;
234  TTSE_LockSetMutex& GetTSE_LockSetMutex(void) const;
235  void ReleaseTSEUserLock(CTSE_ScopeInfo& tse); // into queue
236  void AcquireTSEUserLock(CTSE_ScopeInfo& tse); // from queue
237  void ForgetTSELock(CTSE_ScopeInfo& tse); // completely
238  void RemoveFromHistory(CTSE_ScopeInfo& tse, bool drop_from_ds = false);
239  bool TSEIsInQueue(const CTSE_ScopeInfo& tse) const;
240 
241  void RemoveTSE_Lock(const CTSE_Lock& lock);
242  void AddTSE_Lock(const CTSE_Lock& lock);
243 
244  void UnlockedTSEsSave(void);
246 
247  CDataSource& GetDataSource(void);
248  const CDataSource& GetDataSource(void) const;
249  CDataLoader* GetDataLoader(void);
250  // CanBeEdited() is true for a data source with blobs in 'edited' state
251  bool CanBeEdited(void) const;
252  // IsConst() is true for a data source with manually added const TSEs
253  bool IsConst(void) const;
254  void SetConst(void);
255  // Make unlocked TSEs will be removed completely in ResetHistory()
256  // this mode is for edited entries retrieved from data loader
257  void SetCanRemoveOnResetHistory(void);
258  bool CanRemoveOnResetHistory(void) const;
259 
261  typedef pair<CConstRef<CSeq_entry_Info>, TTSE_Lock> TSeq_entry_Lock;
262  typedef pair<CConstRef<CSeq_annot_Info>, TTSE_Lock> TSeq_annot_Lock;
263  typedef pair<CConstRef<CBioseq_set_Info>, TTSE_Lock> TBioseq_set_Lock;
265  typedef pair<TSeq_annot_Lock, int> TSeq_feat_Lock;
266 
267  TTSE_Lock GetTSE_Lock(const CTSE_Lock& tse);
268  TTSE_Lock FindTSE_Lock(const CSeq_entry& tse);
269  TSeq_entry_Lock GetSeq_entry_Lock(const CBlobIdKey& blob_id);
270  TSeq_entry_Lock FindSeq_entry_Lock(const CSeq_entry& entry);
271  TSeq_annot_Lock FindSeq_annot_Lock(const CSeq_annot& annot);
272  TBioseq_set_Lock FindBioseq_set_Lock(const CBioseq_set& seqset);
273  TBioseq_Lock FindBioseq_Lock(const CBioseq& bioseq);
274  TSeq_feat_Lock FindSeq_feat_Lock(const CSeq_id_Handle& loc_id,
275  TSeqPos loc_pos,
276  const CSeq_feat& feat);
277 
278  SSeqMatch_Scope BestResolve(const CSeq_id_Handle& idh, int get_flag);
280 
281  void AttachTSE(CTSE_ScopeInfo& tse, const CTSE_Lock& lock);
282 
284  void GetBlobs(TSeqMatchMap& match_map);
285 
286  bool TSEIsReplaced(const TBlobId& blob_id) const;
287 
288 protected:
289  friend class CScope_Impl;
290  friend class CTSE_ScopeInfo;
291 
292  SSeqMatch_Scope x_GetSeqMatch(const CSeq_id_Handle& idh);
293  SSeqMatch_Scope x_FindBestTSE(const CSeq_id_Handle& idh);
294  void x_SetMatch(SSeqMatch_Scope& match,
295  CTSE_ScopeInfo& tse,
296  const CSeq_id_Handle& idh) const;
297  void x_SetMatch(SSeqMatch_Scope& match,
298  const SSeqMatch_DS& ds_match);
299 
300  void x_IndexTSE(CTSE_ScopeInfo& tse);
301  void x_UnindexTSE(const CTSE_ScopeInfo& tse);
302  TTSE_ScopeInfo x_FindBestTSEInIndex(const CSeq_id_Handle& idh) const;
303  static bool x_IsBetter(const CSeq_id_Handle& idh,
304  const CTSE_ScopeInfo& tse1,
305  const CTSE_ScopeInfo& tse2);
306 
307 private: // members
323 
324 private: // to prevent copying
327 };
328 
329 
331 public:
332  typedef vector< CConstRef<CTSE_Info> > TUnlockedTSEsLock;
333  typedef vector<CTSE_ScopeInternalLock> TUnlockedTSEsInternal;
334 
335  CUnlockedTSEsGuard(void);
336  ~CUnlockedTSEsGuard(void);
337 
338  static void SaveLock(const CTSE_Lock& lock);
339  static void SaveInternal(const CTSE_ScopeInternalLock& lock);
340  static void SaveInternal(const TUnlockedTSEsInternal& locks);
341 private:
344 };
345 
346 
348 {
349 public:
352  typedef vector<CSeq_id_Handle> TSeqIds;
353  typedef pair<int, int> TBlobOrder;
356 
358  const CTSE_Lock& tse_lock,
359  int load_index,
360  bool can_be_unloaded);
361  ~CTSE_ScopeInfo(void);
362 
363  CScope_Impl& GetScopeImpl(void) const;
364  CDataSource_ScopeInfo& GetDSInfo(void) const;
365 
366  bool IsAttached(void) const;
367  void RemoveFromHistory(const CTSE_Handle* tseh,
368  int action_if_locked,//CScope_Impl::EActionIfLocked
369  bool drop_from_ds = false);
370  static void RemoveFromHistory(const CTSE_Handle& tseh,
371  int action_if_locked,//CScope_Impl::EActionIfLocked
372  bool drop_from_ds = false);
373 
374  bool HasResolvedBioseq(const CSeq_id_Handle& id) const;
375 
376  bool CanBeUnloaded(void) const;
377  bool CanBeEdited(void) const;
378 
379  // True if the TSE is referenced
380  bool IsUserLocked(void) const;
381  // True if the TSE is referenced by more than by one handle
382  pair<bool, CScopeInfo_Base*> GetUserLockState(const CTSE_Handle* tseh) const;
383 
384  bool ContainsBioseq(const CSeq_id_Handle& id) const;
385  // returns matching Seq-id handle
386  CSeq_id_Handle ContainsMatchingBioseq(const CSeq_id_Handle& id) const;
387 
388  bool x_SameTSE(const CTSE_Info& tse) const;
389 
390  int GetLoadIndex(void) const;
391  TBlobId GetBlobId(void) const;
392  TBlobOrder GetBlobOrder(void) const;
393  const TSeqIds& GetBioseqsIds(void) const;
394 
395  bool AddUsedTSE(const CTSE_ScopeUserLock& lock) const;
396  void ReleaseUsedTSEs(void);
397 
399  void SetEditTSE(const CTSE_Lock& new_tse_lock,
400  CDataSource_ScopeInfo& new_ds);
401  void ReplaceTSE(const CTSE_Info& old_tse);
402  void RestoreReplacedTSE(void);
403 
404  // gets locked CScopeInfo_Base object
409  TSeq_entry_Lock GetScopeLock(const CTSE_Handle& tse,
410  const CSeq_entry_Info& info);
411  TSeq_annot_Lock GetScopeLock(const CTSE_Handle& tse,
412  const CSeq_annot_Info& info);
413  TBioseq_set_Lock GetScopeLock(const CTSE_Handle& tse,
414  const CBioseq_set_Info& info);
415 
416  CRef<CBioseq_ScopeInfo> GetBioseqInfo(const SSeqMatch_Scope& match);
418  CConstRef<CBioseq_Info> bioseq);
419 
420  void ResetEntry(CSeq_entry_ScopeInfo& info);
421  void RemoveEntry(CSeq_entry_ScopeInfo& info);
422  void RemoveAnnot(CSeq_annot_ScopeInfo& info);
423  void AddEntry(CBioseq_set_ScopeInfo& seqset,
425  int index);
426  void AddAnnot(CSeq_entry_ScopeInfo& entry,
428  void SelectSeq(CSeq_entry_ScopeInfo& entry,
430  void SelectSet(CSeq_entry_ScopeInfo& entry,
432 
433  void x_SaveRemoved(CScopeInfo_Base& info);
434  void x_CheckAdded(CScopeInfo_Base& parent, CScopeInfo_Base& child);
435  void x_RestoreAdded(CScopeInfo_Base& parent, CScopeInfo_Base& child);
436 
437  friend class CTSE_ScopeInfo_Base;
438 
439  void ForgetTSE_Lock(void);
440 
441  const CTSE_Lock& GetTSE_Lock(void) const;
442  void SetTSE_Lock(const CTSE_Lock& lock);
443  void ResetTSE_Lock(void);
444  void DropTSE_Lock(void);
445 
447 
448 protected:
449  template<class TScopeInfo>
450  CScopeInfo_Ref<TScopeInfo> x_GetScopeLock(const CTSE_Handle& tse,
451  const typename TScopeInfo::TObjectInfo& info);
452  void x_SetTSE_Lock(const CTSE_Lock& lock);
453  void x_ResetTSE_Lock(void);
454  void x_DetachDS(void);
455 
457  friend class CTSE_ScopeUserLocker;
458 
459  // Number of internal locks, not related to handles
460  int x_GetDSLocksCount(void) const;
461 
462  void x_InternalLockTSE(void);
463  void x_InternalUnlockTSE(void);
464  void x_UserLockTSE(void);
465  void x_UserUnlockTSE(void);
466 
467  CRef<CBioseq_ScopeInfo> x_FindBioseqInfo(const TSeqIds& ids) const;
468  CRef<CBioseq_ScopeInfo> x_CreateBioseqInfo(const TSeqIds& ids);
469  void x_IndexBioseq(const CSeq_id_Handle& id,
471  void x_UnindexBioseq(const CSeq_id_Handle& id,
472  const CBioseq_ScopeInfo* info);
473 
474 private: // members
475  friend class CScope_Impl;
476  friend class CTSE_Handle;
477  friend class CDataSource_ScopeInfo;
478  friend class CBioseq_ScopeInfo;
479 
483 
486  struct SUnloadedInfo {
487  SUnloadedInfo(const CTSE_Lock& lock);
488  CTSE_Lock LockTSE(void);
489 
494  };
495 
498  // TSE locking support
500  mutable atomic<Int8> m_TSE_LockCounter;
501  mutable atomic<Int8> m_UserLockCounter;
502  mutable atomic<bool> m_TSE_LockAssigned;
504  // Used by TSE support
505  mutable const CTSE_ScopeInfo* m_UsedByTSE;
507 
509 
512 
513 private: // to prevent copying
516 };
517 
518 
520 {
521 public:
524  typedef vector< pair<TTSE_ScopeInfo, CSeq_id_Handle> > TTSE_MatchSet;
525  struct SAnnotSetCache : public CObject {
526  atomic<int> m_SearchTimestamp;
528  };
529  struct SNASetKey {
531  int adjust = 0;
532  bool operator<(const SNASetKey& other) const {
533  if (adjust != other.adjust) return adjust < other.adjust;
534  return accessions < other.accessions;
535  }
536  };
540  typedef TIndexIds TIds;
541  typedef int TBlobStateFlags;
543 
544  CBioseq_ScopeInfo(TBlobStateFlags flag, int timestamp); // no sequence
545  explicit CBioseq_ScopeInfo(CTSE_ScopeInfo& tse); // unnamed
546  CBioseq_ScopeInfo(CTSE_ScopeInfo& tse, const TIds& ids);
547  ~CBioseq_ScopeInfo(void);
548 
549  // update state
550  void SetUnresolved(TBlobStateFlags flag, int timestamp);
551  void SetResolved(CTSE_ScopeInfo& tse, const TIds& ids);
552 
553  const CBioseq_Info& GetObjectInfo(void) const
554  {
555  return reinterpret_cast<const CBioseq_Info&>(GetObjectInfo_Base());
556  }
558  {
559  return const_cast<CBioseq_Info&>(GetObjectInfo());
560  }
561 
562  const TIds& GetIds(void) const
563  {
564  return m_Ids;
565  }
566  const TIndexIds* GetIndexIds(void) const;
567 
568  bool HasBioseq(void) const;
569  bool NeedsReResolve(int timestamp) const
570  {
571  return !HasBioseq() && m_UnresolvedTimestamp != timestamp;
572  }
573 
574  string IdString(void) const;
575 
577  {
578  return m_BlobState;
579  }
580 
581  TBioseq_Lock GetLock(CConstRef<CBioseq_Info> bioseq);
582 
583  // id modification methods are required because we need to update
584  // index information in CTSE_ScopeInfo.
585  void ResetId(void);
586  bool AddId(const CSeq_id_Handle& id);
587  bool RemoveId(const CSeq_id_Handle& id);
588 
589 protected: // protected object manager interface
590  friend class CScope_Impl;
591  friend class CTSE_ScopeInfo;
592  friend class CSeq_id_ScopeInfo;
593 
594  void x_AttachTSE(CTSE_ScopeInfo* tse);
595  void x_DetachTSE(CTSE_ScopeInfo* tse);
596 
598  {
599  m_BioseqAnnotRef_Info.Reset();
600  m_NABioseqAnnotRef_Info.clear();
601  }
602 
603 private: // members
604  // Real Seq-ids of the bioseq.
606  // Additional blob state flags.
608 
609  // Cached information.
611  // Cache synonyms of bioseq if any.
612  // All synonyms share the same CBioseq_ScopeInfo object.
614  // Cache TSEs with external annotations on this Bioseq.
617 
618 private: // to prevent copying
621 };
622 
623 
625 {
626  SSeq_id_ScopeInfo(void);
627  ~SSeq_id_ScopeInfo(void);
628 
629  // Resolved Bioseq information.
630  // 1. initially:
631  // m_Bioseq_Info = null
632  // 2. resolve failed:
633  // m_Bioseq_Info = !HasBioseq() (state & no_data) != 0
634  // 3. resolved:
635  // m_Bioseq_Info = HasBioseq() (state & no_data) == 0
636  // State transitions:
637  // 1 -> 2 (sequence not found)
638  // 1 -> 3 (sequence found)
639  // 2 -> 3 (sequence found on next attempt)
640  // 3 -> 1 (sequence removed)
642 
643  // Caches other (not main) TSEs with annotations on this Seq-id.
646 
648  {
651  }
652 };
653 
654 
655 /////////////////////////////////////////////////////////////////////////////
656 // Inline methods
657 /////////////////////////////////////////////////////////////////////////////
658 
659 /////////////////////////////////////////////////////////////////////////////
660 // CDataSource_ScopeInfo
661 /////////////////////////////////////////////////////////////////////////////
662 
663 
664 inline
666 {
667  return *m_DataSource;
668 }
669 
670 
671 inline
673 {
674  return *m_DataSource;
675 }
676 
677 
678 inline
681 {
682  return m_TSE_InfoMapMutex;
683 }
684 
685 inline
688 {
689  return m_TSE_LockSetMutex;
690 }
691 
692 
693 inline
695 {
696  return m_CanBeEdited;
697 }
698 
699 
700 inline
702 {
704 }
705 
706 
707 /////////////////////////////////////////////////////////////////////////////
708 // CTSE_ScopeInfo
709 /////////////////////////////////////////////////////////////////////////////
710 
711 
712 inline
714 {
715  return m_LoadIndex;
716 }
717 
718 
719 inline
721 {
722  return m_DS_Info != 0;
723 }
724 
725 
726 inline
728 {
729  return m_UnloadedInfo;
730 }
731 
732 
733 inline
735 {
737  return *m_DS_Info;
738 }
739 
740 
741 inline
743 {
744  return GetDSInfo().CanBeEdited();
745 }
746 
747 
748 inline
750 {
751  return GetDSInfo().GetScopeImpl();
752 }
753 
754 
755 inline
757 {
758  return m_TSE_Lock;
759 }
760 
761 
762 inline
764 {
765  return m_UserLockCounter > 0;
766 }
767 
768 
769 /////////////////////////////////////////////////////////////////////////////
770 // CBioseq_ScopeInfo
771 /////////////////////////////////////////////////////////////////////////////
772 
773 
776 
777 #endif // SCOPE_INFO__HPP
AutoPtr –.
Definition: ncbimisc.hpp:401
CInitMutex< SAnnotSetCache > TAnnotRefInfo
Definition: scope_info.hpp:538
SNASetKey TNASetKey
Definition: scope_info.hpp:537
CRef< CTSE_ScopeInfo > TTSE_ScopeInfo
Definition: scope_info.hpp:522
TBlobStateFlags GetBlobState(void) const
Definition: scope_info.hpp:576
TAnnotRefInfo m_BioseqAnnotRef_Info
Definition: scope_info.hpp:615
TBlobStateFlags m_BlobState
Definition: scope_info.hpp:607
const CBioseq_Info & GetObjectInfo(void) const
Definition: scope_info.hpp:553
CBioseq_Info & GetNCObjectInfo(void)
Definition: scope_info.hpp:557
CInitMutex< CSynonymsSet > m_SynCache
Definition: scope_info.hpp:613
bool NeedsReResolve(int timestamp) const
Definition: scope_info.hpp:569
CBioseq_ScopeInfo(const CBioseq_ScopeInfo &info)
atomic< int > m_UnresolvedTimestamp
Definition: scope_info.hpp:610
const TIds & GetIds(void) const
Definition: scope_info.hpp:562
CScopeInfo_Ref< CBioseq_ScopeInfo > TBioseq_Lock
Definition: scope_info.hpp:542
set< CSeq_id_Handle > TSeq_idSet
Definition: scope_info.hpp:523
vector< pair< TTSE_ScopeInfo, CSeq_id_Handle > > TTSE_MatchSet
Definition: scope_info.hpp:524
const CBioseq_ScopeInfo & operator=(const CBioseq_ScopeInfo &info)
void x_ResetAnnotRef_Info()
Definition: scope_info.hpp:597
map< TNASetKey, TAnnotRefInfo > TNAAnnotRefInfo
Definition: scope_info.hpp:539
TNAAnnotRefInfo m_NABioseqAnnotRef_Info
Definition: scope_info.hpp:616
CConstRef –.
Definition: ncbiobj.hpp:1266
TTSE_InfoMapMutex m_TSE_InfoMapMutex
Definition: scope_info.hpp:315
CScope_Impl * m_Scope
Definition: scope_info.hpp:308
TTSE_LockSetMutex & GetTSE_LockSetMutex(void) const
Definition: scope_info.hpp:687
CRef< CDataSource > TDataSourceLock
Definition: scope_info.hpp:210
const CDataSource_ScopeInfo & operator=(const CDataSource_ScopeInfo &)
pair< TSeq_annot_Lock, int > TSeq_feat_Lock
Definition: scope_info.hpp:265
TTSE_UnlockQueue m_TSE_UnlockQueue
Definition: scope_info.hpp:319
void UnlockedTSEsSave(void)
CDataSource_ScopeInfo(const CDataSource_ScopeInfo &)
TTSE_LockSet m_TSE_LockSet
Definition: scope_info.hpp:317
CTSE_ScopeUserLock TTSE_Lock
Definition: scope_info.hpp:260
TTSE_BySeqId m_TSE_BySeqId
Definition: scope_info.hpp:316
CTSE_LockSet TTSE_LockSet
Definition: scope_info.hpp:214
TTSE_InfoMapMutex & GetTSE_InfoMapMutex(void) const
Definition: scope_info.hpp:680
CScope_Impl & GetScopeImpl(void) const
Definition: scope_info.cpp:128
set< TBlobId > m_ReplacedTSEs
Definition: scope_info.hpp:322
multimap< CSeq_id_Handle, TTSE_ScopeInfo > TTSE_BySeqId
Definition: scope_info.hpp:215
bool CanRemoveOnResetHistory(void) const
Definition: scope_info.hpp:701
CDataSource & GetDataSource(void)
Definition: scope_info.hpp:665
CScopeInfo_Ref< CBioseq_ScopeInfo > TBioseq_Lock
Definition: scope_info.hpp:264
TTSE_LockSetMutex m_TSE_LockSetMutex
Definition: scope_info.hpp:318
pair< CConstRef< CSeq_entry_Info >, TTSE_Lock > TSeq_entry_Lock
Definition: scope_info.hpp:261
TDataSourceLock m_DataSource
Definition: scope_info.hpp:309
CRef< CDataSource_ScopeInfo > m_EditDS
Definition: scope_info.hpp:321
TTSE_InfoMap m_TSE_InfoMap
Definition: scope_info.hpp:314
void UnlockedTSEsRelease(void)
CRef< CTSE_ScopeInfo > TTSE_ScopeInfo
Definition: scope_info.hpp:211
pair< CConstRef< CBioseq_set_Info >, TTSE_Lock > TBioseq_set_Lock
Definition: scope_info.hpp:263
pair< CConstRef< CSeq_annot_Info >, TTSE_Lock > TSeq_annot_Lock
Definition: scope_info.hpp:262
TTSE_LockSetMutex m_TSE_UnlockQueueMutex
Definition: scope_info.hpp:320
map< CSeq_id_Handle, SSeqMatch_Scope > TSeqMatchMap
Definition: scope_info.hpp:283
map< TBlobId, TTSE_ScopeInfo > TTSE_InfoMap
Definition: scope_info.hpp:213
bool CanBeEdited(void) const
Definition: scope_info.hpp:694
CDeleteQueue< const CTSE_ScopeInfo *, CTSE_ScopeInternalLock > TTSE_UnlockQueue
Definition: scope_info.hpp:217
vector< value_type > TUnlockSet
Definition: scope_info.hpp:98
Value value_type
Definition: scope_info.hpp:97
TQueue m_Queue
Definition: scope_info.hpp:202
value_type Get(const key_type &key)
Definition: scope_info.hpp:111
void Put(const key_type &key, const value_type &value, TUnlockSet *unlock_set=0)
Definition: scope_info.hpp:158
void Erase(const key_type &key)
Definition: scope_info.hpp:126
map< key_type, TQueueIter > TIndex
Definition: scope_info.hpp:197
void Clear(TUnlockSet *unlock_set=0)
Definition: scope_info.hpp:181
CDeleteQueue(size_t max_size=0)
Definition: scope_info.hpp:100
TIndex m_Index
Definition: scope_info.hpp:203
void Put(const key_type &key, const value_type &value, value_type *unlock_ptr)
Definition: scope_info.hpp:136
bool Contains(const key_type &key) const
Definition: scope_info.hpp:105
size_t m_MaxSize
Definition: scope_info.hpp:201
void Reset()
Definition: mutex_pool.hpp:153
CMutex –.
Definition: ncbimtx.hpp:749
CObjectManager –.
CObject –.
Definition: ncbiobj.hpp:180
CRef –.
Definition: ncbiobj.hpp:618
vector< TIndexId > TIndexIds
Definition: tse_handle.hpp:421
CScope –.
Definition: scope.hpp:92
CSeqMap –.
Definition: seq_map.hpp:93
Definition: Seq_entry.hpp:56
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CConstRef< CTSE_Info_Object > TScopeInfoMapKey
Definition: scope_info.hpp:480
CDataSource_ScopeInfo & GetDSInfo(void) const
Definition: scope_info.hpp:734
CTSE_ScopeInfo(const CTSE_ScopeInfo &)
pair< int, int > TBlobOrder
Definition: scope_info.hpp:353
CScopeInfo_Ref< CSeq_entry_ScopeInfo > TSeq_entry_Lock
Definition: scope_info.hpp:405
CTSE_ScopeInfo & operator=(const CTSE_ScopeInfo &)
CScopeInfo_Ref< CBioseq_set_ScopeInfo > TBioseq_set_Lock
Definition: scope_info.hpp:407
TBioseqById m_BioseqById
Definition: scope_info.hpp:497
const CTSE_Lock & GetTSE_Lock(void) const
Definition: scope_info.hpp:756
AutoPtr< SUnloadedInfo > m_UnloadedInfo
Definition: scope_info.hpp:496
bool CanBeUnloaded(void) const
Definition: scope_info.hpp:727
CScopeInfo_Ref< CBioseq_ScopeInfo > TBioseq_Lock
Definition: scope_info.hpp:408
map< TScopeInfoMapKey, TScopeInfoMapValue > TScopeInfoMap
Definition: scope_info.hpp:482
atomic< bool > m_TSE_LockAssigned
Definition: scope_info.hpp:502
int GetLoadIndex(void) const
Definition: scope_info.hpp:713
atomic< Int8 > m_TSE_LockCounter
Definition: scope_info.hpp:500
CRef< CScopeInfo_Base > TScopeInfoMapValue
Definition: scope_info.hpp:481
CMutex m_ScopeInfoMapMutex
Definition: scope_info.hpp:510
vector< CSeq_id_Handle > TSeqIds
Definition: scope_info.hpp:352
CBlobIdKey TBlobId
Definition: scope_info.hpp:350
bool IsUserLocked(void) const
Definition: scope_info.hpp:763
atomic< Int8 > m_UserLockCounter
Definition: scope_info.hpp:501
const CTSE_ScopeInfo * m_UsedByTSE
Definition: scope_info.hpp:505
bool CanBeEdited(void) const
Definition: scope_info.hpp:742
multimap< CSeq_id_Handle, CRef< CBioseq_ScopeInfo > > TBioseqById
Definition: scope_info.hpp:351
CScope_Impl & GetScopeImpl(void) const
Definition: scope_info.hpp:749
TUsedTSE_LockSet m_UsedTSE_Set
Definition: scope_info.hpp:506
TBlobId m_ReplacedTSE
Definition: scope_info.hpp:508
CMutex m_TSE_LockMutex
Definition: scope_info.hpp:499
map< CConstRef< CObject >, CRef< CObject > > TEditInfoMap
Definition: scope_info.hpp:398
CTSE_Lock m_TSE_Lock
Definition: scope_info.hpp:503
CDataSource_ScopeInfo * m_DS_Info
Definition: scope_info.hpp:484
bool IsAttached(void) const
Definition: scope_info.hpp:720
CConstRef< CTSE_ScopeInfo > TUsedTSE_LockKey
Definition: scope_info.hpp:354
map< TUsedTSE_LockKey, CTSE_ScopeInternalLock > TUsedTSE_LockSet
Definition: scope_info.hpp:355
TScopeInfoMap m_ScopeInfoMap
Definition: scope_info.hpp:511
CScopeInfo_Ref< CSeq_annot_ScopeInfo > TSeq_annot_Lock
Definition: scope_info.hpp:406
TUnlockedTSEsLock m_UnlockedTSEsLock
Definition: scope_info.hpp:342
vector< CTSE_ScopeInternalLock > TUnlockedTSEsInternal
Definition: scope_info.hpp:333
vector< CConstRef< CTSE_Info > > TUnlockedTSEsLock
Definition: scope_info.hpp:332
static void SaveInternal(const CTSE_ScopeInternalLock &lock)
Definition: scope_info.cpp:233
TUnlockedTSEsInternal m_UnlockedTSEsInternal
Definition: scope_info.hpp:343
static void SaveLock(const CTSE_Lock &lock)
Definition: scope_info.cpp:221
void erase(iterator pos)
Definition: map.hpp:167
size_type size() const
Definition: map.hpp:148
const_iterator end() const
Definition: map.hpp:152
iterator_bool insert(const value_type &val)
Definition: map.hpp:165
void clear()
Definition: map.hpp:169
const_iterator find(const key_type &key) const
Definition: map.hpp:153
Definition: set.hpp:45
char value[7]
Definition: config.c:431
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define _VERIFY(expr)
Definition: ncbidbg.hpp:161
#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
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2107
Multi-threading – mutexes; rw-locks; semaphore.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
static int match(register const pcre_uchar *eptr, register const pcre_uchar *ecode, const pcre_uchar *mstart, int offset_top, match_data *md, eptrblock *eptrb, unsigned int rdepth)
Definition: pcre_exec.c:513
@ Resolve
Try to resolve provided seq-ids.
SAnnotSelector::TNamedAnnotAccessions accessions
Definition: scope_info.hpp:530
bool operator<(const SNASetKey &other) const
Definition: scope_info.hpp:532
CRef< CDataSource > m_Source
Definition: scope_info.hpp:490
CInitMutex< CBioseq_ScopeInfo > m_Bioseq_Info
Definition: scope_info.hpp:641
void x_ResetAnnotRef_Info()
Definition: scope_info.hpp:647
CBioseq_ScopeInfo::TAnnotRefInfo m_AllAnnotRef_Info
Definition: scope_info.hpp:644
CBioseq_ScopeInfo::TNAAnnotRefInfo m_NAAllAnnotRef_Info
Definition: scope_info.hpp:645
#define _ASSERT
Modified on Sat Dec 09 04:48:03 2023 by modify_doxy.py rev. 669887