1 // Copyright (C) 2006-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _PYTHONNODE_HXX_
21 #define _PYTHONNODE_HXX_
23 #include "YACSRuntimeSALOMEExport.hxx"
24 #include "InlineNode.hxx"
25 #include <SALOMEconfig.h>
26 #include CORBA_CLIENT_HEADER(SALOME_PyNode)
27 #include CORBA_CLIENT_HEADER(SALOME_Component)
35 class YACSRUNTIMESALOME_EXPORT PythonEntry
40 virtual void assignRemotePyInterpretor(Engines::PyNodeBase_var remoteInterp) = 0;
41 //! returns (if any) an object, you have to deal with (UnRegister)
42 virtual Engines::PyNodeBase_var retrieveDftRemotePyInterpretorIfAny(Engines::Container_ptr objContainer) const = 0;
43 //! returns an object, you have to deal with (UnRegister)
44 virtual void createRemoteAdaptedPyInterpretor(Engines::Container_ptr objContainer) = 0;
45 virtual Engines::PyNodeBase_var getRemoteInterpreterHandle() = 0;
46 virtual const char *getSerializationScript() const = 0;
48 void commonRemoteLoad(InlineNode *reqNode);
49 void commonRemoteLoadPart1(InlineNode *reqNode);
50 Engines::Container_var commonRemoteLoadPart2(InlineNode *reqNode, bool& isInitializeRequested);
54 PyObject *_pyfuncUnser;
57 class YACSRUNTIMESALOME_EXPORT PythonNode : public InlineNode, public PythonEntry
60 Node *simpleClone(ComposedNode *father, bool editionOnly) const;
61 // overload part of PythonEntry
62 void createRemoteAdaptedPyInterpretor(Engines::Container_ptr objContainer);
63 Engines::PyNodeBase_var retrieveDftRemotePyInterpretorIfAny(Engines::Container_ptr objContainer) const;
64 void assignRemotePyInterpretor(Engines::PyNodeBase_var remoteInterp);
65 Engines::PyNodeBase_var getRemoteInterpreterHandle();
66 const char *getSerializationScript() const { return SCRIPT_FOR_SERIALIZATION; }
68 PythonNode(const PythonNode& other, ComposedNode *father);
69 PythonNode(const std::string& name);
70 virtual ~PythonNode();
71 virtual void checkBasicConsistency() const throw(Exception);
72 virtual void execute();
74 virtual void loadRemote();
75 virtual void loadLocal();
76 virtual void executeRemote();
77 virtual void executeLocal();
78 virtual void shutdown(int level);
79 std::string getContainerLog();
80 PythonNode* cloneNode(const std::string& name);
81 virtual std::string typeName() { return "YACS__ENGINE__PythonNode"; }
83 static const char KIND[];
84 static const char IMPL_NAME[];
85 static const char SCRIPT_FOR_SERIALIZATION[];
87 Engines::PyScriptNode_var _pynode;
90 class PyFuncNode : public InlineFuncNode, public PythonEntry
93 Node *simpleClone(ComposedNode *father, bool editionOnly) const;
94 // overload part of PythonEntry
95 void createRemoteAdaptedPyInterpretor(Engines::Container_ptr objContainer);Engines::
96 PyNodeBase_var retrieveDftRemotePyInterpretorIfAny(Engines::Container_ptr objContainer) const;
97 void assignRemotePyInterpretor(Engines::PyNodeBase_var remoteInterp);
98 Engines::PyNodeBase_var getRemoteInterpreterHandle();
99 const char *getSerializationScript() const { return SCRIPT_FOR_SERIALIZATION; }
101 PyFuncNode(const PyFuncNode& other, ComposedNode *father);
102 PyFuncNode(const std::string& name);
103 virtual ~PyFuncNode();
104 virtual void checkBasicConsistency() const throw(Exception);
105 virtual void execute();
107 virtual void loadRemote();
108 virtual void loadLocal();
109 virtual void executeRemote();
110 virtual void executeLocal();
111 virtual void shutdown(int level);
112 std::string getContainerLog();
113 PyFuncNode* cloneNode(const std::string& name);
114 virtual std::string typeName() { return "YACS__ENGINE__PyFuncNode"; }
116 static const char SCRIPT_FOR_SERIALIZATION[];
119 Engines::PyNode_var _pynode;