1 // File : SALOMEDS_Study_i.cxx
2 // Author : Sergey RUIN
7 #include "SALOMEDS_Study_i.hxx"
8 #include "SALOMEDS_UseCaseIterator_i.hxx"
9 #include "SALOMEDS_GenericAttribute_i.hxx"
10 #include "SALOMEDS_AttributeStudyProperties_i.hxx"
11 #include "SALOMEDS_ChildIterator_i.hxx"
12 #include "SALOMEDS_Driver_i.hxx"
13 #include "SALOMEDS.hxx"
15 #include "SALOMEDSImpl_SObject.hxx"
16 #include "SALOMEDSImpl_SComponent.hxx"
17 #include "SALOMEDSImpl_UseCaseBuilder.hxx"
18 #include "SALOMEDSImpl_AttributeStudyProperties.hxx"
19 #include "SALOMEDSImpl_ChildIterator.hxx"
21 #include <TColStd_SequenceOfExtendedString.hxx>
22 #include <TColStd_HSequenceOfAsciiString.hxx>
23 #include <TColStd_HSequenceOfTransient.hxx>
24 #include <TCollection_AsciiString.hxx>
25 #include <TCollection_ExtendedString.hxx>
27 #include <TDF_Label.hxx>
28 #include <TDF_Attribute.hxx>
33 #include <sys/types.h>
41 //============================================================================
42 /*! Function : SALOMEDS_Study_i
43 * Purpose : SALOMEDS_Study_i constructor
45 //============================================================================
46 SALOMEDS_Study_i::SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study) theImpl,
49 _orb = CORBA::ORB::_duplicate(orb);
52 _builder = new SALOMEDS_StudyBuilder_i(_impl->NewBuilder(), _orb);
55 //============================================================================
56 /*! Function : ~SALOMEDS_Study_i
57 * Purpose : SALOMEDS_Study_i destructor
59 //============================================================================
60 SALOMEDS_Study_i::~SALOMEDS_Study_i()
64 //============================================================================
65 /*! Function : GetPersistentReference
66 * Purpose : Get persistent reference of study (idem URL())
68 //============================================================================
69 char* SALOMEDS_Study_i::GetPersistentReference()
71 SALOMEDS::Locker lock;
72 return CORBA::string_dup(_impl->GetPersistentReference().ToCString());
74 //============================================================================
75 /*! Function : GetTransientReference
76 * Purpose : Get IOR of the Study (registred in OCAF document in doc->Root)
78 //============================================================================
79 char* SALOMEDS_Study_i::GetTransientReference()
81 SALOMEDS::Locker lock;
82 return CORBA::string_dup(_impl->GetTransientReference().ToCString());
85 //============================================================================
86 /*! Function : IsEmpty
87 * Purpose : Detect if study is empty
89 //============================================================================
90 CORBA::Boolean SALOMEDS_Study_i::IsEmpty()
92 SALOMEDS::Locker lock;
93 return _impl->IsEmpty();
96 //============================================================================
97 /*! Function : FindComponent
98 * Purpose : Find a Component with ComponentDataType = aComponentName
100 //============================================================================
101 SALOMEDS::SComponent_ptr SALOMEDS_Study_i::FindComponent (const char* aComponentName)
103 SALOMEDS::Locker lock;
105 Handle(SALOMEDSImpl_SComponent) aCompImpl = _impl->FindComponent(TCollection_AsciiString((char*)aComponentName));
106 if(aCompImpl.IsNull()) return SALOMEDS::SComponent::_nil();
108 SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aCompImpl, _orb);
112 //============================================================================
113 /*! Function : FindComponentID
114 * Purpose : Find a Component from it's ID
116 //============================================================================
117 SALOMEDS::SComponent_ptr SALOMEDS_Study_i::FindComponentID(const char* aComponentID)
119 SALOMEDS::Locker lock;
121 Handle(SALOMEDSImpl_SComponent) aCompImpl = _impl->FindComponentID(TCollection_AsciiString((char*)aComponentID));
122 if(aCompImpl.IsNull()) return SALOMEDS::SComponent::_nil();
124 SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aCompImpl, _orb);
128 //============================================================================
129 /*! Function : FindObject
130 * Purpose : Find an Object with SALOMEDS::Name = anObjectName
132 //============================================================================
133 SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObject(const char* anObjectName)
135 SALOMEDS::Locker lock;
137 Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObject(TCollection_AsciiString((char*)anObjectName));
138 if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
140 if(aSO->DynamicType() == STANDARD_TYPE(SALOMEDSImpl_SComponent)) {
141 Handle(SALOMEDSImpl_SComponent) aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(aSO);
142 SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aSCO, _orb);
146 SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
151 //============================================================================
152 /*! Function : FindObjectID
153 * Purpose : Find an Object with ID = anObjectID
155 //============================================================================
156 SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectID(const char* anObjectID)
158 SALOMEDS::Locker lock;
160 Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectID(TCollection_AsciiString((char*)anObjectID));
161 if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
162 SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
166 //============================================================================
167 /*! Function : CreateObjectID
168 * Purpose : Creates an Object with ID = anObjectID
170 //============================================================================
171 SALOMEDS::SObject_ptr SALOMEDS_Study_i::CreateObjectID(const char* anObjectID)
173 SALOMEDS::Locker lock;
175 Handle(SALOMEDSImpl_SObject) aSO = _impl->CreateObjectID((char*)anObjectID);
176 if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
178 SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
182 //============================================================================
183 /*! Function : FindObjectByName
184 * Purpose : Find Objects with SALOMEDS::Name = anObjectName in a Component
185 * : with ComponentDataType = aComponentName
187 //============================================================================
188 SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindObjectByName( const char* anObjectName,
189 const char* aComponentName )
191 SALOMEDS::Locker lock;
193 Handle(TColStd_HSequenceOfTransient) aSeq = _impl->FindObjectByName(TCollection_AsciiString((char*)anObjectName),
194 TCollection_AsciiString((char*)aComponentName));
195 int aLength = aSeq->Length();
196 SALOMEDS::Study::ListOfSObject_var listSO = new SALOMEDS::Study::ListOfSObject ;
197 listSO->length(aLength);
198 for(int i = 1; i<=aLength; i++) {
199 Handle(SALOMEDSImpl_SObject) aSO = Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i));
200 SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
203 return listSO._retn() ;
206 //============================================================================
207 /*! Function : FindObjectIOR
208 * Purpose : Find an Object with IOR = anObjectIOR
210 //============================================================================
211 SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectIOR(const char* anObjectIOR)
213 SALOMEDS::Locker lock;
215 Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectIOR(TCollection_AsciiString((char*)anObjectIOR));
216 if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
218 SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
222 //============================================================================
223 /*! Function : FindObjectByPath
224 * Purpose : Find an Object by its path = thePath
226 //============================================================================
227 SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectByPath(const char* thePath)
229 SALOMEDS::Locker lock;
231 Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectByPath(TCollection_AsciiString((char*)thePath));
232 if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
234 SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
238 //============================================================================
239 /*! Function : GetObjectPath
242 //============================================================================
243 char* SALOMEDS_Study_i::GetObjectPath(CORBA::Object_ptr theObject)
245 SALOMEDS::Locker lock;
247 TCollection_AsciiString aPath("");
248 if(CORBA::is_nil(theObject)) return CORBA::string_dup(aPath.ToCString());
249 Handle(SALOMEDSImpl_SObject) aSO;
250 SALOMEDS::SObject_var aSObj = SALOMEDS::SObject::_narrow(theObject);
252 if(!CORBA::is_nil(aSObj)) {
253 aSO = _impl->FindObjectID(aSObj->GetID());
256 aSO = _impl->FindObjectIOR(_orb->object_to_string(theObject));
259 if(aSO.IsNull()) return CORBA::string_dup(aPath.ToCString());
261 aPath = _impl->GetObjectPath(aSO);
262 return CORBA::string_dup(aPath.ToCString());
266 //============================================================================
267 /*! Function : SetContext
268 * Purpose : Sets the current context
270 //============================================================================
271 void SALOMEDS_Study_i::SetContext(const char* thePath)
273 SALOMEDS::Locker lock;
275 _impl->SetContext(TCollection_AsciiString((char*)thePath));
276 if(_impl->IsError() && _impl->GetErrorCode() == "InvalidContext")
277 throw SALOMEDS::Study::StudyInvalidContext();
280 //============================================================================
281 /*! Function : GetContext
282 * Purpose : Gets the current context
284 //============================================================================
285 char* SALOMEDS_Study_i::GetContext()
287 SALOMEDS::Locker lock;
289 if(!_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
290 return CORBA::string_dup(_impl->GetContext().ToCString());
293 //============================================================================
294 /*! Function : GetObjectNames
295 * Purpose : method to get all object names in the given context (or in the current context, if 'theContext' is empty)
297 //============================================================================
298 SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetObjectNames(const char* theContext)
300 SALOMEDS::Locker lock;
302 SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
303 if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
304 Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetObjectNames(TCollection_AsciiString((char*)theContext));
305 int aLength = aSeq->Length();
306 aResult->length(aLength);
307 for(int anIndex = 1; anIndex <= aLength; anIndex++) {
308 aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
310 return aResult._retn();
313 //============================================================================
314 /*! Function : GetDirectoryNames
315 * Purpose : method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
317 //============================================================================
318 SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetDirectoryNames(const char* theContext)
320 SALOMEDS::Locker lock;
322 SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
323 if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
324 Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetDirectoryNames(TCollection_AsciiString((char*)theContext));
325 int aLength = aSeq->Length();
326 aResult->length(aLength);
327 for(int anIndex = 1; anIndex <= aLength; anIndex++) {
328 aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
330 return aResult._retn();
333 //============================================================================
334 /*! Function : GetFileNames
335 * Purpose : method to get all file names in the given context (or in the current context, if 'theContext' is empty)
337 //============================================================================
338 SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetFileNames(const char* theContext)
340 SALOMEDS::Locker lock;
342 SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
343 if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
344 Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetFileNames(TCollection_AsciiString((char*)theContext));
345 int aLength = aSeq->Length();
346 aResult->length(aLength);
347 for(int anIndex = 1; anIndex <= aLength; anIndex++) {
348 aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
350 return aResult._retn();
353 //============================================================================
354 /*! Function : GetComponentNames
355 * Purpose : method to get all components names
357 //============================================================================
358 SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theContext)
360 SALOMEDS::Locker lock;
362 SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
363 if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
364 Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetComponentNames(TCollection_AsciiString((char*)theContext));
365 int aLength = aSeq->Length();
366 aResult->length(aLength);
367 for(int anIndex = 1; anIndex <= aLength; anIndex++) {
368 aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
370 return aResult._retn();
373 //============================================================================
374 /*! Function : NewChildIterator
375 * Purpose : Create a ChildIterator from an SObject
377 //============================================================================
378 SALOMEDS::ChildIterator_ptr SALOMEDS_Study_i::NewChildIterator(SALOMEDS::SObject_ptr theSO)
380 SALOMEDS::Locker lock;
382 Handle(SALOMEDSImpl_SObject) aSO = _impl->GetSObject(theSO->GetID());
383 Handle(SALOMEDSImpl_ChildIterator) anItr = new SALOMEDSImpl_ChildIterator(aSO);
386 SALOMEDS_ChildIterator_i* it_servant = new SALOMEDS_ChildIterator_i(anItr, _orb);
387 SALOMEDS::ChildIterator_var it = SALOMEDS::ChildIterator::_narrow(it_servant->_this());
393 //============================================================================
394 /*! Function : NewComponentIterator
395 * Purpose : Create a SComponentIterator
397 //============================================================================
398 SALOMEDS::SComponentIterator_ptr SALOMEDS_Study_i::NewComponentIterator()
400 SALOMEDS::Locker lock;
401 SALOMEDS_SComponentIterator_i* _it = new SALOMEDS_SComponentIterator_i(_impl->NewComponentIterator(), _orb);
407 //============================================================================
408 /*! Function : NewBuilder
409 * Purpose : Create a StudyBuilder
411 //============================================================================
412 SALOMEDS::StudyBuilder_ptr SALOMEDS_Study_i::NewBuilder()
414 SALOMEDS::Locker lock;
415 return _builder->_this();
418 //============================================================================
420 * Purpose : get study name
422 //============================================================================
423 char* SALOMEDS_Study_i::Name()
425 SALOMEDS::Locker lock;
426 return CORBA::string_dup(_impl->Name().ToCString());
429 //============================================================================
431 * Purpose : set study name
433 //============================================================================
434 void SALOMEDS_Study_i::Name(const char* name)
436 SALOMEDS::Locker lock;
437 _impl->Name(TCollection_AsciiString((char*)name));
440 //============================================================================
441 /*! Function : IsSaved
442 * Purpose : get if study has been saved
444 //============================================================================
445 CORBA::Boolean SALOMEDS_Study_i::IsSaved()
447 SALOMEDS::Locker lock;
448 return _impl->IsSaved();
451 //============================================================================
452 /*! Function : IsSaved
453 * Purpose : set if study has been saved
455 //============================================================================
456 void SALOMEDS_Study_i::IsSaved(CORBA::Boolean save)
458 SALOMEDS::Locker lock;
459 _impl->IsSaved(save);
462 //============================================================================
463 /*! Function : IsModified
464 * Purpose : Detect if a Study has been modified since it has been saved
466 //============================================================================
467 CORBA::Boolean SALOMEDS_Study_i::IsModified()
469 SALOMEDS::Locker lock;
470 return _impl->IsModified();
473 //============================================================================
475 * Purpose : get URL of the study (persistent reference of the study)
477 //============================================================================
478 char* SALOMEDS_Study_i::URL()
480 SALOMEDS::Locker lock;
481 return CORBA::string_dup(_impl->URL().ToCString());
484 //============================================================================
486 * Purpose : set URL of the study (persistent reference of the study)
488 //============================================================================
489 void SALOMEDS_Study_i::URL(const char* url)
491 SALOMEDS::Locker lock;
492 _impl->URL(TCollection_AsciiString((char*)url));
496 CORBA::Short SALOMEDS_Study_i::StudyId()
498 SALOMEDS::Locker lock;
499 return _impl->StudyId();
502 void SALOMEDS_Study_i::StudyId(CORBA::Short id)
504 SALOMEDS::Locker lock;
508 void SALOMEDS_Study_i::UpdateIORLabelMap(const char* anIOR,const char* anEntry)
510 SALOMEDS::Locker lock;
511 _impl->UpdateIORLabelMap(TCollection_AsciiString((char*)anIOR), TCollection_AsciiString((char*)anEntry));
514 SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb)
516 SALOMEDS::Locker lock;
518 Handle(SALOMEDSImpl_AttributeIOR) Att;
519 if (theLabel.Root().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),Att)){
520 char* IOR = CORBA::string_dup(TCollection_AsciiString(Att->Value()).ToCString());
521 CORBA::Object_var obj = orb->string_to_object(IOR);
522 SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj) ;
523 ASSERT(!CORBA::is_nil(aStudy));
524 return SALOMEDS::Study::_duplicate(aStudy);
526 MESSAGE("GetStudy: Problem to get study");
528 return SALOMEDS::Study::_nil();
531 void SALOMEDS_Study_i::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute)
533 SALOMEDS::Locker lock;
534 SALOMEDSImpl_Study::IORUpdated(theAttribute);
537 SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindDependances(SALOMEDS::SObject_ptr anObject)
539 SALOMEDS::Locker lock;
541 SALOMEDS::GenericAttribute_ptr aTarget;
542 if (anObject->FindAttribute(aTarget,"AttributeTarget")) {
543 return SALOMEDS::AttributeTarget::_narrow(aTarget)->Get();
545 SALOMEDS::Study::ListOfSObject* aList = new SALOMEDS::Study::ListOfSObject;
551 SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties()
553 SALOMEDS::Locker lock;
555 Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr = _impl->GetProperties();
556 SALOMEDS_AttributeStudyProperties_i* SP = new SALOMEDS_AttributeStudyProperties_i(anAttr, _orb);
557 return SP->AttributeStudyProperties::_this();
560 char* SALOMEDS_Study_i::GetLastModificationDate()
562 SALOMEDS::Locker lock;
563 return CORBA::string_dup(_impl->GetLastModificationDate().ToCString());
566 SALOMEDS::ListOfDates* SALOMEDS_Study_i::GetModificationsDate()
568 SALOMEDS::Locker lock;
570 Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetModificationsDate();
571 int aLength = aSeq->Length();
572 SALOMEDS::ListOfDates_var aDates = new SALOMEDS::ListOfDates;
573 aDates->length(aLength);
575 for(int anIndex = 1; anIndex <= aLength; anIndex++) {
576 aDates[anIndex-1] = CORBA::string_dup(aSeq->Value(anIndex).ToCString());
578 return aDates._retn();
583 //============================================================================
584 /*! Function : GetUseCaseBuilder
585 * Purpose : Returns a UseCase builder
587 //============================================================================
588 SALOMEDS::UseCaseBuilder_ptr SALOMEDS_Study_i::GetUseCaseBuilder()
590 SALOMEDS::Locker lock;
591 SALOMEDS_UseCaseBuilder_i* UCBuilder = new SALOMEDS_UseCaseBuilder_i(_impl->GetUseCaseBuilder(), _orb);
592 return UCBuilder->_this();
596 //============================================================================
600 //============================================================================
601 void SALOMEDS_Study_i::Close()
603 SALOMEDS::Locker lock;
607 SALOMEDS::SComponentIterator_var itcomponent = NewComponentIterator();
609 for (; itcomponent->More(); itcomponent->Next()) {
610 SALOMEDS::SComponent_var sco = itcomponent->Value();
612 MESSAGE ( "Look for an engine for data type :"<< sco->ComponentDataType());
613 // if there is an associated Engine call its method for closing
614 CORBA::String_var IOREngine;
615 if (sco->ComponentIOR(IOREngine)) {
616 // we have found the associated engine to write the data
617 MESSAGE ( "We have found an engine for data type :"<< sco->ComponentDataType());
618 CORBA::Object_var obj = _orb->string_to_object(IOREngine);
619 if (!CORBA::is_nil(obj)) {
620 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_narrow(obj) ;
622 if (!anEngine->_is_nil()) {
624 anEngine->Close(sco);
633 //============================================================================
634 /*! Function : AddPostponed
637 //============================================================================
638 void SALOMEDS_Study_i::AddPostponed(const char* theIOR)
640 SALOMEDS::Locker lock;
642 CORBA::Object_var obj = _orb->string_to_object(theIOR);
643 if (!CORBA::is_nil(obj)) {
644 SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ;
645 if (!CORBA::is_nil(aGeneric)) _impl->AddPostponed((char*)theIOR);
649 void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR)
651 SALOMEDS::Locker lock;
653 CORBA::Object_var obj = _orb->string_to_object(theIOR);
654 if (!CORBA::is_nil(obj)) {
655 SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ;
656 if (!CORBA::is_nil(aGeneric)) _impl->AddCreatedPostponed((char*)theIOR);
660 //============================================================================
661 /*! Function : RemovePostponed
664 //============================================================================
666 void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long theUndoLimit)
668 void SALOMEDS_Study_i::RemovePostponed(CORBA::Long theUndoLimit)
671 SALOMEDS::Locker lock;
673 Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->RemovePostponed(theUndoLimit);
674 int aLegth = aSeq->Length();
675 for(int i = 1; i <= aLegth; i++) {
676 TCollection_AsciiString anIOR = aSeq->Value(i);
677 //mkr : fix for bug IPAL9408 : check the length of anIOR
678 // before take value from it
679 if ( !anIOR.IsEmpty() && anIOR.Value(1) == 'c') {
680 CORBA::Object_var obj = _orb->string_to_object(anIOR.Split(1).ToCString());
681 SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
682 if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
684 else if ( !anIOR.IsEmpty() && anIOR.Value(1) == 'd') {
685 CORBA::Object_var obj = _orb->string_to_object(anIOR.Split(1).ToCString());
686 SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
687 if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
691 CORBA::Object_var obj = _orb->string_to_object(anIOR.ToCString());
692 SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
693 if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
699 //============================================================================
700 /*! Function : UndoPostponed
703 //============================================================================
705 void SALOMEDS_Study_i::UndoPostponed(const CORBA::Long theWay)
707 void SALOMEDS_Study_i::UndoPostponed(CORBA::Long theWay)
710 SALOMEDS::Locker lock;
712 _impl->UndoPostponed(theWay);
716 //============================================================================
717 /*! Function : DumpStudy
720 //============================================================================
721 CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished)
723 SALOMEDS::Locker lock;
725 TCollection_AsciiString aPath((char*)thePath), aBaseName((char*)theBaseName);
726 SALOMEDS_DriverFactory_i* factory = new SALOMEDS_DriverFactory_i(_orb);
727 CORBA::Boolean ret = _impl->DumpStudy(aPath, aBaseName, isPublished, factory);
732 //===========================================================================
734 //===========================================================================
735 long SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal)
738 long pid = (long)_getpid();
740 long pid = (long)getpid();
742 isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
743 SALOMEDSImpl_Study* local_impl = _impl.operator->();
744 return ((long)local_impl);