0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / DDF / DDF_Transaction.hxx
CommitLineData
42cf5bc1 1// Created by: DAUTRY Philippe
2// Copyright (c) 1997-1999 Matra Datavision
3// Copyright (c) 1999-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _DDF_Transaction_HeaderFile
17#define _DDF_Transaction_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_Type.hxx>
21
22#include <TDF_Transaction.hxx>
23#include <MMgt_TShared.hxx>
24#include <Standard_Integer.hxx>
25#include <Standard_Boolean.hxx>
26class Standard_DomainError;
27class Standard_NullObject;
28class TDF_Data;
29class TDF_Delta;
30
31
32class DDF_Transaction;
33DEFINE_STANDARD_HANDLE(DDF_Transaction, MMgt_TShared)
34
35//! This class encapsulates TDF_Transaction.
36class DDF_Transaction : public MMgt_TShared
37{
38
39public:
40
41
42 //! Creates an empty transaction context, unable to be
43 //! opened.
44 Standard_EXPORT DDF_Transaction();
45
46 //! Creates a transaction context on <aDF>, ready to
47 //! be opened.
48 Standard_EXPORT DDF_Transaction(const Handle(TDF_Data)& aDF);
49
50 //! If not yet done, opens a new transaction on
51 //! <myDF>. Returns the index of the just opened
52 //! transaction.
53 //!
54 //! It raises DomainError if the transaction is
55 //! already open, and NullObject if there is no
56 //! current Data framework.
57 Standard_EXPORT Standard_Integer Open();
58
59 //! Commits the transactions until AND including the
60 //! current opened one.
61 Standard_EXPORT Handle(TDF_Delta) Commit (const Standard_Boolean withDelta = Standard_False);
62
63 //! Aborts the transactions until AND including the
64 //! current opened one.
65 Standard_EXPORT void Abort();
66~DDF_Transaction()
67{
68 Abort();
69}
70
71 //! Returns the Data from TDF.
72 Standard_EXPORT Handle(TDF_Data) Data() const;
73
74 //! Returns the number of the transaction opened by <me>.
75 Standard_EXPORT Standard_Integer Transaction() const;
76
77 //! Returns true if the transaction is open.
78 Standard_EXPORT Standard_Boolean IsOpen() const;
79
80
81
92efcf78 82 DEFINE_STANDARD_RTTIEXT(DDF_Transaction,MMgt_TShared)
42cf5bc1 83
84protected:
85
86
87
88
89private:
90
91
92 TDF_Transaction myTransaction;
93
94
95};
96
97
98
99
100
101
102
103#endif // _DDF_Transaction_HeaderFile