From 0fb5695e18d2481c2427c006721522a75faafc2a Mon Sep 17 00:00:00 2001 From: tajchman Date: Thu, 8 Apr 2004 15:34:07 +0000 Subject: [PATCH] Correcting a bug in the path prefixes treatment --- .../SALOME_ModuleCatalog_Acomponent_impl.cxx | 64 +++++++++---------- .../SALOME_ModuleCatalog_Server.cxx | 9 +-- .../SALOME_ModuleCatalog_impl.cxx | 2 +- .../SALOME_ModuleCatalog_impl.hxx | 6 +- 4 files changed, 43 insertions(+), 38 deletions(-) diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx index 096f26c27..9f1940835 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx @@ -324,41 +324,39 @@ SALOME_ModuleCatalog_AcomponentImpl::GetPathPrefix(const char* machinename) BEGIN_OF("GetPathPrefix"); SCRUTE(machinename); -// // Variables initialisation -// char* _path = NULL; -// bool _find = false ; - -// // Parse all the path prefixes -// // looking for the wanted computer -// for (unsigned int ind = 0 ; ind < _Component.PathPrefixes.size() ; ind++) -// { -// for (unsigned int ind1 = 0 ; ind1 < _pathes[ind].listOfComputer.size() ; ind1++) -// { -// if (strcmp(machinename, _pathes[ind].listOfComputer[ind1].c_str()) == 0) -// { -// _find = true ; -// // Wanted computer -// // affect the path to be returned -// const char* _temp = _pathes[ind].path.c_str() ; -// _path = new char[strlen(_temp)+1]; -// strcpy(_path,_temp); -// } -// } -// } + // Variables initialisation + char* _path = NULL; + bool _find = false ; -// if (!_find) -// { -// // The computer was not found, the exception should be thrown -// string message = "The computer "; -// message += machinename; -// message += " was not found in the catalog associated to the component "; -// message += _Component.name; -// MESSAGE(message) -// throw SALOME_ModuleCatalog::NotFound(message.c_str()); -// } + // Parse all the path prefixes + // looking for the wanted computer + for (unsigned int ind = 0 ; ind < _Component.paths.length() ; ind++) + { + if (strcmp(machinename, _Component.paths[ind].machine) == 0) + { + _find = true ; + // Wanted computer + // affect the path to be returned + const char* _temp = _Component.paths[ind].path ; + _path = new char[strlen(_temp)+1]; + strcpy(_path,_temp); + } + } + + SCRUTE(_find); + if (!_find) + { + // The computer was not found, the exception should be thrown + string message = "The computer "; + message += machinename; + message += " was not found in the catalog associated to the component "; + message += _Component.name; + MESSAGE(message) + throw SALOME_ModuleCatalog::NotFound(message.c_str()); + } END_OF("GetPathPrefix"); - return NULL; + return _path; } //---------------------------------------------------------------------- @@ -657,3 +655,5 @@ void SALOME_ModuleCatalog_AcomponentImpl::duplicate duplicate(I_out.interfaceservicelist[ind1], I_in.interfaceservicelist[ind1]); } + + diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx index d777b1128..2319bee68 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx @@ -130,13 +130,13 @@ int main(int argc,char **argv) // Active catalog - SALOME_ModuleCatalogImpl* Catalogue_i = new SALOME_ModuleCatalogImpl(argc, argv); - poa->activate_object (Catalogue_i); + SALOME_ModuleCatalogImpl Catalogue_i(argc, argv, orb); + poa->activate_object (&Catalogue_i); mgr->activate(); - CORBA::Object_ptr myCata = Catalogue_i->_this(); + CORBA::Object_ptr myCata = Catalogue_i._this(); // initialise Naming Service SALOME_NamingService *_NS; @@ -155,8 +155,9 @@ int main(int argc,char **argv) #endif orb->run(); + mgr->deactivate(true,true); poa->destroy(1,1); - + } catch(CORBA::SystemException&) { INFOS("Caught CORBA::SystemException.") diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx index 7df36b972..ffd720568 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx @@ -41,7 +41,7 @@ static const char* SEPARATOR = ":"; // Function : SALOME_ModuleCatalogImpl // Purpose : Constructor //---------------------------------------------------------------------- -SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv) +SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA::ORB_ptr & orb) : _orb(orb) { MESSAGE("Catalog creation"); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx index 35f450166..1600fae67 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx @@ -43,7 +43,7 @@ class SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog, { public: //! standard constructor - SALOME_ModuleCatalogImpl(int artgc, char** argv); + SALOME_ModuleCatalogImpl(int artgc, char** argv, CORBA::ORB_ptr & orb); //! standard destructor virtual ~SALOME_ModuleCatalogImpl(); @@ -104,6 +104,8 @@ public: void ping(){}; + void shutdown() { _orb->shutdown(1); }; + private: //! method to parse one module catalog /*! @@ -209,6 +211,8 @@ private: std::map ComponentTypeConvert; + + CORBA::ORB_ptr _orb; }; #endif // MODULECATALOG_IMPL_H -- 2.39.2