Salome HOME
NPAL16559: EDF507: Implementation of a more advanced system of measurement.
[modules/geom.git] / src / GEOM_I / GEOM_IOperations_i.cc
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 #include "GEOM_IOperations_i.hh"
21
22 #include "GEOM_Engine.hxx"
23
24 #include "utilities.h"
25 #include "OpUtil.hxx"
26 #include "Utils_ExceptHandlers.hxx"
27
28 #include <Standard_Stream.hxx>
29 #include <TCollection_AsciiString.hxx>
30 #include <TDF_Tool.hxx>
31
32 //=============================================================================
33 /*!
34  *  default constructor:
35  */
36 //=============================================================================
37
38 GEOM_IOperations_i::GEOM_IOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOM_IOperations* theImpl)
39 :SALOME::GenericObj_i( thePOA ), _impl(theImpl), _engine(theEngine)
40 {
41   thePOA->activate_object(this);
42 }
43
44 //=============================================================================
45 /*!
46  *  destructor
47  */
48 //=============================================================================
49
50 GEOM_IOperations_i::~GEOM_IOperations_i()
51 {}
52
53
54 //=============================================================================
55 /*!
56  *  IsDone
57  */
58 //=============================================================================
59 CORBA::Boolean GEOM_IOperations_i::IsDone()
60 {
61   return _impl->IsDone();
62 }
63
64
65 //=============================================================================
66 /*!
67  *  SetErrorCode
68  */
69 //=============================================================================
70 void GEOM_IOperations_i::SetErrorCode(const char* theErrorCode)
71 {
72   _impl->SetErrorCode((char*)theErrorCode);
73 }
74
75 //=============================================================================
76 /*!
77  *  GetErrorCode
78  */
79 //=============================================================================
80 char* GEOM_IOperations_i::GetErrorCode()
81 {
82   return CORBA::string_dup(_impl->GetErrorCode());
83 }
84
85 //=============================================================================
86 /*!
87  *  GetStudyID
88  */
89 //=============================================================================
90 CORBA::Long GEOM_IOperations_i::GetStudyID()
91 {
92   return _impl->GetDocID();
93 }
94
95 //=============================================================================
96 /*!
97  *  StartOperation
98  */
99 //=============================================================================
100 void GEOM_IOperations_i::StartOperation()
101 {
102   _impl->StartOperation();
103 }
104
105 //=============================================================================
106 /*!
107  *  FinishOperation
108  */
109 //=============================================================================
110 void GEOM_IOperations_i::FinishOperation()
111 {
112   _impl->FinishOperation();
113 }
114
115
116 //=============================================================================
117 /*!
118  *  AboutOperation
119  */
120 //=============================================================================
121 void GEOM_IOperations_i::AbortOperation()
122 {
123   _impl->AbortOperation();
124 }
125
126 //=============================================================================
127 /*!
128  *  GetObject
129  */
130 //=============================================================================
131 GEOM::GEOM_Object_ptr GEOM_IOperations_i::GetObject(Handle(GEOM_Object) theObject)
132 {
133   if(theObject.IsNull()) return NULL;
134   TCollection_AsciiString anEntry;
135   TDF_Tool::Entry(theObject->GetEntry(), anEntry);
136   GEOM::GEOM_Object_var GO = GEOM::GEOM_Object::_duplicate(_engine->GetObject(theObject->GetDocID(), anEntry.ToCString()));
137   return GO._retn();
138 }