scope.cpp

来自「ncbi源码」· C++ 代码 · 共 706 行 · 第 1/2 页

CPP
706
字号
/* * =========================================================================== * PRODUCTION $Log: scope.cpp,v $ * PRODUCTION Revision 1000.5  2004/06/01 19:23:36  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.107 * PRODUCTION * =========================================================================== *//*  $Id: scope.cpp,v 1000.5 2004/06/01 19:23:36 gouriano Exp $* ===========================================================================**                            PUBLIC DOMAIN NOTICE*               National Center for Biotechnology Information**  This software/database is a "United States Government Work" under the*  terms of the United States Copyright Act.  It was written as part of*  the author's official duties as a United States Government employee and*  thus cannot be copyrighted.  This software/database is freely available*  to the public for use. The National Library of Medicine and the U.S.*  Government have not placed any restriction on its use or reproduction.**  Although all reasonable efforts have been taken to ensure the accuracy*  and reliability of the software and data, the NLM and the U.S.*  Government do not and cannot warrant the performance or results that*  may be obtained by using this software or data. The NLM and the U.S.*  Government disclaim all warranties, express or implied, including*  warranties of performance, merchantability or fitness for any particular*  purpose.**  Please cite the author in any work or product based on this material.** ===========================================================================** Authors:*           Andrei Gourianov*           Aleksey Grichenko*           Michael Kimelman*           Denis Vakatov*           Eugene Vasilchenko** File Description:*           Scope is top-level object available to a client.*           Its purpose is to define a scope of visibility and reference*           resolution and provide access to the bio sequence data**/#include <ncbi_pch.hpp>#include <objmgr/scope.hpp>#include <objmgr/bioseq_handle.hpp>#include <objmgr/seq_entry_handle.hpp>#include <objmgr/seq_annot_handle.hpp>#include <objmgr/bioseq_set_handle.hpp>#include <objmgr/impl/scope_impl.hpp>#include <objmgr/impl/synonyms.hpp>BEGIN_NCBI_SCOPEBEGIN_SCOPE(objects)///////////////////////////////////////////////////////////////////////////////// CScope///////////////////////////////////////////////////////////////////////////////CScope::CScope(CObjectManager& objmgr){    if ( CanBeDeleted() ) {        // this CScope object is allocated in heap        m_Impl.Reset(new CScope_Impl(objmgr));        m_Impl->m_HeapScope = this;    }    else {        // allocate heap CScope object        m_HeapScope.Reset(new CScope(objmgr));        _ASSERT(m_HeapScope->CanBeDeleted());        m_Impl = m_HeapScope->m_Impl;        _ASSERT(m_Impl);    }}CScope::~CScope(void){    if ( bool(m_Impl) && m_Impl->m_HeapScope == this ) {        m_Impl->m_HeapScope = 0;    }}CBioseq_Handle CScope::GetBioseqHandle(const CSeq_id& id){    return m_Impl->GetBioseqHandle(id, eGetBioseq_All);}CBioseq_Handle CScope::GetBioseqHandle(const CSeq_id_Handle& id){    return m_Impl->GetBioseqHandle(id, eGetBioseq_All);}CBioseq_Handle CScope::GetBioseqHandle(const CSeq_loc& loc){    return m_Impl->GetBioseqHandle(loc, eGetBioseq_All);}CBioseq_Handle CScope::GetBioseqHandle(const CBioseq& seq){    //ERR_POST_ONCE(Warning<<"CScope::GetBioseqHandle(CBioseq&) is deprecated");    return m_Impl->GetBioseqHandle(seq);}CBioseq_Handle CScope::GetBioseqHandle(const CSeq_id& id,                                       EGetBioseqFlag get_flag){    return m_Impl->GetBioseqHandle(id, get_flag);}CBioseq_Handle CScope::GetBioseqHandle(const CSeq_id_Handle& id,                                       EGetBioseqFlag get_flag){    return m_Impl->GetBioseqHandle(id, get_flag);}CSeq_entry_Handle CScope::GetSeq_entryHandle(const CSeq_entry& entry){    //ERR_POST_ONCE(Warning<<"CScope::GetSeq_entryHandle(CSeq_entry&) is deprecated.");    return m_Impl->GetSeq_entryHandle(entry);}CSeq_annot_Handle CScope::GetSeq_annotHandle(const CSeq_annot& annot){    //ERR_POST_ONCE(Warning<<"CScope::GetSeq_annotHandle(CSeq_annot&) is deprecated.");    return m_Impl->GetSeq_annotHandle(annot);}CBioseq_Handle CScope::GetBioseqHandleFromTSE(const CSeq_id& id,                                              const CBioseq_Handle& bh){    return m_Impl->GetBioseqHandleFromTSE(id, bh);}CBioseq_Handle CScope::GetBioseqHandleFromTSE(const CSeq_id& id,                                              const CSeq_entry_Handle& seh){    return m_Impl->GetBioseqHandleFromTSE(id, seh);}CBioseq_Handle CScope::GetBioseqHandleFromTSE(const CSeq_id_Handle& id,                                              const CBioseq_Handle& bh){    return m_Impl->GetBioseqHandleFromTSE(id, bh);}CBioseq_Handle CScope::GetBioseqHandleFromTSE(const CSeq_id_Handle& id,                                              const CSeq_entry_Handle& seh){    return m_Impl->GetBioseqHandleFromTSE(id, seh);}void CScope::GetAllTSEs(TTSE_Handles& tses, enum ETSEKind kind){    m_Impl->GetAllTSEs(tses, int(kind));}CBioseq_EditHandle CScope::GetEditHandle(const CBioseq_Handle& seq){    return m_Impl->GetEditHandle(seq);}CSeq_entry_EditHandle CScope::GetEditHandle(const CSeq_entry_Handle& entry){    return m_Impl->GetEditHandle(entry);}CSeq_annot_EditHandle CScope::GetEditHandle(const CSeq_annot_Handle& annot){    return m_Impl->GetEditHandle(annot);}CBioseq_set_EditHandle CScope::GetEditHandle(const CBioseq_set_Handle& seqset){    return m_Impl->GetEditHandle(seqset);}void CScope::ResetHistory(void){    m_Impl->ResetHistory();}CConstRef<CSynonymsSet> CScope::GetSynonyms(const CSeq_id& id){    return m_Impl->GetSynonyms(id);}CConstRef<CSynonymsSet> CScope::GetSynonyms(const CSeq_id_Handle& id){    return m_Impl->GetSynonyms(id);}CConstRef<CSynonymsSet> CScope::GetSynonyms(const CBioseq_Handle& bh){    return m_Impl->GetSynonyms(bh);}void CScope::AddDefaults(TPriority priority){    m_Impl->AddDefaults(priority);}void CScope::AddDataLoader(const string& loader_name, TPriority priority){    m_Impl->AddDataLoader(loader_name, priority);}void CScope::AddScope(CScope& scope, TPriority priority){    m_Impl->AddScope(*scope.m_Impl, priority);}CSeq_entry_Handle CScope::AddTopLevelSeqEntry(CSeq_entry& top_entry,                                              TPriority priority){    return m_Impl->AddTopLevelSeqEntry(top_entry, priority);}CBioseq_Handle CScope::AddBioseq(CBioseq& bioseq, TPriority priority){    return m_Impl->AddBioseq(bioseq, priority);}CBioseq_Handle CScope::GetBioseqHandleFromTSE(const CSeq_id& id,                                              const CSeq_entry& tse){    //ERR_POST_ONCE(Warning<<"GetBioseqHandleFromTSE(CSeq_entry) is deprecated: use handles.");    return GetBioseqHandleFromTSE(id, GetSeq_entryHandle(tse));}CBioseq_Handle CScope::GetBioseqHandleFromTSE(const CSeq_id_Handle& id,                                              const CSeq_entry& tse){    //ERR_POST_ONCE(Warning<<"GetBioseqHandleFromTSE(CSeq_entry) is deprecated: use handles.");    return GetBioseqHandleFromTSE(id, GetSeq_entryHandle(tse));}void CScope::AttachEntry(CSeq_entry& parent, CSeq_entry& entry){    //ERR_POST_ONCE(Warning<<"CScope::AttachEntry() is deprecated: use class CSeq_entry_EditHandle.");    GetSeq_entryHandle(parent).GetSet().GetEditHandle().AttachEntry(entry);}void CScope::RemoveEntry(CSeq_entry& entry){    //ERR_POST_ONCE(Warning<<"CScope::RemoveEntry() is deprecated: use class CSeq_entry_EditHandle.");    GetSeq_entryHandle(entry).GetEditHandle().Remove();}void CScope::AttachAnnot(CSeq_entry& parent, CSeq_annot& annot){    //ERR_POST_ONCE(Warning<<"CScope::AttachAnnot() is deprecated: use class CSeq_annot_EditHandle.");    GetSeq_entryHandle(parent).GetEditHandle().AttachAnnot(annot);}void CScope::RemoveAnnot(CSeq_entry& parent, CSeq_annot& annot){    //ERR_POST_ONCE(Warning<<"CScope::RemoveAnnot() is deprecated: use class CSeq_annot_EditHandle.");    CSeq_entry_EditHandle eh = GetSeq_entryHandle(parent).GetEditHandle();    CSeq_annot_EditHandle ah = GetSeq_annotHandle(annot).GetEditHandle();    if ( ah.GetParentEntry() != eh ) {        NCBI_THROW(CObjMgrException, eModifyDataError,                   "CScope::RemoveAnnot: parent doesn't contain annot");    }    ah.Remove();}void CScope::ReplaceAnnot(CSeq_entry& parent,                          CSeq_annot& old_annot, CSeq_annot& new_annot){    //ERR_POST_ONCE(Warning<<"CScope::RemoveAnnot() is deprecated: use class CSeq_annot_EditHandle.");    CSeq_entry_EditHandle eh = GetSeq_entryHandle(parent).GetEditHandle();    CSeq_annot_EditHandle ah = GetSeq_annotHandle(old_annot).GetEditHandle();    if ( ah.GetParentEntry() != eh ) {        NCBI_THROW(CObjMgrException, eModifyDataError,                   "CScope::ReplaceAnnot: parent doesn't contain old_annot");    }    ah.Remove();    eh.AttachAnnot(new_annot);}END_SCOPE(objects)END_NCBI_SCOPE/** ---------------------------------------------------------------------------* $Log: scope.cpp,v $* Revision 1000.5  2004/06/01 19:23:36  gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.107** Revision 1.107  2004/05/21 21:42:12  gorelenk* Added PCH ncbi_pch.hpp** Revision 1.106  2004/04/13 15:59:35  grichenk* Added CScope::GetBioseqHandle() with id resolving flag.** Revision 1.105  2004/04/12 18:40:24  grichenk* Added GetAllTSEs()** Revision 1.104  2004/03/24 18:30:30  vasilche* Fixed edit API.* Every *_Info object has its own shallow copy of original object.** Revision 1.103  2004/03/16 21:01:32  vasilche* Added methods to move Bioseq withing Seq-entry** Revision 1.102  2004/03/16 15:47:28  vasilche* Added CBioseq_set_Handle and set of EditHandles** Revision 1.101  2004/02/19 17:23:01  vasilche

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?