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