NCBI C++ ToolKit
seq_align_handle.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: seq_align_handle.cpp 89815 2020-04-24 14:46:02Z vasilche $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Author: Aleksey Grichenko, Eugene Vasilchenko
27 *
28 * File Description:
29 * Seq-align handle
30 *
31 */
32 
33 
34 #include <ncbi_pch.hpp>
36 #include <objmgr/scope.hpp>
39 
41 
44 
45 
47  TIndex index)
48  : m_Annot(annot),
49  m_AnnotIndex(index)
50 {
51  _ASSERT(!IsRemoved());
52  _ASSERT(annot.x_GetInfo().GetInfo(index).IsAlign());
53 }
54 
55 
57 {
59  m_Annot.Reset();
60 }
61 
62 
64 {
67  if ( info.IsRemoved() ) {
68  NCBI_THROW(CObjMgrException, eInvalidHandle,
69  "CSeq_align_Handle: removed");
70  }
71  return info.GetAlign();
72 }
73 
74 
76 {
77  return ConstRef(&x_GetSeq_align());
78 }
79 
80 
82 {
84 }
85 
86 
87 void CSeq_align_Handle::Remove(void) const
88 {
90  CCommandProcessor processor(GetAnnot().x_GetScopeImpl());
91  processor.run(new TCommand(*this));
92 }
93 
94 
95 void CSeq_align_Handle::Replace(const CSeq_align& new_obj) const
96 {
98  CCommandProcessor processor(GetAnnot().x_GetScopeImpl());
99  processor.run(new TCommand(*this, new_obj));
100 }
101 
103 {
105 }
106 
108 {
110  _ASSERT(IsRemoved());
111 }
112 
113 
115 {
116  if ( GetAnnot().GetEditHandle().x_GetInfo().Replace(m_AnnotIndex, new_obj) ) {
118  }
119  _ASSERT(!IsRemoved());
120 }
121 
bool IsRemoved(void) const
CMDReturn< CMD >::TReturn run(CMD *cmd)
Base class for all object manager exceptions.
void x_ClearAnnotCache(void)
CSeq_annot_Handle –.
void Remove(TAnnotIndex index)
const CAnnotObject_Info & GetInfo(TAnnotIndex index) const
void Update(TAnnotIndex index)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
CSeq_annot_Info & x_GetInfo(void) const
void Update(void) const
Update index after manual modification of the object.
void Remove(void) const
Remove the Seq-align from Seq-annot.
CScope_Impl & x_GetScopeImpl(void) const
CSeq_annot_Handle m_Annot
void Replace(const CSeq_align &new_obj) const
Replace the Seq-align with new Seq-align object.
void x_RealRemove(void) const
Remove the Seq-align from Seq-annot.
CConstRef< CSeq_align > GetSeq_align(void) const
Get const reference to current seq-align.
const CSeq_align & x_GetSeq_align(void) const
CSeq_annot_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
const CSeq_annot_Info & x_GetInfo(void) const
bool IsRemoved(void) const
Return true if this Seq-align was removed already.
void x_RealReplace(const CSeq_align &new_obj) const
Replace the Seq-align with new Seq-align object.
const CSeq_annot_Handle & GetAnnot(void) const
Get handle to the seq-annot.
CConstRef< C > ConstRef(const C *object)
Template function for conversion of const object pointer to CConstRef.
Definition: ncbiobj.hpp:2024
#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
static MDB_envinfo info
Definition: mdb_load.c:37
#define _ASSERT
#define const
Definition: zconf.h:232
Modified on Thu Jun 13 17:32:29 2024 by modify_doxy.py rev. 669887