NCBI C++ ToolKit
scope_transaction.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef __OBJMGR__SCOPE_TRANSACTION__HPP
2 #define __OBJMGR__SCOPE_TRANSACTION__HPP
3 
4 /* $Id: scope_transaction.hpp 33815 2007-05-04 17:18:18Z kazimird $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Author: Maxim Didenko
30 *
31 * File Description:
32 * Scope transation
33 *
34 */
35 
36 #include <corelib/ncbistd.hpp>
37 #include <corelib/ncbiobj.hpp>
38 
39 
42 
43 class CScope;
45 
46 /// Scope Transaction
47 ///
48 /// An instance of this class can be used to combine editing operations into
49 /// a logical block. It only can be created by an instance of CSope class and
50 /// it can only be created on the stack. This class is not thread save.
51 ///
52 /// @sa IEditSaver
53 ///
55 {
56 public:
57 
58  /// Destractor. If method Commit has not been called explicitly
59  /// all modifications made during this transaction will be rollbacked.
60  ///
62 
63  /// Finish the editing operation.
64  /// if an instance of IEditSaver interface was attached to the TSE
65  /// of modified objects the method CommitTransaction of that interface
66  /// will be called.
67  ///
68  void Commit();
69 
70  /// Undo all made modificatins.
71  /// if an instance of IEditSaver interface was attached to the TSE
72  /// of modified objects the method RollBackTransaction of that interface
73  /// will be called.
74  ///
75  void RollBack();
76 
77  /// If the editing operation affects objects from another scope
78  /// this scope should be added to the current transaction.
79  void AddScope(CScope& scope);
80 
81 private:
82  friend class CScope;
84 
85  IScopeTransaction_Impl& x_GetImpl();
86  void x_Set(IScopeTransaction_Impl&);
87 
89 
90 private:
91  // only stack allocation is allowed
92  void* operator new(size_t);
93  void* operator new[](size_t);
94 
95 };
96 
99 
100 #endif // __OBJMGR__SCOPE_TRANSACTION__HPP
Scope Transaction.
CRef< CObject > m_Impl
CScope –.
Definition: scope.hpp:92
Include a standard set of the NCBI C++ Toolkit most basic headers.
friend class CScopeTransaction
Definition: scope.hpp:706
#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 NCBI_XOBJMGR_EXPORT
Definition: ncbi_export.h:1307
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Wed Sep 04 15:04:34 2024 by modify_doxy.py rev. 669887