From e070846696ed966545c4e2d5042d47e2a8d6680e Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 28 Oct 2014 18:01:56 +0100 Subject: [PATCH] Debug. Now scope server are correctly launched. --- idl/SALOME_SDS.idl | 2 +- src/SALOMESDS/SALOMESDS_DataServerManager.cxx | 7 ++++--- src/SALOMESDS/SALOMESDS_DataServerManager.hxx | 2 +- src/SALOMESDS/SALOME_DataScopeServer.cxx | 3 +-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/idl/SALOME_SDS.idl b/idl/SALOME_SDS.idl index 1fabdef1a..51a36bf10 100644 --- a/idl/SALOME_SDS.idl +++ b/idl/SALOME_SDS.idl @@ -56,6 +56,6 @@ module SALOME DataScopeServer getDefaultScope(); DataScopeServer createDataScope(in string scopeName); DataScopeServer retriveDataScope(in string scopeName); - DataScopeServer removeDataScope(in string scopeName); + void removeDataScope(in string scopeName); }; }; diff --git a/src/SALOMESDS/SALOMESDS_DataServerManager.cxx b/src/SALOMESDS/SALOMESDS_DataServerManager.cxx index 69b5b35e7..ef946e2ef 100644 --- a/src/SALOMESDS/SALOMESDS_DataServerManager.cxx +++ b/src/SALOMESDS/SALOMESDS_DataServerManager.cxx @@ -96,7 +96,7 @@ SALOME::DataScopeServer_ptr DataServerManager::createDataScope(const char *scope // SALOME_NamingService ns(_orb); std::string fullScopeName(CreateAbsNameInNSFromScopeName(scopeName)); - std::ostringstream oss; oss << "SALOME_DataScopeServer" << " " << scopeName; + std::ostringstream oss; oss << "SALOME_DataScopeServer" << " " << scopeName << " "; SALOME_ContainerManager::AddOmninamesParams(oss,&ns); std::string command(oss.str()); SALOME_ContainerManager::MakeTheCommandToBeLaunchedASync(command); @@ -105,6 +105,8 @@ SALOME::DataScopeServer_ptr DataServerManager::createDataScope(const char *scope SALOME::DataScopeServer_var ret(SALOME::DataScopeServer::_nil()); while (CORBA::is_nil(ret) && count) { + SALOME_ContainerManager::SleepInSecond(1); + count--; CORBA::Object_var obj(ns.Resolve(fullScopeName.c_str())); ret=SALOME::DataScopeServer::_narrow(obj); } @@ -121,10 +123,9 @@ SALOME::DataScopeServer_ptr DataServerManager::retriveDataScope(const char *scop return SALOME::DataScopeServer::_duplicate(*it); } -SALOME::DataScopeServer_ptr DataServerManager::removeDataScope(const char *scopeName) +void DataServerManager::removeDataScope(const char *scopeName) { std::list< SALOME::DataScopeServer_var >::iterator it(getScopePtrGivenName(scopeName)); - return SALOME::DataScopeServer::_duplicate(*it); } std::string DataServerManager::CreateAbsNameInNSFromScopeName(const std::string& scopeName) diff --git a/src/SALOMESDS/SALOMESDS_DataServerManager.hxx b/src/SALOMESDS/SALOMESDS_DataServerManager.hxx index 61e01a1ae..55fcd62e3 100644 --- a/src/SALOMESDS/SALOMESDS_DataServerManager.hxx +++ b/src/SALOMESDS/SALOMESDS_DataServerManager.hxx @@ -42,7 +42,7 @@ namespace SALOMESDS SALOME::DataScopeServer_ptr getDefaultScope(); SALOME::DataScopeServer_ptr createDataScope(const char *scopeName); SALOME::DataScopeServer_ptr retriveDataScope(const char *scopeName); - SALOME::DataScopeServer_ptr removeDataScope(const char *scopeName); + void removeDataScope(const char *scopeName); static std::string CreateAbsNameInNSFromScopeName(const std::string& scopeName); public: static const char NAME_IN_NS[]; diff --git a/src/SALOMESDS/SALOME_DataScopeServer.cxx b/src/SALOMESDS/SALOME_DataScopeServer.cxx index 1ffab0a1f..6dac94637 100644 --- a/src/SALOMESDS/SALOME_DataScopeServer.cxx +++ b/src/SALOMESDS/SALOME_DataScopeServer.cxx @@ -50,8 +50,7 @@ int main(int argc, char* argv[]) obj=poa2->id_to_reference(id); SALOME::DataScopeServer_var serverPtr(SALOME::DataScopeServer::_narrow(obj)); // - std::ostringstream oss; oss << SALOMESDS::DataServerManager::NAME_IN_NS << "/" << scopeName; - std::string fullScopeName(oss.str()); + std::string fullScopeName(SALOMESDS::DataServerManager::CreateAbsNameInNSFromScopeName(scopeName)); SALOME_NamingService ns(orb); ns.Register(serverPtr,fullScopeName.c_str()); // -- 2.39.2