Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
GEOM_IOperations.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 #ifndef _GEOM_IOperations_HXX_
24 #define _GEOM_IOperations_HXX_
25 
26 #include "GEOM_Engine.hxx"
27 #include <TDocStd_Document.hxx>
28 #include <TCollection_AsciiString.hxx>
29 #include "GEOM_Object.hxx"
30 #include "GEOM_Solver.hxx"
31 
32 #define OK "PAL_NO_ERROR"
33 #define KO "PAL_NOT_DONE_ERROR"
34 #define NOT_FOUND_ANY "NOT_FOUND_ANY"
35 #define ALREADY_PRESENT "PAL_ELEMENT_ALREADY_PRESENT"
36 #define NOT_EXISTS "PAL_ELEMENT_DOES_NOT_EXISTS"
37 #define INVALID_TYPE "INVALID_TYPE_OF_ELEMENT"
38 
40 {
41  public:
42  Standard_EXPORT GEOM_IOperations(GEOM_Engine* theEngine, int theDocID);
43  Standard_EXPORT ~GEOM_IOperations();
44 
45  //Starts a new operation (opens a tansaction)
46  Standard_EXPORT void StartOperation();
47 
48  //Finishes the previously started operation (closes the transaction)
49  Standard_EXPORT void FinishOperation();
50 
51  //Aborts the operation
52  Standard_EXPORT void AbortOperation();
53 
54  //Returns true if the last operation succided
55  Standard_EXPORT bool IsDone();
56 
57  //Sets Not done error code
58  Standard_EXPORT void SetNotDone() { _errorCode = KO; }
59 
60  //Sets an error code of the operation
61  Standard_EXPORT void SetErrorCode(const TCollection_AsciiString& theErrorCode) {
62  _errorCode = theErrorCode;
63  }
64 
65  //Returns an error code of the last operatioin
66  Standard_EXPORT char* GetErrorCode() {
67  return (char*) _errorCode.ToCString();
68  }
69 
70  //Returns a pointer to GEOM_Engine which this operation interface is associated
71  Standard_EXPORT GEOM_Engine* GetEngine() { return _engine; }
72 
73  //Return a pointer to Solver associated with this operation interface
74  Standard_EXPORT GEOM_Solver* GetSolver() { return _solver; }
75 
76  //Returns an ID of the OCAF document where this operation stores the data
77  Standard_EXPORT int GetDocID() { return _docID; }
78 
79  private:
80 
81  TCollection_AsciiString _errorCode;
84  int _docID;
85 
86 };
87 
88 #endif