CBioseq_Handle CPrefetchTokenOld_Impl::NextBioseqHandle(CScope& scope) { TTSE_Lock tse; CSeq_id_Handle id; {{ CFastMutexGuard guard(m_Lock); // Can not call bool(*this) - creates deadlock _ASSERT(m_CurrentId < m_Ids.size()); id = m_Ids[m_CurrentId]; // Keep temporary TSE lock tse = m_TSEs[m_CurrentId]; m_TSEs[m_CurrentId].Reset(); ++m_CurrentId; if ( tse ) { TTSE_Map::iterator it = m_TSEMap.find(tse); if ( --(it->second) < 1 ) { m_TSEMap.erase(it); // Signal that next TSE or next token may be prefetched m_TSESemaphore.Post(); } } } } return scope.GetBioseqHandle(id); }
CSeqVector::CSeqVector(const CSeq_loc& loc, CScope& scope, EVectorCoding coding, ENa_strand strand) : m_Scope(&scope), m_SeqMap(CSeqMap::GetSeqMapForSeq_loc(loc, &scope)), m_Strand(strand), m_Coding(CSeq_data::e_not_set) { if ( const CSeq_id* id = loc.GetId() ) { if ( CBioseq_Handle bh = scope.GetBioseqHandle(*id) ) { m_TSE = bh.GetTSE_Handle(); } } m_Size = m_SeqMap->GetLength(m_Scope); m_Mol = m_SeqMap->GetMol(); SetCoding(coding); }