-// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//=============================================================================
Engines_Container_i::Engines_Container_i () :
-_numInstance(0),_id(0),_NS(0)
+ _NS(0),_id(0),_numInstance(0)
{
}
bool activAndRegist,
bool isServantAloneInProcess
) :
- _numInstance(0),_isServantAloneInProcess(isServantAloneInProcess),_id(0),_NS(0)
+ _NS(0),_id(0),_numInstance(0),_isServantAloneInProcess(isServantAloneInProcess)
{
_pid = (long)getpid();
delete _id;
if(_NS)
delete _NS;
- for(std::map<std::string,Engines::PyNode_var>::iterator it=_dftPyNode.begin();it!=_dftPyNode.end();it++)
- {
- Engines::PyNode_var tmpVar((*it).second);
- if(!CORBA::is_nil(tmpVar))
- tmpVar->UnRegister();
- }
- for(std::map<std::string,Engines::PyScriptNode_var>::iterator it=_dftPyScriptNode.begin();it!=_dftPyScriptNode.end();it++)
- {
- Engines::PyScriptNode_var tmpVar((*it).second);
- if(!CORBA::is_nil(tmpVar))
- tmpVar->UnRegister();
- }
+ cleanAllPyScripts();
}
//=============================================================================
{
itm->second->destroy();
}
- catch(const CORBA::Exception& e)
+ catch(const CORBA::Exception&)
{
// ignore this entry and continue
}
}
#else
HINSTANCE handle;
- handle = LoadLibrary( impl_name.c_str() );
+#ifdef UNICODE
+ std::wstring libToLoad = Kernel_Utils::utf8_decode_s( impl_name );
+#else
+ std::string libToLoad = impl_name;
+#endif
+ handle = LoadLibrary(libToLoad.c_str() );
if ( !handle )
{
reason="ImplementationNotFound";
Engines::EngineComponent_ptr
Engines_Container_i::load_impl( const char* genericRegisterName,
- const char* componentName )
+ const char* /*componentName*/ )
{
char* reason;
std::string impl_name = std::string(LIB) + genericRegisterName + ENGINESO;
bool Engines_Container_i::isPythonContainer(const char* ContainerName)
{
bool ret=false;
- int len=strlen(ContainerName);
+ size_t len=strlen(ContainerName);
if(len>=2)
if(strcmp(ContainerName+len-2,"Py")==0)
ret=true;
void CallCancelThread() ;
#ifndef WIN32
-void SigIntHandler(int what ,
+void SigIntHandler(int /*what*/ ,
siginfo_t * siginfo ,
- void * toto )
+ void * /*toto*/ )
{
//PAL9042 JR : during the execution of a Signal Handler (and of methods called through Signal Handlers)
// use of streams (and so on) should never be used because :
aSalome_file->setLocalFile(origFileName);
aSalome_file->recvFiles();
}
- catch (const SALOME::SALOME_Exception& e)
+ catch (const SALOME::SALOME_Exception& /*e*/) //!< TODO: unused variable
{
return Engines::Salome_file::_nil();
}
oldNode->UnRegister();
(*it).second=node;
}
- if(!CORBA::is_nil(node))
- node->Register();
return node._retn();
}
else
}
}
+void Engines_Container_i::removePyScriptNode(const char *nodeName)
+{
+ std::map<std::string,Engines::PyScriptNode_var>::iterator it(_dftPyScriptNode.find(nodeName));
+ if(it==_dftPyScriptNode.end())
+ {
+ std::ostringstream oss; oss << "Engines_Container_i::removePyScriptNode : node \"" << nodeName << "\" is not map !";
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = oss.str().c_str();
+ throw SALOME::SALOME_Exception(es);
+ }
+ (*it).second->UnRegister();
+ _dftPyScriptNode.erase(it);
+}
+
+void Engines_Container_i::cleanAllPyScripts()
+{
+ for(std::map<std::string,Engines::PyNode_var>::iterator it=_dftPyNode.begin();it!=_dftPyNode.end();it++)
+ {
+ Engines::PyNode_var tmpVar((*it).second);
+ if(!CORBA::is_nil(tmpVar))
+ tmpVar->UnRegister();
+ }
+ _dftPyNode.clear();
+ for(std::map<std::string,Engines::PyScriptNode_var>::iterator it=_dftPyScriptNode.begin();it!=_dftPyScriptNode.end();it++)
+ {
+ Engines::PyScriptNode_var tmpVar((*it).second);
+ if(!CORBA::is_nil(tmpVar))
+ tmpVar->UnRegister();
+ }
+ _dftPyScriptNode.clear();
+}
+
//=============================================================================
/*! \brief Retrieves the last created PyScriptNode instance with createPyScriptNode.
*
{
std::list<std::string>::const_iterator it;
for ( it = _tmp_files.begin(); it != _tmp_files.end(); ++it ) {
-#ifdef WIN32
- std::string command = (GetFileAttributes((*it).c_str()) == FILE_ATTRIBUTE_DIRECTORY) ? "rd /Q \"" : "del /F /Q \"";
+#if defined(WIN32) && defined(UNICODE)
+ std::wstring aFile = Kernel_Utils::utf8_decode_s(*it);
+ std::wstring command = (GetFileAttributes(aFile.c_str()) == FILE_ATTRIBUTE_DIRECTORY) ? L"rd /Q \"" : L"del /F /Q \"";
+ command += aFile;
+ command += L"\" 2>NUL";
+ _wsystem(command.c_str());
#else
- std::string command = "rm -rf ";
-#endif
- command += *it;
+#if defined(WIN32)
+ std::string aFile = *it;
+ std::string command = (GetFileAttributes(aFile.c_str()) == FILE_ATTRIBUTE_DIRECTORY) ? "rd /Q \"" : "del /F /Q \"";
+ command += aFile;
command += "\" 2>NUL";
- system( command.c_str() );
+#else
+ std::string command = "rm -rf ";
+ command += *it;
+#endif
+ system(command.c_str());
+#endif
}
_tmp_files.clear();
}