Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/geom.git] / src / GEOM / GEOM_IOperations.hxx
1 //  Copyright (C) 2007-2008  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.
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 #ifndef _GEOM_IOperations_HXX_
23 #define _GEOM_IOperations_HXX_
24
25 #include "GEOM_Engine.hxx"
26 #include <TDocStd_Document.hxx>
27 #include <TCollection_AsciiString.hxx>
28 #include "GEOM_Object.hxx"
29 #include "GEOM_Solver.hxx"
30
31 #define OK "PAL_NO_ERROR"
32 #define KO "PAL_NOT_DONE_ERROR"
33 #define NOT_FOUND_ANY "NOT_FOUND_ANY"
34 #define ALREADY_PRESENT "PAL_ELEMENT_ALREADY_PRESENT"
35 #define NOT_EXISTS "PAL_ELEMENT_DOES_NOT_EXISTS"
36 #define INVALID_TYPE "INVALID_TYPE_OF_ELEMENT"
37
38 class GEOM_IOperations
39 {
40  public:
41   Standard_EXPORT GEOM_IOperations(GEOM_Engine* theEngine, int theDocID);
42   Standard_EXPORT ~GEOM_IOperations();
43
44   //Starts a new operation (opens a tansaction)
45   Standard_EXPORT void StartOperation();
46  
47   //Finishes the previously started operation (closes the transaction)
48   Standard_EXPORT void FinishOperation();
49
50   //Aborts the operation 
51   Standard_EXPORT void AbortOperation();
52  
53   //Returns true if the last operation succided
54   Standard_EXPORT bool IsDone();
55
56   //Sets Not done error code
57   Standard_EXPORT void SetNotDone() { _errorCode = KO; }
58
59   //Sets an error code of the operation
60   Standard_EXPORT void SetErrorCode(const TCollection_AsciiString& theErrorCode) {
61     _errorCode = theErrorCode;    
62   } 
63  
64   //Returns an error code of the last operatioin
65   Standard_EXPORT char* GetErrorCode() {
66     return (char*) _errorCode.ToCString();    
67   }
68   
69   //Returns a pointer to  GEOM_Engine which this operation interface is associated
70   Standard_EXPORT GEOM_Engine* GetEngine() { return _engine; }
71
72   //Return a pointer to Solver associated with this operation interface
73   Standard_EXPORT GEOM_Solver* GetSolver() { return _solver; }
74
75   //Returns an ID of the OCAF document where this operation stores the data
76   Standard_EXPORT int GetDocID() { return _docID; }
77
78  private:
79   
80   TCollection_AsciiString _errorCode;
81   GEOM_Engine*   _engine;
82   GEOM_Solver*   _solver;
83   int                     _docID;
84
85 };
86
87 #endif