itom  3.0.0
pythonMatlab.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2016, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 #ifndef PYTHONMATLAB_H
24 #define PYTHONMATLAB_H
25 
26 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
27 
28 // see http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=7f3f750596a105d48ea84ebfe1b1c4ca03e0bab3
29 #if (defined _DEBUG) && (defined WIN32)
30  #undef _DEBUG
31  #if (defined linux) | (defined CMAKE)
32  #include "Python.h"
33  #include "numpy/arrayobject.h"
34  #elif (defined __APPLE__) | (defined CMAKE)
35  #include "Python.h"
36  #include "numpy/arrayobject.h"
37  #else
38  #include "Python.h"
39  #include "../Lib/site-packages/numpy/core/include/numpy/arrayobject.h" //for numpy arrays
40  #endif
41  #define _DEBUG
42 #else
43  #if (defined linux)
44  #include "Python.h"
45  #include "numpy/arrayobject.h"
46  #elif (defined __APPLE__)
47  #include "Python.h"
48  #include "numpy/arrayobject.h"
49  #else
50  #include "Python.h"
51  #include "../Lib/site-packages/numpy/core/include/numpy/arrayobject.h" //for numpy arrays
52  #endif
53 #endif
54 #include "structmember.h"
55 
56 #include "../global.h"
57 
58 #if ITOM_PYTHONMATLAB == 1
59 /* * *
60  * Copyright 2010 Joakim Mller
61  *
62  * This file is part of pymatlab.
63  *
64  * pymatlab is free software: you can redistribute it and/or modify
65  * it under the terms of the GNU General Public License as published by
66  * the Free Software Foundation, either version 3 of the License, or
67  * (at your option) any later version.
68  *
69  * pymatlab is distributed in the hope that it will be useful,
70  * but WITHOUT ANY WARRANTY; without even the implied warranty of
71  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
72  * GNU General Public License for more details.
73  *
74  * You should have received a copy of the GNU General Public License
75  * along with pymatlab. If not, see <http://www.gnu.org/licenses/>.
76  * * */
77 
78 #include "common/retVal.h"
79 #include <qlibrary.h>
80 #include <engine.h>
81 
82 
83 
84 namespace ito
85 {
86 
87 class PythonMatlab
88 {
89 
90 public:
91 
92  typedef struct
93  {
94  PyObject_HEAD
95  Engine *ep;
96  } PyMatlabSessionObject;
97 
98  static PyObject * PyMatlabSessionObject_new(PyTypeObject *type, PyObject *args, PyObject * kwds);
99 
100  static int PyMatlabSessionObject_init(PyMatlabSessionObject *self, PyObject *args, PyObject *kwds);
101 
102  static void PyMatlabSessionObject_dealloc(PyMatlabSessionObject *self);
103 
104  static PyObject * PyMatlabSessionObject_run(PyMatlabSessionObject *self, PyObject *args);
105 
106  static PyObject * PyMatlabSessionObject_setValue(PyMatlabSessionObject *self, PyObject *args);
107 
108  static PyObject * PyMatlabSessionObject_setString(PyMatlabSessionObject *self, PyObject *args);
109 
110  static PyObject * PyMatlabSessionObject_getString(PyMatlabSessionObject *self, PyObject *args);
111 
112  static PyObject * PyMatlabSessionObject_GetValue(PyMatlabSessionObject * self, PyObject *args);
113 
114  static PyObject * PyMatlabSessionObject_close(PyMatlabSessionObject * self, PyObject *args);
115 
116 
117  static PyMethodDef PyMatlabSessionObject_methods[];
118  static PyMemberDef PyMatlabSessionObject_members[]; // = { { NULL } };
119  static PyTypeObject PyMatlabSessionObjectType;
120  static PyModuleDef PyMatlabSessionObject_Module;
121  static PyObject* PyInit_matlab(void);
122 
123  static bool initialized;
124  static ito::RetVal loadLibrary();
125 
126  static QLibrary engineLibrary;
127  static QLibrary mxLibrary;
128 
129 }; //end class PythonMatlab
130 
131 } //end namespace ito
132 
133 
134 #endif
135 
136 #endif
Class for managing status values (like errors or warning)
Definition: retVal.h:54
Definition: apiFunctionsGraph.cpp:39