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