-// Copyright (C) 2019-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2019-2024 CEA, EDF, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
unsigned SALOME_ExternalServerLauncher::CNT = 0;
-SALOME_ExternalServerLauncher::SALOME_ExternalServerLauncher(const SALOME_CPythonHelper *pyHelper, CORBA::ORB_ptr orb, PortableServer::POA_var poa):_pyHelper(pyHelper),_poa(poa)
+SALOME_ExternalServerLauncher::SALOME_ExternalServerLauncher(const SALOME_CPythonHelper *pyHelper, CORBA::ORB_ptr orb, PortableServer::POA_var poa,SALOME_NamingService_Abstract *ns):_pyHelper(pyHelper),_poa(poa)
{
- _NS = new SALOME_NamingService(orb);
+ _NS = ns == nullptr ? new SALOME_NamingService(orb) : ns;
PortableServer::ObjectId_var id(_poa->activate_object(this));
CORBA::Object_var obj(_poa->id_to_reference(id));
SALOME::ExternalServerLauncher_var refPtr(SALOME::ExternalServerLauncher::_narrow(obj));
throw SALOME_LauncherException(oss2.str());
}
std::vector<std::string> cmd(command_list.length());
- const char *toto(command_list[0]);
- for(auto i=0;i<command_list.length();i++)
+ for(size_t i=0;i<command_list.length();i++)
cmd[i] = command_list[i];
long pid(0);
try
std::vector<std::string> loes(ListOfExternalServersCpp(_NS));
std::size_t sz(loes.size());
ret->length(sz);
- for(auto i = 0; i<sz ; i++)
+ for(size_t i=0; i<sz; i++)
{
(*ret)[i]=CORBA::string_dup(loes[i].c_str());
}
//
std::unique_ptr<SALOME::ByteVec> ret(new SALOME::ByteVec);
ret->length(size);
- for(std::size_t i=0;i<size;++i)
+ for(size_t i=0;i<size;++i)
(*ret)[i] = buffer.get()[i];
//
if( unlink(file_name)!=0 )
return ret.release();
}
-std::vector<std::string> SALOME_ExternalServerLauncher::ListOfExternalServersCpp(SALOME_NamingService *ns)
+std::vector<std::string> SALOME_ExternalServerLauncher::ListOfExternalServersCpp(SALOME_NamingService_Abstract *ns)
{
ns->Change_Directory(NAME_IN_NS);
std::vector<std::string> ret(ns->list_directory());
return ret;
}
-bool SALOME_ExternalServerLauncher::IsAliveAndKicking(SALOME_NamingService *ns, const std::string& serverName)
+bool SALOME_ExternalServerLauncher::IsAliveAndKicking(SALOME_NamingService_Abstract *ns, const std::string& serverName)
{
SALOME::ExternalServerHandler_var pt(GetServerHandlerGivenName(ns, serverName));
if( CORBA::is_nil(pt) )
return IsAliveAndKicking(pt);
}
-SALOME::ExternalServerHandler_var SALOME_ExternalServerLauncher::GetServerHandlerGivenName(SALOME_NamingService *ns, const std::string& serverName)
+SALOME::ExternalServerHandler_var SALOME_ExternalServerLauncher::GetServerHandlerGivenName(SALOME_NamingService_Abstract *ns, const std::string& serverName)
{
std::vector<std::string> serverNames(ListOfExternalServersCpp(ns));
if(std::find(serverNames.begin(),serverNames.end(),serverName)==serverNames.end())