]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOM/GEOM_IOperations.hxx
Salome HOME
Merge with version on tag OCC-V2_1_0d
[modules/geom.git] / src / GEOM / GEOM_IOperations.hxx
1
2 #ifndef _GEOM_IOperations_HXX_
3 #define _GEOM_IOperations_HXX_
4
5 #include "GEOM_Engine.hxx"
6 #include <TDocStd_Document.hxx>
7 #include <TCollection_AsciiString.hxx>
8 #include "GEOM_Object.hxx"
9 #include "GEOM_Solver.hxx"
10
11 #define OK "PAL_NO_ERROR"
12 #define KO "PAL_NOT_DONE_ERROR"
13 #define ALREADY_PRESENT "PAL_ELEMENT_ALREADY_PRESENT"
14 #define NOT_EXISTS "PAL_ELEMENT_DOES_NOT_EXISTS"
15 #define INVALID_TYPE "INVALID_TYPE_OF_ELEMENT"
16
17 class GEOM_IOperations
18 {
19  public:
20   GEOM_IOperations(GEOM_Engine* theEngine, int theDocID);
21   ~GEOM_IOperations();
22
23   //Starts a new operation (opens a tansaction)
24   void StartOperation();
25  
26   //Finishes the previously started operation (closes the transaction)
27   void FinishOperation();
28
29   //Aborts the operation 
30   void AbortOperation();
31  
32   //Returns true if the last operation succided
33   bool IsDone();
34
35   //Sets Not done error code
36   void SetNotDone() { _errorCode = KO; }
37
38   //Sets an error code of the operation
39   void SetErrorCode(const TCollection_AsciiString& theErrorCode) {
40     _errorCode = theErrorCode;    
41   } 
42  
43   //Returns an error code of the last operatioin
44   char* GetErrorCode() {
45     return _errorCode.ToCString();    
46   }
47   
48   //Returns a pointer to  GEOM_Engine which this operation interface is associated
49   GEOM_Engine* GetEngine() { return _engine; }
50
51   //Return a pointer to Solver associated with this operation interface
52   GEOM_Solver* GetSolver() { return _solver; }
53
54   //Returns an ID of the OCAF document where this operation stores the data
55   int GetDocID() { return _docID; }
56
57  private:
58   
59   TCollection_AsciiString _errorCode;
60   GEOM_Engine*   _engine;
61   GEOM_Solver*   _solver;
62   int                     _docID;
63
64 };
65
66 #endif