From 2e3cf3f5d7703081259d90e77f716f249e7d5255 Mon Sep 17 00:00:00 2001 From: srn Date: Wed, 6 Apr 2005 09:12:51 +0000 Subject: [PATCH] Removed method _duplicate from constructors of Clients --- src/SALOMEDS/Makefile.in | 4 ++++ src/SALOMEDS/SALOMEDS_ChildIterator.cxx | 2 +- src/SALOMEDS/SALOMEDS_GenericAttribute.cxx | 2 +- src/SALOMEDS/SALOMEDS_SComponentIterator.cxx | 2 +- src/SALOMEDS/SALOMEDS_SObject.cxx | 23 ++++++++++++++++---- src/SALOMEDS/SALOMEDS_SObject.hxx | 7 +++--- src/SALOMEDS/SALOMEDS_Study.cxx | 2 +- src/SALOMEDS/SALOMEDS_StudyBuilder.cxx | 2 +- src/SALOMEDS/SALOMEDS_StudyManager.cxx | 2 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx | 2 +- src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx | 2 +- 11 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/SALOMEDS/Makefile.in b/src/SALOMEDS/Makefile.in index 9381217ce..df993d6e5 100644 --- a/src/SALOMEDS/Makefile.in +++ b/src/SALOMEDS/Makefile.in @@ -15,9 +15,13 @@ EXPORT_HEADERS= \ SALOMEDS_StudyManager_i.hxx \ SALOMEDS_Driver_i.hxx \ SALOMEDS_StudyManager.hxx \ + SALOMEDS_Study_i.hxx \ SALOMEDS_Study.hxx \ + SALOMEDS_SObject_i.hxx \ SALOMEDS_SObject.hxx \ + SALOMEDS_SComponent_i.hxx \ SALOMEDS_SComponent.hxx \ + SALOMEDS_GenericAttribute_i.hxx \ SALOMEDS_GenericAttribute.hxx # Libraries targets diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx index d16ef6fe7..f493fe376 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx @@ -18,7 +18,7 @@ SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIt { _isLocal = false; _local_impl = NULL; - _corba_impl = SALOMEDS::ChildIterator::_duplicate(theIterator); + _corba_impl = theIterator; } void SALOMEDS_ChildIterator::Init() diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx index 91ea72dc1..a53e7b0df 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx @@ -42,7 +42,7 @@ SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ } else { _local_impl = NULL; - _corba_impl = SALOMEDS::GenericAttribute::_duplicate(theGA); + _corba_impl = theGA; } } diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx index 59f840c10..93c2becc0 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx @@ -16,7 +16,7 @@ SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(const SALOMEDSImpl_SCom SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(SALOMEDS::SComponentIterator_ptr theIterator) { _isLocal = false; - _corba_impl = SALOMEDS::SComponentIterator::_duplicate(theIterator); + _corba_impl = theIterator; } SALOMEDS_SComponentIterator::~SALOMEDS_SComponentIterator() diff --git a/src/SALOMEDS/SALOMEDS_SObject.cxx b/src/SALOMEDS/SALOMEDS_SObject.cxx index 7c6ce7ea7..17c5af036 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -39,7 +39,7 @@ SALOMEDS_SObject::SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject) } else { _local_impl = NULL; - _corba_impl = SALOMEDS::SObject::_duplicate(theSObject); + _corba_impl = theSObject; } } @@ -73,13 +73,15 @@ SALOMEDSClient_SObject* SALOMEDS_SObject::GetFather() return new SALOMEDS_SObject(_corba_impl->GetFather()); } -bool SALOMEDS_SObject::FindAttribute(SALOMEDSClient_GenericAttribute* anAttribute, const char* aTypeOfAttribute) +bool SALOMEDS_SObject::FindAttribute(SALOMEDSClient_GenericAttribute*& anAttribute, const char* aTypeOfAttribute) { bool ret = false; TCollection_AsciiString aType((char*)aTypeOfAttribute); if(_isLocal) { Handle(SALOMEDSImpl_GenericAttribute) anAttr; ret = _local_impl->FindAttribute(anAttr, aType); + cout << "############## ret = " << ret << " type requested " << aType << endl; + if(!anAttr.IsNull()) cout << "############## recieved " << anAttr->Type() << endl; if(ret) anAttribute = SALOMEDS_GenericAttribute::CreateAttribute(anAttr); } else { @@ -91,7 +93,7 @@ bool SALOMEDS_SObject::FindAttribute(SALOMEDSClient_GenericAttribute* anAttribut return ret; } -bool SALOMEDS_SObject::ReferencedObject(SALOMEDSClient_SObject* theObject) +bool SALOMEDS_SObject::ReferencedObject(SALOMEDSClient_SObject*& theObject) { bool ret = false; if(_isLocal) { @@ -109,7 +111,7 @@ bool SALOMEDS_SObject::ReferencedObject(SALOMEDSClient_SObject* theObject) } -bool SALOMEDS_SObject::FindSubObject(int theTag, SALOMEDSClient_SObject* theObject) +bool SALOMEDS_SObject::FindSubObject(int theTag, SALOMEDSClient_SObject*& theObject) { bool ret = false; if(_isLocal) { @@ -212,3 +214,16 @@ int SALOMEDS_SObject::Depth() if(_isLocal) return _local_impl->Depth(); return _corba_impl->Depth(); } + +CORBA::Object_ptr SALOMEDS_SObject::GetObject() +{ + CORBA::Object_var obj; + if(_isLocal) { + TCollection_AsciiString anIOR = GetIOR(); + SALOMEDS_Study* aStudy = dynamic_cast(GetStudy()); + obj = CORBA::Object::_duplicate(aStudy->ConvertIORToObject(anIOR.ToCString())); + delete aStudy; + } + else obj = CORBA::Object::_duplicate(_corba_impl->GetObject()); + return obj._retn(); +} diff --git a/src/SALOMEDS/SALOMEDS_SObject.hxx b/src/SALOMEDS/SALOMEDS_SObject.hxx index 31369ee34..11cff215b 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject.hxx @@ -36,9 +36,9 @@ public: virtual char* GetID(); virtual SALOMEDSClient_SComponent* GetFatherComponent(); virtual SALOMEDSClient_SObject* GetFather(); - virtual bool FindAttribute(SALOMEDSClient_GenericAttribute* anAttribute, const char* aTypeOfAttribute); - virtual bool ReferencedObject(SALOMEDSClient_SObject* theObject); - virtual bool FindSubObject(int theTag, SALOMEDSClient_SObject* theObject); + virtual bool FindAttribute(SALOMEDSClient_GenericAttribute*& anAttribute, const char* aTypeOfAttribute); + virtual bool ReferencedObject(SALOMEDSClient_SObject*& theObject); + virtual bool FindSubObject(int theTag, SALOMEDSClient_SObject*& theObject); virtual SALOMEDSClient_Study* GetStudy(); virtual char* Name(); virtual void Name(const char* theName); @@ -49,6 +49,7 @@ public: virtual int Tag(); virtual int Depth(); + CORBA::Object_ptr GetObject(); SALOMEDS::SObject_ptr GetCORBAImpl() { return SALOMEDS::SObject::_duplicate(_corba_impl); } Handle(SALOMEDSImpl_SObject) GetLocalImpl() { return _local_impl; } }; diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index 88d5ae603..519b56797 100644 --- a/src/SALOMEDS/SALOMEDS_Study.cxx +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -62,7 +62,7 @@ SALOMEDS_Study::SALOMEDS_Study(SALOMEDS::Study_ptr theStudy) } else { _local_impl = NULL; - _corba_impl = SALOMEDS::Study::_duplicate(theStudy); + _corba_impl = theStudy; } init_orb(); diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx index a952eecd6..2c6903c7e 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx @@ -34,7 +34,7 @@ SALOMEDS_StudyBuilder::SALOMEDS_StudyBuilder(SALOMEDS::StudyBuilder_ptr theBuild { _isLocal = false; _local_impl = NULL; - _corba_impl = SALOMEDS::StudyBuilder::_duplicate(theBuilder); + _corba_impl = theBuilder; init_orb(); } diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.cxx b/src/SALOMEDS/SALOMEDS_StudyManager.cxx index fc50e770a..40576276e 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager.cxx @@ -37,7 +37,7 @@ SALOMEDS_StudyManager::SALOMEDS_StudyManager(SALOMEDS::StudyManager_ptr theManag } else { _local_impl = NULL; - _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager); + _corba_impl = theManager; } } diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx index 45ce230c7..f872d6e7c 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx @@ -23,7 +23,7 @@ SALOMEDS_UseCaseBuilder::SALOMEDS_UseCaseBuilder(SALOMEDS::UseCaseBuilder_ptr th { _isLocal = false; _local_impl = NULL; - _corba_impl = SALOMEDS::UseCaseBuilder::_duplicate(theBuilder); + _corba_impl = theBuilder; } SALOMEDS_UseCaseBuilder::~SALOMEDS_UseCaseBuilder() diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx index bc8092491..0d1185097 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx @@ -18,7 +18,7 @@ SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(SALOMEDS::UseCaseIterator_ptr { _isLocal = false; _local_impl = NULL; - _corba_impl = SALOMEDS::UseCaseIterator::_duplicate(theIterator); + _corba_impl = theIterator; } SALOMEDS_UseCaseIterator::~SALOMEDS_UseCaseIterator() -- 2.39.2