|
|
|||
File indexing completed on 2026-09-24 09:17:34
0001 // Created by: DAUTRY Philippe 0002 // Copyright (c) 1997-1999 Matra Datavision 0003 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0004 // 0005 // This file is part of Open CASCADE Technology software library. 0006 // 0007 // This library is free software; you can redistribute it and/or modify it under 0008 // the terms of the GNU Lesser General Public License version 2.1 as published 0009 // by the Free Software Foundation, with special exception defined in the file 0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0011 // distribution for complete text of the license and disclaimer of any warranty. 0012 // 0013 // Alternatively, this file may be used under the terms of Open CASCADE 0014 // commercial license or contractual agreement. 0015 0016 #ifndef _TDF_Transaction_HeaderFile 0017 #define _TDF_Transaction_HeaderFile 0018 0019 #include <Standard.hxx> 0020 #include <Standard_DefineAlloc.hxx> 0021 #include <Standard_Handle.hxx> 0022 0023 #include <Standard_Integer.hxx> 0024 #include <TCollection_AsciiString.hxx> 0025 class TDF_Data; 0026 class TDF_Delta; 0027 0028 //! This class offers services to open, commit or 0029 //! abort a transaction in a more secure way than 0030 //! using Data from TDF. If you forget to close a 0031 //! transaction, it will be automatically aborted at 0032 //! the destruction of this object, at the closure of 0033 //! its scope. 0034 //! 0035 //! In case of catching errors, the effect will be the 0036 //! same: aborting transactions until the good current 0037 //! one. 0038 class TDF_Transaction 0039 { 0040 public: 0041 DEFINE_STANDARD_ALLOC 0042 0043 //! Creates an empty transaction context, unable to be 0044 //! opened. 0045 Standard_EXPORT TDF_Transaction(const TCollection_AsciiString& aName = ""); 0046 0047 //! Creates a transaction context on <aDF>, ready to 0048 //! be opened. 0049 Standard_EXPORT TDF_Transaction(const occ::handle<TDF_Data>& aDF, 0050 const TCollection_AsciiString& aName = ""); 0051 0052 //! Aborts all the transactions on <myDF> and sets 0053 //! <aDF> to build a transaction context on <aDF>, 0054 //! ready to be opened. 0055 Standard_EXPORT void Initialize(const occ::handle<TDF_Data>& aDF); 0056 0057 //! If not yet done, opens a new transaction on 0058 //! <myDF>. Returns the index of the just opened 0059 //! transaction. 0060 //! 0061 //! It raises DomainError if the transaction is 0062 //! already open, and NullObject if there is no 0063 //! current Data framework. 0064 Standard_EXPORT int Open(); 0065 0066 //! Commits the transactions until AND including the 0067 //! current opened one. 0068 Standard_EXPORT occ::handle<TDF_Delta> Commit(const bool withDelta = false); 0069 0070 //! Aborts the transactions until AND including the 0071 //! current opened one. 0072 Standard_EXPORT void Abort(); 0073 0074 ~TDF_Transaction() { Abort(); } 0075 0076 //! Returns the Data from TDF. 0077 occ::handle<TDF_Data> Data() const; 0078 0079 //! Returns the number of the transaction opened by <me>. 0080 int Transaction() const; 0081 0082 //! Returns the transaction name. 0083 const TCollection_AsciiString& Name() const; 0084 0085 //! Returns true if the transaction is open. 0086 bool IsOpen() const; 0087 0088 //! Dumps the content of me into the stream 0089 Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; 0090 0091 private: 0092 //! Private to avoid copy. 0093 TDF_Transaction(const TDF_Transaction& aTrans) = delete; 0094 TDF_Transaction& operator=(const TDF_Transaction& theOther) = delete; 0095 0096 private: 0097 occ::handle<TDF_Data> myDF; 0098 TCollection_AsciiString myName; 0099 int myUntilTransaction; 0100 }; 0101 0102 #include <TDF_Transaction.lxx> 0103 0104 #endif // _TDF_Transaction_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|