00001 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE 00002 // 00003 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 00005 // 00006 // This library is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU Lesser General Public 00008 // License as published by the Free Software Foundation; either 00009 // version 2.1 of the License. 00010 // 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public 00017 // License along with this library; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 // 00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com 00021 // 00022 00023 #ifndef _GEOM_IOperations_HXX_ 00024 #define _GEOM_IOperations_HXX_ 00025 00026 #include "GEOM_Engine.hxx" 00027 #include <TDocStd_Document.hxx> 00028 #include <TCollection_AsciiString.hxx> 00029 #include "GEOM_Object.hxx" 00030 #include "GEOM_Solver.hxx" 00031 00032 #define OK "PAL_NO_ERROR" 00033 #define KO "PAL_NOT_DONE_ERROR" 00034 #define NOT_FOUND_ANY "NOT_FOUND_ANY" 00035 #define ALREADY_PRESENT "PAL_ELEMENT_ALREADY_PRESENT" 00036 #define NOT_EXISTS "PAL_ELEMENT_DOES_NOT_EXISTS" 00037 #define INVALID_TYPE "INVALID_TYPE_OF_ELEMENT" 00038 00039 class GEOM_IOperations 00040 { 00041 public: 00042 Standard_EXPORT GEOM_IOperations(GEOM_Engine* theEngine, int theDocID); 00043 Standard_EXPORT ~GEOM_IOperations(); 00044 00045 //Starts a new operation (opens a tansaction) 00046 Standard_EXPORT void StartOperation(); 00047 00048 //Finishes the previously started operation (closes the transaction) 00049 Standard_EXPORT void FinishOperation(); 00050 00051 //Aborts the operation 00052 Standard_EXPORT void AbortOperation(); 00053 00054 //Returns true if the last operation succided 00055 Standard_EXPORT bool IsDone(); 00056 00057 //Sets Not done error code 00058 Standard_EXPORT void SetNotDone() { _errorCode = KO; } 00059 00060 //Sets an error code of the operation 00061 Standard_EXPORT void SetErrorCode(const TCollection_AsciiString& theErrorCode) { 00062 _errorCode = theErrorCode; 00063 } 00064 00065 //Returns an error code of the last operatioin 00066 Standard_EXPORT char* GetErrorCode() { 00067 return (char*) _errorCode.ToCString(); 00068 } 00069 00070 //Returns a pointer to GEOM_Engine which this operation interface is associated 00071 Standard_EXPORT GEOM_Engine* GetEngine() { return _engine; } 00072 00073 //Return a pointer to Solver associated with this operation interface 00074 Standard_EXPORT GEOM_Solver* GetSolver() { return _solver; } 00075 00076 //Returns an ID of the OCAF document where this operation stores the data 00077 Standard_EXPORT int GetDocID() { return _docID; } 00078 00079 private: 00080 00081 TCollection_AsciiString _errorCode; 00082 GEOM_Engine* _engine; 00083 GEOM_Solver* _solver; 00084 int _docID; 00085 00086 }; 00087 00088 #endif