b311480e |
1 | -- Created by: DAUTRY Philippe |
2 | -- Copyright (c) 1997-1999 Matra Datavision |
3 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
4 | -- |
5 | -- The content of this file is subject to the Open CASCADE Technology Public |
6 | -- License Version 6.5 (the "License"). You may not use the content of this file |
7 | -- except in compliance with the License. Please obtain a copy of the License |
8 | -- at http://www.opencascade.org and read it completely before using this file. |
9 | -- |
10 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
11 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
12 | -- |
13 | -- The Original Code and all software distributed under the License is |
14 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
15 | -- Initial Developer hereby disclaims all such warranties, including without |
16 | -- limitation, any warranties of merchantability, fitness for a particular |
17 | -- purpose or non-infringement. Please see the License for the specific terms |
18 | -- and conditions governing the rights and limitations under the License. |
19 | |
7fd59977 |
20 | -- ------------------- |
7fd59977 |
21 | |
22 | ---Version: 0.0 |
b311480e |
23 | --Version Date Purpose |
7fd59977 |
24 | -- 0.0 Oct 1 1997 Creation |
25 | |
26 | |
27 | class Transaction from TDF |
28 | |
29 | ---Purpose: This class offers services to open, commit or |
30 | -- abort a transaction in a more secure way than |
31 | -- using Data from TDF. If you forget to close a |
32 | -- transaction, it will be automaticaly aborted at |
33 | -- the destruction of this object, at the closure of |
34 | -- its scope. |
35 | -- |
36 | -- In case of catching errors, the effect will be the |
37 | -- same: aborting transactions until the good current |
38 | -- one. |
39 | |
40 | uses |
41 | |
42 | Data from TDF, |
43 | Delta from TDF, |
44 | AsciiString from TCollection |
45 | |
46 | raises |
47 | |
48 | DomainError, NullObject from Standard |
49 | |
50 | is |
51 | |
52 | Create(aName : AsciiString from TCollection = "") |
53 | returns Transaction from TDF; |
54 | ---Purpose: Creates an empty transaction context, unable to be |
55 | -- opened. |
56 | |
57 | Create(aTrans : Transaction from TDF) |
58 | returns Transaction from TDF |
59 | is private; |
60 | ---Purpose: Private to avoid copy. |
61 | |
62 | Create(aDF : Data from TDF; |
63 | aName : AsciiString from TCollection = "") |
64 | returns Transaction from TDF; |
65 | ---Purpose: Creates a transaction context on <aDF>, ready to |
66 | -- be opened. |
67 | |
68 | Initialize(me : in out; aDF : Data from TDF); |
69 | ---Purpose: Aborts all the transactions on <myDF> and sets |
70 | -- <aDF> to build a transaction context on <aDF>, |
71 | -- ready to be opened. |
72 | |
73 | Open(me : in out) |
74 | returns Integer from Standard |
75 | raises DomainError, NullObject from Standard; |
76 | ---Purpose: If not yet done, opens a new transaction on |
77 | -- <myDF>. Returns the index of the just opened |
78 | -- transaction. |
79 | -- |
80 | -- It raises DomainError if the transaction is |
81 | -- already open, and NullObject if there is no |
82 | -- current Data framework. |
83 | |
84 | Commit(me : in out; |
85 | withDelta : Boolean from Standard = Standard_False) |
86 | returns Delta from TDF; |
87 | ---Purpose: Commits the transactions until AND including the |
88 | -- current opened one. |
89 | |
90 | Abort(me : in out); |
91 | ---Purpose: Aborts the transactions until AND including the |
92 | -- current opened one. |
93 | -- |
94 | ---C++: alias ~ |
95 | |
96 | Data(me) returns Data from TDF; |
97 | ---Purpose: Returns the Data from TDF. |
98 | -- |
99 | ---C++: inline |
100 | |
101 | Transaction(me) returns Integer from Standard; |
102 | ---Purpose: Returns the number of the transaction opened by <me>. |
103 | -- |
104 | ---C++: inline |
105 | |
106 | Name(me) returns AsciiString from TCollection; |
107 | ---Purpose: Returns the transaction name. |
108 | -- |
109 | ---C++: return const & |
110 | |
111 | IsOpen(me) |
112 | returns Boolean from Standard; |
113 | ---Purpose: Returns true if the transaction is open. |
114 | -- |
115 | ---C++: inline |
116 | |
117 | |
118 | fields |
119 | |
120 | myDF : Data from TDF; |
121 | myUntilTransaction : Integer from Standard; |
122 | myName : AsciiString from TCollection; |
123 | |
124 | end Transaction; |