delete _id;
if(_NS)
delete _NS;
- if(!CORBA::is_nil(_dftPyNode))
- _dftPyNode->UnRegister();
- if(!CORBA::is_nil(_dftPyScriptNode))
- _dftPyScriptNode->UnRegister();
+ 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();
+ }
}
//=============================================================================
std::string astr=PyString_AsString(result);
Py_DECREF(res);
PyGILState_Release(gstate);
-
if(ierr==0)
{
- CORBA::Object_var obj = _orb->string_to_object(astr.c_str());
- node = Engines::PyNode::_narrow(obj);
- if(!CORBA::is_nil(_dftPyNode))
- _dftPyNode->UnRegister();
- _dftPyNode = node;
- if(!CORBA::is_nil(_dftPyNode))
- _dftPyNode->Register();
+ Utils_Locker lck(&_mutexForDftPy);
+ CORBA::Object_var obj=_orb->string_to_object(astr.c_str());
+ node=Engines::PyNode::_narrow(obj);
+ std::map<std::string,Engines::PyNode_var>::iterator it(_dftPyNode.find(nodeName));
+ if(it==_dftPyNode.end())
+ {
+ _dftPyNode[nodeName]=node;
+ }
+ else
+ {
+ Engines::PyNode_var oldNode((*it).second);
+ if(!CORBA::is_nil(oldNode))
+ oldNode->UnRegister();
+ (*it).second=node;
+ }
+ if(!CORBA::is_nil(node))
+ node->Register();
return node._retn();
}
else
es.text = astr.c_str();
throw SALOME::SALOME_Exception(es);
}
-
}
//=============================================================================
//=============================================================================
Engines::PyNode_ptr Engines_Container_i::getDefaultPyNode(const char *nodeName)
{
- if(!CORBA::is_nil(_dftPyNode))
- return Engines::PyNode::_duplicate(_dftPyNode);
- else
+ Utils_Locker lck(&_mutexForDftPy);
+ std::map<std::string,Engines::PyNode_var>::iterator it(_dftPyNode.find(nodeName));
+ if(it==_dftPyNode.end())
return Engines::PyNode::_nil();
+ else
+ {
+ Engines::PyNode_var tmpVar((*it).second);
+ if(!CORBA::is_nil(tmpVar))
+ return Engines::PyNode::_duplicate(tmpVar);
+ else
+ return Engines::PyNode::_nil();
+ }
}
//=============================================================================
if(ierr==0)
{
- CORBA::Object_var obj = _orb->string_to_object(astr.c_str());
- node = Engines::PyScriptNode::_narrow(obj);
- if(!CORBA::is_nil(_dftPyScriptNode))
- _dftPyScriptNode->UnRegister();
- _dftPyScriptNode = node;
- if(!CORBA::is_nil(_dftPyScriptNode))
- _dftPyScriptNode->Register();
+ Utils_Locker lck(&_mutexForDftPy);
+ CORBA::Object_var obj=_orb->string_to_object(astr.c_str());
+ node=Engines::PyScriptNode::_narrow(obj);
+ std::map<std::string,Engines::PyScriptNode_var>::iterator it(_dftPyScriptNode.find(nodeName));
+ if(it==_dftPyScriptNode.end())
+ {
+ _dftPyScriptNode[nodeName]=node;
+ }
+ else
+ {
+ Engines::PyScriptNode_var oldNode((*it).second);
+ if(!CORBA::is_nil(oldNode))
+ oldNode->UnRegister();
+ (*it).second=node;
+ }
+ if(!CORBA::is_nil(node))
+ node->Register();
return node._retn();
}
else
//=============================================================================
Engines::PyScriptNode_ptr Engines_Container_i::getDefaultPyScriptNode(const char *nodeName)
{
- if(!CORBA::is_nil(_dftPyScriptNode))
- return Engines::PyScriptNode::_duplicate(_dftPyScriptNode);
- else
+ Utils_Locker lck(&_mutexForDftPy);
+ std::map<std::string,Engines::PyScriptNode_var>::iterator it(_dftPyScriptNode.find(nodeName));
+ if(it==_dftPyScriptNode.end())
return Engines::PyScriptNode::_nil();
+ else
+ {
+ Engines::PyScriptNode_var tmpVar((*it).second);
+ if(!CORBA::is_nil(tmpVar))
+ return Engines::PyScriptNode::_duplicate(tmpVar);
+ else
+ return Engines::PyScriptNode::_nil();
+ }
}
//=============================================================================
#define _SALOME_CONTAINER_I_HXX_
#include "SALOME_Container.hxx"
+#include "Utils_Mutex.hxx"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Component)
std::map<std::string,Engines::EngineComponent_var> _listInstances_map;
std::map<std::string,Engines::fileRef_var> _fileRef_map;
std::map<std::string,Engines::Salome_file_var> _Salome_file_map;
- Engines::PyScriptNode_var _dftPyScriptNode;
- Engines::PyNode_var _dftPyNode;
+ std::map<std::string,Engines::PyScriptNode_var> _dftPyScriptNode;
+ std::map<std::string,Engines::PyNode_var> _dftPyNode;
+ Utils_Mutex _mutexForDftPy;
std::list<std::string> _tmp_files;
Engines::fileTransfer_var _fileTransfer;