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

Go to the SVN repository for this file.

1 /* $Id: seq_entry_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 
36 #include <corelib/ncbiexpt.hpp>
37 
40 
43 ///////////////////////////////////////////////////////////////////////////////
44 ///////////////////////////////////////////////////////////////////////////////
45 
48  CScope_Impl& scope)
49  : m_Handle(handle), m_Scope(scope)
50 {
51 }
53 {
54 }
55 
57 {
58  if (m_Handle.IsSeq())
60  else if(m_Handle.IsSet())
62  else
63  return;
64  tr.AddCommand(CRef<IEditCommand>(this));
67  if (saver) {
68  tr.AddEditSaver(saver);
71  else if(m_BioseqSetHandle.IsRemoved())
73  }
74 
75 }
77 {
80  if (m_BioseqHandle.IsRemoved()) {
82  if (saver)
84  }
85  else if (m_BioseqSetHandle.IsRemoved()) {
87  if (saver)
89  }
90 }
91 ///////////////////////////////////////////////////////////////////////////////
92 ///////////////////////////////////////////////////////////////////////////////
93 
95 {
96 }
97 
99 {
100  _ASSERT(m_Handle.GetParentEntry()); // Does not handle TSE
103  if( m_Index < 0 )
104  return;
105  tr.AddCommand(CRef<IEditCommand>(this));
106  IEditSaver* saver = GetEditSaver(m_Handle);
108  if (saver) {
109  tr.AddEditSaver(saver);
111  }
112 }
113 
115 {
117  IEditSaver* saver = GetEditSaver(m_Handle);
118  if (saver) {
120  }
121 }
122 
123 
124 ///////////////////////////////////////////////////////////////////////////////
125 ///////////////////////////////////////////////////////////////////////////////
126 
128 {
129 }
130 
132 {
133  _ASSERT(!m_Handle.GetParentEntry()); // Handles TSE only
135  // TODO entry.Reset();
136  IEditSaver* saver = GetEditSaver(m_Handle);
138  tr.AddCommand(CRef<IEditCommand>(this));
139  if (saver) {
140  tr.AddEditSaver(saver);
141  saver->RemoveTSE(tse, IEditSaver::eDo);
142  }
143 
144 }
146 {
147  _ASSERT(0);
149  "CRemoveTSE_EditCommand::Undo() is not implemented yet");
150 }
151 
static CRef< CScope > m_Scope
CRef –.
Definition: ncbiobj.hpp:618
virtual void Do(IScopeTransaction_Impl &tr)
CSeq_entry_EditHandle m_Handle
void RemoveEntry(const CSeq_entry_EditHandle &entry)
CBioseq_set_EditHandle SelectSet(const CSeq_entry_EditHandle &entry, CBioseq_set &seqset)
Definition: scope_impl.cpp:817
void SelectNone(const CSeq_entry_EditHandle &entry)
CSeq_entry_EditHandle AttachEntry(const CBioseq_set_EditHandle &seqset, CSeq_entry &entry, int index=-1)
Definition: scope_impl.cpp:696
CBioseq_EditHandle SelectSeq(const CSeq_entry_EditHandle &entry, CBioseq &seq)
Definition: scope_impl.cpp:760
void RemoveTopLevelSeqEntry(const CTSE_Handle &entry)
Definition: scope_impl.cpp:483
CSeq_entry_Handle –.
int m_Index
virtual void Do(IScopeTransaction_Impl &tr)
CScope_Impl & m_Scope
virtual void Undo()
virtual ~CSeq_entry_Remove_EditCommand()
CSeq_entry_EditHandle m_Handle
CBioseq_set_EditHandle m_ParentHandle
CScope_Impl & m_Scope
CBioseq_EditHandle m_BioseqHandle
CSeq_entry_EditHandle m_Handle
virtual void Undo()
virtual ~CSeq_entry_SelectNone_EditCommand()
virtual void Do(IScopeTransaction_Impl &tr)
CBioseq_set_EditHandle m_BioseqSetHandle
Edit Saver Interface.
Definition: edit_saver.hpp:72
virtual void Remove(const CSeq_entry_Handle &entry, const CSeq_annot_Handle &what, 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 RemoveTSE(const CTSE_Handle &handle, ECallMode)=0
virtual void Attach(const CBioObjectId &old_id, const CSeq_entry_Handle &entry, const CBioseq_Handle &what, ECallMode)=0
virtual void Detach(const CSeq_entry_Handle &entry, const CBioseq_Handle &what, ECallMode)=0
virtual void AddCommand(TCommand)=0
virtual void AddEditSaver(IEditSaver *)=0
IEditSaver * GetEditSaver(const Handle &handle)
#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
CBioseq_set_EditHandle GetParentBioseq_set(void) const
Get parent bioseq-set edit handle.
const CBioObjectId & GetBioObjectId(void) const
Get unique object id.
bool IsRemoved(void) const
const CTSE_Handle & GetTSE_Handle(void) const
bool IsRemoved(void) const
Check if handle points to a removed bioseq.
bool IsSet(void) const
CSeq_entry_EditHandle GetParentEntry(void) const
Get parent seq-entry edit handle.
int GetSeq_entry_Index(const CSeq_entry_Handle &handle) const
bool IsSeq(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
Defines NCBI C++ exception handling.
#define _ASSERT
#define const
Definition: zconf.h:232
Modified on Fri Sep 20 14:58:25 2024 by modify_doxy.py rev. 669887