Salome HOME
mergefrom branch BR_V511_PR tag mergeto_trunk_03feb09
[modules/yacs.git] / src / runtime / PythonNode.hxx
1 //  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef _PYTHONNODE_HXX_
20 #define _PYTHONNODE_HXX_
21
22 #include "InlineNode.hxx"
23 #include <Python.h>
24
25 namespace YACS
26 {
27   namespace ENGINE
28   {
29     class PythonNode : public InlineNode 
30     {
31     protected:
32       Node *simpleClone(ComposedNode *father, bool editionOnly) const;
33     public:
34       PythonNode(const PythonNode& other, ComposedNode *father);
35       PythonNode(const std::string& name);
36       virtual ~PythonNode();
37       virtual void execute();
38       virtual void load();
39       PythonNode* cloneNode(const std::string& name);
40       static const char KIND[];
41       static const char IMPL_NAME[];
42       virtual std::string typeName() {return "YACS__ENGINE__PythonNode";}
43     protected:
44       PyObject* _context;
45     };
46
47     class PyFuncNode : public InlineFuncNode 
48     {
49     protected:
50       Node *simpleClone(ComposedNode *father, bool editionOnly) const;
51     public:
52       PyFuncNode(const PyFuncNode& other, ComposedNode *father);
53       PyFuncNode(const std::string& name);
54       virtual ~PyFuncNode();
55       virtual void execute();
56       virtual void load();
57       PyFuncNode* cloneNode(const std::string& name);
58       virtual std::string typeName() {return "YACS__ENGINE__PyFuncNode";}
59     protected:
60       PyObject* _context;
61       PyObject* _pyfunc;
62     };
63   }
64 }
65
66 #endif