Salome HOME
return right CORBA value to avoid messages like 'free(): invalid pointer'
[modules/geom.git] / src / GEOM_I / GEOM_IOperations_i.cc
1 #include "GEOM_IOperations_i.hh"
2
3 #include "GEOM_Engine.hxx"
4
5 #include "utilities.h"
6 #include "OpUtil.hxx"
7 #include "Utils_ExceptHandlers.hxx"
8
9 #include <Standard_Stream.hxx>
10 #include <TCollection_AsciiString.hxx>
11 #include <TDF_Tool.hxx>
12
13 //=============================================================================
14 /*!
15  *  default constructor:
16  */
17 //=============================================================================
18
19 GEOM_IOperations_i::GEOM_IOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOM_IOperations* theImpl)
20 :SALOME::GenericObj_i( thePOA ), _impl(theImpl), _engine(theEngine)
21 {
22   thePOA->activate_object(this);
23 }
24
25 //=============================================================================
26 /*!
27  *  destructor
28  */
29 //=============================================================================
30
31 GEOM_IOperations_i::~GEOM_IOperations_i()
32 {}
33
34
35 //=============================================================================
36 /*!
37  *  IsDone
38  */
39 //=============================================================================
40 CORBA::Boolean GEOM_IOperations_i::IsDone()
41 {
42   return _impl->IsDone();
43 }
44
45
46 //=============================================================================
47 /*!
48  *  SetErrorCode
49  */
50 //=============================================================================
51 void GEOM_IOperations_i::SetErrorCode(const char* theErrorCode)
52 {
53   _impl->SetErrorCode((char*)theErrorCode);
54 }
55
56 //=============================================================================
57 /*!
58  *  GetErrorCode
59  */
60 //=============================================================================
61 char* GEOM_IOperations_i::GetErrorCode()
62 {
63   return CORBA::string_dup(_impl->GetErrorCode());
64 }
65
66 //=============================================================================
67 /*!
68  *  GetStudyID
69  */
70 //=============================================================================
71 CORBA::Long GEOM_IOperations_i::GetStudyID()
72 {
73   return _impl->GetDocID();
74 }
75
76 //=============================================================================
77 /*!
78  *  StartOperation
79  */
80 //=============================================================================
81 void GEOM_IOperations_i::StartOperation()
82 {
83   _impl->StartOperation();
84 }
85
86 //=============================================================================
87 /*!
88  *  FinishOperation
89  */
90 //=============================================================================
91 void GEOM_IOperations_i::FinishOperation()
92 {
93   _impl->FinishOperation();
94 }
95
96
97 //=============================================================================
98 /*!
99  *  AboutOperation
100  */
101 //=============================================================================
102 void GEOM_IOperations_i::AbortOperation()
103 {
104   _impl->AbortOperation();
105 }
106
107 //=============================================================================
108 /*!
109  *  GetObject
110  */
111 //=============================================================================
112 GEOM::GEOM_Object_ptr GEOM_IOperations_i::GetObject(Handle(GEOM_Object) theObject)
113 {
114   if(theObject.IsNull()) return NULL;
115   TCollection_AsciiString anEntry;
116   TDF_Tool::Entry(theObject->GetEntry(), anEntry);
117   GEOM::GEOM_Object_var GO = GEOM::GEOM_Object::_duplicate(_engine->GetObject(theObject->GetDocID(), anEntry.ToCString()));
118   return GO._retn();
119 }