0032806: Coding - get rid of unused headers [Contap to Extrema]
[occt.git] / src / DDF / DDF_Transaction.hxx
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
21 #include <TDF_Transaction.hxx>
22 #include <Standard_Transient.hxx>
23 #include <Standard_Integer.hxx>
24 class TDF_Data;
25 class TDF_Delta;
26
27
28 class DDF_Transaction;
29 DEFINE_STANDARD_HANDLE(DDF_Transaction, Standard_Transient)
30
31 //! This class encapsulates TDF_Transaction.
32 class DDF_Transaction : public Standard_Transient
33 {
34
35 public:
36
37   
38   //! Creates an empty transaction context, unable to be
39   //! opened.
40   Standard_EXPORT DDF_Transaction();
41   
42   //! Creates a transaction context on <aDF>, ready to
43   //! be opened.
44   Standard_EXPORT DDF_Transaction(const Handle(TDF_Data)& aDF);
45   
46   //! If not yet done, opens a new transaction on
47   //! <myDF>. Returns the index of the just opened
48   //! transaction.
49   //!
50   //! It raises DomainError if the transaction is
51   //! already open, and NullObject if there is no
52   //! current Data framework.
53   Standard_EXPORT Standard_Integer Open();
54   
55   //! Commits the transactions until AND including the
56   //! current opened one.
57   Standard_EXPORT Handle(TDF_Delta) Commit (const Standard_Boolean withDelta = Standard_False);
58   
59   //! Aborts the transactions until AND including the
60   //! current opened one.
61   Standard_EXPORT void Abort();
62 ~DDF_Transaction()
63 {
64   Abort();
65 }
66   
67   //! Returns the Data from TDF.
68   Standard_EXPORT Handle(TDF_Data) Data() const;
69   
70   //! Returns the number of the transaction opened by <me>.
71   Standard_EXPORT Standard_Integer Transaction() const;
72   
73   //! Returns true if the transaction is open.
74   Standard_EXPORT Standard_Boolean IsOpen() const;
75
76
77
78   DEFINE_STANDARD_RTTIEXT(DDF_Transaction,Standard_Transient)
79
80 protected:
81
82
83
84
85 private:
86
87
88   TDF_Transaction myTransaction;
89
90
91 };
92
93
94
95
96
97
98
99 #endif // _DDF_Transaction_HeaderFile