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

Go to the SVN repository for this file.

1 /* $Id: bioseq_edit_commands.cpp 33815 2007-05-04 17:18:18Z kazimird $
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: Maxim Didenko
27 *
28 * File Description:
29 * Scope transaction
30 *
31 */
32 
33 
34 #include <ncbi_pch.hpp>
35 
37 #include <objmgr/bioseq_handle.hpp>
38 
41 
42 ///////////////////////////////////////////////////////////////////////////////
43 ///////////////////////////////////////////////////////////////////////////////
45  : m_Handle(handle)
46 {
47 }
49 {
50 }
51 
53 {
54  if (m_Handle.IsSetId()) {
55  const CBioseq_EditHandle::TId& ids = m_Handle.GetId();
56  m_Ids.insert(ids.begin(), ids.end());
60  if (saver) {
61  tr.AddEditSaver(saver);
63  }
64  }
65 }
67 {
68  ITERATE(TIds, it, m_Ids) {
69  m_Handle.x_RealAddId(*it);
70  }
72  if (saver) {
73  ITERATE(TIds, it, m_Ids) {
74  saver->AddId(m_Handle, *it, IEditSaver::eUndo);
75  }
76  }
77 }
78 
CBioseq_EditHandle –.
CRef –.
Definition: ncbiobj.hpp:618
virtual void Do(IScopeTransaction_Impl &tr)
const CBioseq_EditHandle & m_Handle
Edit Saver Interface.
Definition: edit_saver.hpp:72
virtual void ResetIds(const CBioseq_Handle &, const TIds &, ECallMode)=0
@ eUndo
The method is called when a modification has just been undone.
Definition: edit_saver.hpp:78
@ eDo
The method is called when a modification has just been done.
Definition: edit_saver.hpp:77
virtual void AddId(const CBioseq_Handle &, const CSeq_id_Handle &, ECallMode)=0
ID operation.
virtual void AddCommand(TCommand)=0
virtual void AddEditSaver(IEditSaver *)=0
Definition: set.hpp:45
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
IEditSaver * GetEditSaver(const Handle &handle)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
vector< CSeq_id_Handle > TId
void x_RealResetId(void) const
bool x_RealAddId(const CSeq_id_Handle &id) const
bool IsSetId(void) const
const TId & GetId(void) const
#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 const
Definition: zconf.h:232
Modified on Fri Sep 20 14:57:28 2024 by modify_doxy.py rev. 669887