itom 2.2.1
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2016, Institut fuer Technische Optik (ITO), 00005 Universitaet Stuttgart, Germany 00006 00007 This file is part of itom. 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 itom is distributed in the hope that it will be useful, but 00015 WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00017 General Public Licence for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with itom. If not, see <http://www.gnu.org/licenses/>. 00021 *********************************************************************** */ 00022 00023 #ifndef PYTHONMATLAB_H 00024 #define PYTHONMATLAB_H 00025 00026 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION 00027 00028 // see http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=7f3f750596a105d48ea84ebfe1b1c4ca03e0bab3 00029 #if (defined _DEBUG) && (defined WIN32) 00030 #undef _DEBUG 00031 #if (defined linux) | (defined CMAKE) 00032 #include "Python.h" 00033 #include "numpy/arrayobject.h" 00034 #elif (defined __APPLE__) | (defined CMAKE) 00035 #include "Python.h" 00036 #include "numpy/arrayobject.h" 00037 #else 00038 #include "Python.h" 00039 #include "../Lib/site-packages/numpy/core/include/numpy/arrayobject.h" //for numpy arrays 00040 #endif 00041 #define _DEBUG 00042 #else 00043 #if (defined linux) 00044 #include "Python.h" 00045 #include "numpy/arrayobject.h" 00046 #elif (defined __APPLE__) 00047 #include "Python.h" 00048 #include "numpy/arrayobject.h" 00049 #else 00050 #include "Python.h" 00051 #include "../Lib/site-packages/numpy/core/include/numpy/arrayobject.h" //for numpy arrays 00052 #endif 00053 #endif 00054 #include "structmember.h" 00055 00056 #include "../global.h" 00057 00058 #if ITOM_PYTHONMATLAB == 1 00059 /* * * 00060 * Copyright 2010 Joakim Mller 00061 * 00062 * This file is part of pymatlab. 00063 * 00064 * pymatlab is free software: you can redistribute it and/or modify 00065 * it under the terms of the GNU General Public License as published by 00066 * the Free Software Foundation, either version 3 of the License, or 00067 * (at your option) any later version. 00068 * 00069 * pymatlab is distributed in the hope that it will be useful, 00070 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00071 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00072 * GNU General Public License for more details. 00073 * 00074 * You should have received a copy of the GNU General Public License 00075 * along with pymatlab. If not, see <http://www.gnu.org/licenses/>. 00076 * * */ 00077 00078 #include "common/retVal.h" 00079 #include <qlibrary.h> 00080 #include <engine.h> 00081 00082 00083 00084 namespace ito 00085 { 00086 00087 class PythonMatlab 00088 { 00089 00090 public: 00091 00092 typedef struct 00093 { 00094 PyObject_HEAD 00095 Engine *ep; 00096 } PyMatlabSessionObject; 00097 00098 static PyObject * PyMatlabSessionObject_new(PyTypeObject *type, PyObject *args, PyObject * kwds); 00099 00100 static int PyMatlabSessionObject_init(PyMatlabSessionObject *self, PyObject *args, PyObject *kwds); 00101 00102 static void PyMatlabSessionObject_dealloc(PyMatlabSessionObject *self); 00103 00104 static PyObject * PyMatlabSessionObject_run(PyMatlabSessionObject *self, PyObject *args); 00105 00106 static PyObject * PyMatlabSessionObject_setValue(PyMatlabSessionObject *self, PyObject *args); 00107 00108 static PyObject * PyMatlabSessionObject_setString(PyMatlabSessionObject *self, PyObject *args); 00109 00110 static PyObject * PyMatlabSessionObject_getString(PyMatlabSessionObject *self, PyObject *args); 00111 00112 static PyObject * PyMatlabSessionObject_GetValue(PyMatlabSessionObject * self, PyObject *args); 00113 00114 static PyObject * PyMatlabSessionObject_close(PyMatlabSessionObject * self, PyObject *args); 00115 00116 00117 static PyMethodDef PyMatlabSessionObject_methods[]; 00118 static PyMemberDef PyMatlabSessionObject_members[]; // = { { NULL } }; 00119 static PyTypeObject PyMatlabSessionObjectType; 00120 static PyModuleDef PyMatlabSessionObject_Module; 00121 static PyObject* PyInit_matlab(void); 00122 00123 static bool initialized; 00124 static ito::RetVal loadLibrary(); 00125 00126 static QLibrary engineLibrary; 00127 static QLibrary mxLibrary; 00128 00129 }; //end class PythonMatlab 00130 00131 } //end namespace ito 00132 00133 00134 #endif 00135 00136 #endif