40 PyGILState_STATE gstate = PyGILState_Ensure();
45 msg <<
"Not possible to set builtins" << __FILE__ <<
":" << __LINE__;
46 PyGILState_Release(gstate);
49 PyGILState_Release(gstate);
57 PyGILState_STATE gstate = PyGILState_Ensure();
62 msg <<
"Not possible to set builtins" << __FILE__ <<
":" << __LINE__;
63 PyGILState_Release(gstate);
66 PyGILState_Release(gstate);
72 cerr <<
"---------------SalomePythonNode::load function---------------" << endl;
73 list<OutputPort *>::iterator iter;
75 PyObject* ob=PyBytes_FromString(value2Export.c_str());
80 cerr <<
"port name: " <<
p->
getName() << endl;
81 cerr <<
"port kind: " <<
p->edGetType()->kind() << endl;
84 PyGILState_STATE gstate = PyGILState_Ensure();
89 PyGILState_Release(gstate);
90 throw Exception(
"Error during execution");
98 PyGILState_Release(gstate);
99 throw Exception(
"Error during execution");
101 cerr <<
"---------------End SalomePythonNode::load function---------------" << endl;
102 PyGILState_Release(gstate);
107 cerr <<
"++++++++++++++ SalomePythonNode::execute: " <<
getName() <<
" ++++++++++++++++++++" << endl;
111 PyGILState_STATE gstate = PyGILState_Ensure();
113 cerr <<
"---------------SalomePythonNode::inputs---------------" << endl;
115 list<InputPort *>::iterator iter2;
119 cerr <<
"port name: " <<
p->
getName() << endl;
120 cerr <<
"port kind: " <<
p->edGetType()->kind() << endl;
122 PyObject_Print(ob,stderr,Py_PRINT_RAW);
124 cerr <<
"ob refcnt: " << ob->ob_refcnt << endl;
126 PyTuple_SetItem(
args,pos,ob);
127 cerr <<
"ob refcnt: " << ob->ob_refcnt << endl;
130 cerr <<
"---------------End SalomePythonNode::inputs---------------" << endl;
132 cerr <<
"----------------SalomePythonNode::calculation---------------" << endl;
133 PyObject_Print(
_pyfunc,stderr,Py_PRINT_RAW);
135 PyObject_Print(
args,stderr,Py_PRINT_RAW);
137 PyObject* result = PyObject_CallObject(
_pyfunc ,
args ) ;
142 PyGILState_Release(gstate);
143 throw Exception(
"Error during execution");
145 cerr <<
"----------------End SalomePythonNode::calculation---------------" << endl;
147 cerr <<
"-----------------SalomePythonNode::outputs-----------------" << endl;
149 if(result == Py_None)
151 else if(PyTuple_Check(result))
152 nres=PyTuple_Size(result);
157 PyGILState_Release(gstate);
158 throw Exception(
"Number of output arguments : Mismatch between definition and execution");
162 PyObject_Print(result,stderr,Py_PRINT_RAW);
164 list<OutputPort *>::iterator iter;
170 cerr <<
"port name: " <<
p->
getName() << endl;
171 cerr <<
"port kind: " <<
p->edGetType()->kind() << endl;
172 cerr <<
"port pos : " << pos << endl;
173 if(PyTuple_Check(result))ob=PyTuple_GetItem(result,pos) ;
175 cerr <<
"ob refcnt: " << ob->ob_refcnt << endl;
176 PyObject_Print(ob,stderr,Py_PRINT_RAW);
185 PyGILState_Release(gstate);
188 cerr <<
"-----------------End SalomePythonNode::outputs-----------------" << endl;
191 PyGILState_Release(gstate);
192 cerr <<
"++++++++++++++ End SalomePythonNode::execute: " <<
getName() <<
" ++++++++++++++++++++" << endl;
197 static const char LOC_KIND[]=
"";
219 list<InputPort *>::iterator iter;
223 n->edAddInputPort(
p->
getName(),
p->edGetType());
225 list<OutputPort *>::iterator iter2;
229 n->edAddOutputPort(
p->
getName(),
p->edGetType());
Base class for all composed nodes.
std::string getName() const
int getNumberOfOutputPorts() const
int getNumberOfInputPorts() const
std::list< InputPort * > _setOfInputPort
std::list< OutputPort * > _setOfOutputPort
Base class for all nodes.
std::string _implementation
const std::string & getName() const
static const char IMPL_NAME[]
ServiceNode * createNode(const std::string &name)
static const char PLACEMENT_VAR_NAME_IN_INTERP[]
std::string getKind() const
Return the service node kind.
SalomePythonNode * cloneNode(const std::string &name)
Create a new node of same type with a given name.
SalomePythonNode(const SalomePythonNode &other, ComposedNode *father)
virtual void load()
Load the component associated to the node.
Node * simpleClone(ComposedNode *father, bool editionOnly) const
Class for calculation node associated with a component service.
virtual void load()
Load the component associated to the node.
ComponentInstance * _component
virtual void setComponent(ComponentInstance *compo)
Associate an existing component instance to this service node AND check the consistency regarding the...
YACSRUNTIMESALOME_EXPORT RuntimeSALOME * getSALOMERuntime()