2 #ifndef _PYTHONPORTS_HXX_
3 #define _PYTHONPORTS_HXX_
7 #include "InputPort.hxx"
8 #include "OutputPort.hxx"
14 class InterpreterUnlocker
17 InterpreterUnlocker() {
18 gstate_ = PyGILState_Ensure();
20 ~InterpreterUnlocker() {
21 PyGILState_Release(gstate_);
24 PyGILState_STATE gstate_;
27 /*! \brief Class for Python Ports
33 class InputPyPort : public InputPort
36 InputPyPort(const std::string& name, Node * node, TypeCode * type);
37 InputPyPort(const InputPyPort& other, Node *newHelder);
39 bool edIsManuallyInitialized() const;
40 void edRemoveManInit();
41 virtual void put(const void *data) throw(ConversionException);
42 void put(PyObject *data) throw(ConversionException);
43 InputPort *clone(Node *newHelder) const;
44 virtual PyObject * getPyObj() const;
45 void *get() const throw(Exception);
46 virtual bool isEmpty();
47 virtual void exSaveInit();
48 virtual void exRestoreInit();
49 virtual std::string dump();
55 class OutputPyPort : public OutputPort
58 OutputPyPort(const std::string& name, Node * node, TypeCode * type);
59 OutputPyPort(const OutputPyPort& other, Node *newHelder);
61 virtual void put(const void *data) throw(ConversionException);
62 void put(PyObject *data) throw(ConversionException);
63 OutputPort *clone(Node *newHelder) const;
64 virtual PyObject * get() const;
65 virtual std::string dump();