// ignore this entry and continue
}
}
+ _listInstances_map.clear();
_NS->Destroy_FullDirectory(_containerName.c_str());
_NS->Destroy_Name(_containerName.c_str());
- //_remove_ref();
- //_poa->deactivate_object(*_id);
if(_isServantAloneInProcess)
{
MESSAGE("Effective Shutdown of container Begins...");
Engines_Component_i *servant =
dynamic_cast<Engines_Component_i*>(_poa->reference_to_servant(iobject));
ASSERT(servant);
- //SCRUTE(servant->pd_refCount);
- servant->_remove_ref(); // compensate previous id_to_reference
- //SCRUTE(servant->pd_refCount);
+ //SCRUTE(servant->_refcount_value());
_numInstanceMutex.lock() ; // lock to be alone (stl container write)
_listInstances_map[instanceName] = iobject;
_cntInstances_map[aGenRegisterName] += 1;
_numInstanceMutex.unlock() ;
SCRUTE(aGenRegisterName);
SCRUTE(_cntInstances_map[aGenRegisterName]);
- //SCRUTE(servant->pd_refCount);
-#if defined(_DEBUG_) || defined(_DEBUG)
- bool ret_studyId = servant->setStudyId(studyId);
- ASSERT(ret_studyId);
-#else
servant->setStudyId(studyId);
-#endif
+ servant->_remove_ref(); // do not need servant any more (remove ref from reference_to_servant)
+ //SCRUTE(servant->_refcount_value());
// --- register the engine under the name
// containerName(.dir)/instanceName(.object)
#ifndef WIN32
struct sigaction SigIntAct ;
SigIntAct.sa_sigaction = &SigIntHandler ;
+ sigemptyset(&SigIntAct.sa_mask);
SigIntAct.sa_flags = SA_SIGINFO ;
#endif
}
}
+/*! \brief create a PyNode object to execute remote python code
+ * \param nodeName the name of the node
+ * \param code the python code to load
+ * \return the PyNode
+ */
+Engines::PyNode_ptr Engines_Container_i::createPyNode(const char* nodeName, const char* code)
+{
+ Engines::PyNode_var node= Engines::PyNode::_nil();
+
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject *res = PyObject_CallMethod(_pyCont,
+ (char*)"create_pynode",
+ (char*)"ss",
+ nodeName,
+ code);
+ if(res==NULL)
+ {
+ //internal error
+ PyErr_Print();
+ PyGILState_Release(gstate);
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "can not create a python node";
+ throw SALOME::SALOME_Exception(es);
+ }
+ long ierr=PyInt_AsLong(PyTuple_GetItem(res,0));
+ PyObject* result=PyTuple_GetItem(res,1);
+ 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);
+ return node._retn();
+ }
+ else
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = astr.c_str();
+ throw SALOME::SALOME_Exception(es);
+ }
+
+}