Salome HOME
1f6c1ee8719408dccad0baa76082c86b606cf111
[modules/yacs.git] / src / SALOMEDS / SALOMEDS_Study.cxx
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/
19 //
20 //  File   : SALOMEDS_Study.cxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24
25
26 #include "utilities.h" 
27
28 #include "SALOMEDS_Study.hxx"
29 #include "SALOMEDS_SComponent.hxx"
30 #include "SALOMEDSImpl_SComponent.hxx"
31 #include "SALOMEDS_SObject.hxx"
32 #include "SALOMEDSImpl_SObject.hxx"
33 #include "SALOMEDS_StudyBuilder.hxx"
34 #include "SALOMEDSImpl_StudyBuilder.hxx"
35 #include "SALOMEDS_ChildIterator.hxx"
36 #include "SALOMEDSImpl_ChildIterator.hxx"
37 #include "SALOMEDS_SComponentIterator.hxx"
38 #include "SALOMEDSImpl_SComponentIterator.hxx"
39 #include "SALOMEDS_AttributeStudyProperties.hxx"
40 #include "SALOMEDSImpl_AttributeStudyProperties.hxx"
41 #include "SALOMEDS_UseCaseBuilder.hxx"
42 #include "SALOMEDSImpl_UseCaseBuilder.hxx"
43
44 #include "SALOMEDS_Driver_i.hxx"
45 #include "SALOMEDS_Study_i.hxx"
46
47 #include <TCollection_AsciiString.hxx> 
48 #include <TColStd_HSequenceOfAsciiString.hxx>
49 #include <TColStd_HSequenceOfTransient.hxx>
50
51 #include "Utils_ORB_INIT.hxx" 
52 #include "Utils_SINGLETON.hxx" 
53
54 #ifdef WIN32
55 #include <process.h>
56 #else
57 #include <sys/types.h>
58 #include <unistd.h>
59 #endif
60
61 #include "OpUtil.hxx"
62
63 using namespace std; 
64
65 SALOMEDS_Study::SALOMEDS_Study(const Handle(SALOMEDSImpl_Study)& theStudy)
66 {
67   _isLocal = true;
68   _local_impl = theStudy;
69   _corba_impl = SALOMEDS::Study::_nil();
70   init_orb();
71 }
72
73 SALOMEDS_Study::SALOMEDS_Study(SALOMEDS::Study_ptr theStudy)
74 {
75 #ifdef WIN32
76   long pid =  (long)_getpid();
77 #else
78   long pid =  (long)getpid();
79 #endif  
80
81   long addr = theStudy->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
82   if(_isLocal) {
83     _local_impl = ((SALOMEDSImpl_Study*)(addr));
84     _corba_impl = SALOMEDS::Study::_duplicate(theStudy);
85   }
86   else {
87     _local_impl = NULL;
88     _corba_impl = SALOMEDS::Study::_duplicate(theStudy);
89   }
90
91   init_orb();
92 }
93
94 SALOMEDS_Study::~SALOMEDS_Study()
95 {
96 }
97
98 std::string SALOMEDS_Study::GetPersistentReference()
99 {
100   std::string aRef;
101   if(_isLocal) aRef = _local_impl->GetPersistentReference().ToCString();
102   else aRef = _corba_impl->GetPersistentReference();
103   return aRef;
104 }
105
106 std::string SALOMEDS_Study::GetTransientReference()
107 {
108   std::string aRef;
109   if(_isLocal) aRef = _local_impl->GetTransientReference().ToCString();
110   else aRef = _corba_impl->GetTransientReference();
111   return aRef;
112 }
113  
114 bool SALOMEDS_Study::IsEmpty()
115 {
116   bool ret;
117   if(_isLocal) ret = _local_impl->IsEmpty();
118   else ret = _corba_impl->IsEmpty();
119   return ret;
120 }
121
122 _PTR(SComponent) SALOMEDS_Study::FindComponent (const std::string& aComponentName)
123 {
124   SALOMEDSClient_SComponent* aSCO = NULL;
125   if(_isLocal) {
126     Handle(SALOMEDSImpl_SComponent) aSCO_impl =_local_impl->FindComponent((char*)aComponentName.c_str());
127     if(aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
128     aSCO = new SALOMEDS_SComponent(aSCO_impl);
129   }
130   else {
131     SALOMEDS::SComponent_var aSCO_impl = _corba_impl->FindComponent((char*)aComponentName.c_str());
132     if(CORBA::is_nil(aSCO_impl)) return _PTR(SComponent)(aSCO);
133     aSCO = new SALOMEDS_SComponent(aSCO_impl);
134   }
135   return _PTR(SComponent)(aSCO);
136 }
137  
138 _PTR(SComponent) SALOMEDS_Study::FindComponentID(const std::string& aComponentID)
139 {  
140   SALOMEDSClient_SComponent* aSCO = NULL;
141   if(_isLocal) {
142     Handle(SALOMEDSImpl_SComponent) aSCO_impl =_local_impl->FindComponentID((char*)aComponentID.c_str());
143     if(aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
144     aSCO = new SALOMEDS_SComponent(aSCO_impl);
145   }
146   else {
147     SALOMEDS::SComponent_var aSCO_impl = _corba_impl->FindComponentID((char*)aComponentID.c_str());
148     if(CORBA::is_nil(aSCO_impl)) return _PTR(SComponent)(aSCO);
149     aSCO = new SALOMEDS_SComponent(aSCO_impl);
150   }
151   return _PTR(SComponent)(aSCO);
152   
153 }
154  
155 _PTR(SObject) SALOMEDS_Study::FindObject(const std::string& anObjectName)
156 {
157   SALOMEDSClient_SObject* aSO = NULL;
158
159   if(_isLocal) {
160     Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObject((char*)anObjectName.c_str());
161     if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
162     Handle(SALOMEDSImpl_SComponent) aSCO_impl = Handle(SALOMEDSImpl_SComponent)::DownCast(aSO_impl);
163     if(!aSCO_impl.IsNull()) return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl));
164     aSO = new SALOMEDS_SObject(aSO_impl);
165   }
166   else { 
167     SALOMEDS::SObject_var aSO_impl = _corba_impl->FindObject((char*)anObjectName.c_str());
168     if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
169     SALOMEDS::SComponent_var aSCO_impl = SALOMEDS::SComponent::_narrow(aSO_impl);
170     if(!CORBA::is_nil(aSCO_impl)) return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl));
171     aSO = new SALOMEDS_SObject(aSO_impl);
172   }
173
174   return _PTR(SObject)(aSO);
175 }
176  
177 std::vector<_PTR(SObject)> SALOMEDS_Study::FindObjectByName(const std::string& anObjectName, 
178                                                                       const std::string& aComponentName)   
179 {
180   std::vector<_PTR(SObject)> aVector;
181   int i, aLength = 0;
182   
183   if(_isLocal) {
184     Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->FindObjectByName((char*)anObjectName.c_str(), (char*)aComponentName.c_str());
185     aLength = aSeq->Length();
186     for(i = 1; i<= aLength; i++) 
187       aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)))));
188   }
189   else {
190     SALOMEDS::Study::ListOfSObject_var aSeq = _corba_impl->FindObjectByName((char*)anObjectName.c_str(), 
191                                                                             (char*)aComponentName.c_str());
192     aLength = aSeq->length();
193     for(i = 0; i< aLength; i++) aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i])));
194   }
195
196   return aVector;
197 }
198  
199 _PTR(SObject) SALOMEDS_Study::FindObjectID(const std::string& anObjectID)
200 {
201   SALOMEDSClient_SObject* aSO = NULL;
202   if(_isLocal) {
203     Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectID((char*)anObjectID.c_str());
204     if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
205     return _PTR(SObject)(new SALOMEDS_SObject(aSO_impl));
206   }
207   else { 
208     SALOMEDS::SObject_var aSO_impl = _corba_impl->FindObjectID((char*)anObjectID.c_str());
209     if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
210     return _PTR(SObject)(new SALOMEDS_SObject(aSO_impl));
211   }
212   return _PTR(SObject)(aSO);
213 }
214  
215 _PTR(SObject) SALOMEDS_Study::CreateObjectID(const std::string& anObjectID)
216 {
217   SALOMEDSClient_SObject* aSO = NULL;
218   if(_isLocal) aSO = new SALOMEDS_SObject(_local_impl->CreateObjectID((char*)anObjectID.c_str()));
219   else aSO = new SALOMEDS_SObject(_corba_impl->CreateObjectID((char*)anObjectID.c_str())); 
220   return _PTR(SObject)(aSO);
221 }
222  
223 _PTR(SObject) SALOMEDS_Study::FindObjectIOR(const std::string& anObjectIOR)
224 {
225   SALOMEDSClient_SObject* aSO = NULL;
226   if(_isLocal) {
227     Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectIOR((char*)anObjectIOR.c_str());
228     if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
229     aSO = new SALOMEDS_SObject(aSO_impl);
230   }
231   else { 
232     SALOMEDS::SObject_var aSO_impl = _corba_impl->FindObjectIOR((char*)anObjectIOR.c_str());
233     if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
234     aSO = new SALOMEDS_SObject(aSO_impl);
235   }
236   return _PTR(SObject)(aSO);
237 }
238
239 _PTR(SObject) SALOMEDS_Study::FindObjectByPath(const std::string& thePath)
240 {
241   SALOMEDSClient_SObject* aSO = NULL;
242   if(_isLocal) {
243     Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectByPath((char*)thePath.c_str());
244     if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
245     aSO = new SALOMEDS_SObject(aSO_impl);
246   }
247   else {
248     SALOMEDS::SObject_var aSO_impl = _corba_impl->FindObjectByPath((char*)thePath.c_str());
249     if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO);
250     aSO = new SALOMEDS_SObject(aSO_impl);
251   }
252   return _PTR(SObject)(aSO);
253 }
254
255 std::string SALOMEDS_Study::GetObjectPath(const _PTR(SObject)& theSO)
256 {
257   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
258   std::string aPath;
259   if(_isLocal) aPath = _local_impl->GetObjectPath(aSO->GetLocalImpl()).ToCString();
260   else aPath = _corba_impl->GetObjectPath(aSO->GetCORBAImpl());
261   return aPath;
262 }
263
264 void SALOMEDS_Study::SetContext(const std::string& thePath)
265 {
266   if(_isLocal) _local_impl->SetContext((char*)thePath.c_str());
267   else _corba_impl->SetContext((char*)thePath.c_str());
268 }
269
270 std::string SALOMEDS_Study::GetContext()  
271 {
272   std::string aPath;
273   if(_isLocal) aPath = _local_impl->GetContext().ToCString();
274   else aPath = _corba_impl->GetContext();
275   return aPath;
276 }
277
278 std::vector<std::string> SALOMEDS_Study::GetObjectNames(const std::string& theContext)
279 {
280   std::vector<std::string> aVector;
281   int aLength, i;
282   if(_isLocal) {
283     Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetObjectNames((char*)theContext.c_str());
284     aLength = aSeq->Length();
285     for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
286   }
287   else {
288     SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetObjectNames((char*)theContext.c_str());
289     aLength = aSeq->length();
290     for(i = 0; i<aLength; i++) aVector.push_back(std::string((std::string)aSeq[i].in()));
291   }
292   return aVector;
293 }
294  
295 std::vector<std::string> SALOMEDS_Study::GetDirectoryNames(const std::string& theContext)
296 {
297   std::vector<std::string> aVector;
298   int aLength, i;
299   if(_isLocal) {
300     Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetDirectoryNames((char*)theContext.c_str());
301     aLength = aSeq->Length();
302     for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
303   }
304   else {
305     SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetDirectoryNames((char*)theContext.c_str());
306     aLength = aSeq->length();
307     for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
308   }
309   return aVector;
310 }
311  
312 std::vector<std::string> SALOMEDS_Study::GetFileNames(const std::string& theContext)
313 {
314   std::vector<std::string> aVector;
315   int aLength, i;
316   if(_isLocal) {
317     Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetFileNames((char*)theContext.c_str());
318     aLength = aSeq->Length();
319     for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
320   }
321   else {
322     SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetFileNames((char*)theContext.c_str());
323     aLength = aSeq->length();
324
325     for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
326   }
327   return aVector;
328 }
329  
330 std::vector<std::string> SALOMEDS_Study::GetComponentNames(const std::string& theContext)
331 {
332   std::vector<std::string> aVector;
333   int aLength, i;
334   if(_isLocal) {
335     Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetComponentNames((char*)theContext.c_str());
336     aLength = aSeq->Length();
337     for(i = 1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
338   }
339   else {
340     SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetComponentNames((char*)theContext.c_str());
341     aLength = aSeq->length();
342     for(i = 0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
343   }
344   return aVector;
345 }
346
347 _PTR(ChildIterator) SALOMEDS_Study::NewChildIterator(const _PTR(SObject)& theSO)
348 {
349   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
350   SALOMEDSClient_ChildIterator* aCI = NULL; 
351   if(_isLocal) {
352     Handle(SALOMEDSImpl_ChildIterator) aCIimpl = _local_impl->NewChildIterator(aSO->GetLocalImpl());
353     aCI = new SALOMEDS_ChildIterator(aCIimpl);
354   }
355   else {
356     SALOMEDS::ChildIterator_var aCIimpl = _corba_impl->NewChildIterator(aSO->GetCORBAImpl());
357     aCI = new SALOMEDS_ChildIterator(aCIimpl);
358   }
359
360   return _PTR(ChildIterator)(aCI);
361 }
362
363 _PTR(SComponentIterator) SALOMEDS_Study::NewComponentIterator()
364 {
365   SALOMEDSClient_SComponentIterator* aCI = NULL; 
366   if(_isLocal) {
367     SALOMEDSImpl_SComponentIterator aCIimpl = _local_impl->NewComponentIterator();
368     aCI = new SALOMEDS_SComponentIterator(aCIimpl);
369   }
370   else {
371     SALOMEDS::SComponentIterator_var aCIimpl = _corba_impl->NewComponentIterator();
372     aCI = new SALOMEDS_SComponentIterator(aCIimpl);
373   }
374
375   return _PTR(SComponentIterator)(aCI);
376 }
377  
378 _PTR(StudyBuilder) SALOMEDS_Study::NewBuilder()
379 {
380   SALOMEDSClient_StudyBuilder* aSB = NULL; 
381   if(_isLocal) {
382     Handle(SALOMEDSImpl_StudyBuilder) aSBimpl = _local_impl->NewBuilder();
383     aSB = new SALOMEDS_StudyBuilder(aSBimpl);
384   }
385   else {
386     SALOMEDS::StudyBuilder_var aSBimpl = _corba_impl->NewBuilder();
387     aSB = new SALOMEDS_StudyBuilder(aSBimpl);
388   }
389
390   return _PTR(StudyBuilder)(aSB);
391 }
392
393 std::string SALOMEDS_Study::Name()
394 {
395   std::string aName;
396   if(_isLocal) aName = _local_impl->Name().ToCString();
397   else aName = _corba_impl->Name();
398   return aName;
399 }
400  
401 void SALOMEDS_Study::Name(const std::string& theName)
402 {
403   if(_isLocal) _local_impl->Name((char*)theName.c_str());
404   else _corba_impl->Name((char*)theName.c_str());
405 }
406
407 bool SALOMEDS_Study::IsSaved()
408 {
409   bool isSaved;
410   if(_isLocal) isSaved = _local_impl->IsSaved();
411   else isSaved = _corba_impl->IsSaved();
412   return isSaved;
413 }
414
415 void SALOMEDS_Study::IsSaved(bool save)
416 {
417   if(_isLocal) _local_impl->IsSaved(save);
418   else _corba_impl->IsSaved(save);
419 }
420
421 bool SALOMEDS_Study::IsModified()
422 {
423   bool isModified;
424   if(_isLocal) isModified = _local_impl->IsModified();
425   else isModified = _corba_impl->IsModified();
426   return isModified;
427 }
428  
429 std::string SALOMEDS_Study::URL()
430 {
431   std::string aURL;
432   if(_isLocal) aURL = _local_impl->URL().ToCString();
433   else aURL = _corba_impl->URL();
434   return aURL;
435 }
436
437 void SALOMEDS_Study::URL(const std::string& url)
438 {
439   if(_isLocal) _local_impl->URL((char*)url.c_str());
440   else _corba_impl->URL((char*)url.c_str());
441 }
442
443 int SALOMEDS_Study::StudyId()
444 {
445   int anID;
446   if(_isLocal) anID = _local_impl->StudyId();
447   else anID = _corba_impl->StudyId();
448   return anID;
449 }
450  
451 void SALOMEDS_Study::StudyId(int id) 
452 {
453   if(_isLocal) _local_impl->StudyId(id);
454   else _corba_impl->StudyId(id);  
455 }
456
457 std::vector<_PTR(SObject)> SALOMEDS_Study::FindDependances(const _PTR(SObject)& theSO)
458 {
459   std::vector<_PTR(SObject)> aVector;
460   SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
461   int aLength, i;
462   if(_isLocal) {
463     Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->FindDependances(aSO->GetLocalImpl());
464     if ( !aSeq.IsNull() )
465     {
466       aLength = aSeq->Length();
467       for(i=1; i<=aLength; i++) 
468         aVector.push_back(_PTR(SObject)(
469           new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)))));
470     }
471   }
472   else {
473     SALOMEDS::Study::ListOfSObject_var aSeq = _corba_impl->FindDependances(aSO->GetCORBAImpl());
474     aLength = aSeq->length();
475     for(i=0; i<aLength; i++) aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i])));
476   }
477   return aVector;
478 }
479  
480 _PTR(AttributeStudyProperties) SALOMEDS_Study::GetProperties()
481 {
482   SALOMEDSClient_AttributeStudyProperties* aProp;
483   if(_isLocal) aProp = new SALOMEDS_AttributeStudyProperties(_local_impl->GetProperties());
484   else aProp = new SALOMEDS_AttributeStudyProperties(_corba_impl->GetProperties());
485   return _PTR(AttributeStudyProperties)(aProp);
486 }
487  
488 std::string SALOMEDS_Study::GetLastModificationDate() 
489 {
490   std::string aDate;
491   if(_isLocal) aDate = _local_impl->GetLastModificationDate().ToCString();
492   else aDate = _corba_impl->GetLastModificationDate();
493   return aDate;
494 }
495
496 std::vector<std::string> SALOMEDS_Study::GetModificationsDate()
497 {
498   std::vector<std::string> aVector;
499   int aLength, i;
500   if(_isLocal) {
501     Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetModificationsDate();
502     aLength = aSeq->Length();
503     for(i=1; i<=aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
504   }
505   else {
506     SALOMEDS::ListOfDates_var aSeq = _corba_impl->GetModificationsDate();
507     aLength = aSeq->length();
508     for(i=0; i<aLength; i++) aVector.push_back((char*)aSeq[i].in());
509   }
510   return aVector;
511 }
512
513 _PTR(UseCaseBuilder) SALOMEDS_Study::GetUseCaseBuilder()
514 {
515   SALOMEDSClient_UseCaseBuilder* aUB = NULL;
516   if(_isLocal) {
517     Handle(SALOMEDSImpl_UseCaseBuilder) aUBimpl = _local_impl->GetUseCaseBuilder();
518     aUB = new SALOMEDS_UseCaseBuilder(aUBimpl);
519   }
520   else {
521     SALOMEDS::UseCaseBuilder_var aUBimpl = _corba_impl->GetUseCaseBuilder();
522     aUB = new SALOMEDS_UseCaseBuilder(aUBimpl);
523   }
524
525   return _PTR(UseCaseBuilder)(aUB);
526 }
527
528 void SALOMEDS_Study::Close()
529 {
530   if(_isLocal) _local_impl->Close();
531   else _corba_impl->Close();
532 }
533
534 void SALOMEDS_Study::EnableUseCaseAutoFilling(bool isEnabled)
535 {
536   if(_isLocal) _local_impl->EnableUseCaseAutoFilling(isEnabled);
537   else _corba_impl->EnableUseCaseAutoFilling(isEnabled);
538 }
539
540 bool SALOMEDS_Study::DumpStudy(const std::string& thePath, const std::string& theBaseName, bool isPublished)
541 {
542   bool ret;
543   if(_isLocal) {
544     SALOMEDS_DriverFactory_i* aFactory = new SALOMEDS_DriverFactory_i(_orb);
545     ret = _local_impl->DumpStudy((char*)thePath.c_str(), (char*)theBaseName.c_str(), isPublished, aFactory);
546     delete aFactory;
547   }
548   else ret = _corba_impl->DumpStudy((char*)thePath.c_str(), (char*)theBaseName.c_str(), isPublished);
549   return ret;
550 }     
551
552 std::string SALOMEDS_Study::ConvertObjectToIOR(CORBA::Object_ptr theObject) 
553 {
554   return _orb->object_to_string(theObject); 
555 }
556
557 CORBA::Object_ptr SALOMEDS_Study::ConvertIORToObject(const std::string& theIOR) 
558
559   return _orb->string_to_object(theIOR.c_str()); 
560
561
562 void SALOMEDS_Study::init_orb()
563 {
564   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
565   ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()); 
566   _orb = init(0 , 0 ) ;     
567 }
568
569 SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy()
570 {
571   if(_isLocal) {
572     if(!CORBA::is_nil(_corba_impl)) return _corba_impl;
573     std::string anIOR = _local_impl->GetTransientReference().ToCString();
574     SALOMEDS::Study_var aStudy;
575     if(!_local_impl->IsError() && anIOR != "") {
576       aStudy = SALOMEDS::Study::_narrow(_orb->string_to_object(anIOR.c_str()));
577     }
578     else {
579       SALOMEDS_Study_i *aStudy_servant = new SALOMEDS_Study_i(_local_impl, _orb);
580       aStudy = aStudy_servant->_this();
581       _local_impl->SetTransientReference(_orb->object_to_string(aStudy));
582     }
583     return aStudy._retn();
584   }
585   else {
586     return _corba_impl;
587   }
588    
589   return SALOMEDS::Study::_nil();
590 }