itom  4.1.0
pythonAutoInterval.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, 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 PYTHONAUTOINTERVAL
24 #define PYTHONAUTOINTERVAL
25 
26 /* includes */
27 #ifndef Q_MOC_RUN
28  #define PY_ARRAY_UNIQUE_SYMBOL itom_ARRAY_API //see numpy help ::array api :: Miscellaneous :: Importing the api (this line must bebefore include global.h)
29  #define NO_IMPORT_ARRAY
30  //python
31  // see http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=7f3f750596a105d48ea84ebfe1b1c4ca03e0bab3
32  #if (defined _DEBUG) && (defined WIN32)
33  #undef _DEBUG
34  #include "python/pythonWrapper.h"
35  #define _DEBUG
36  #else
37  #include "python/pythonWrapper.h"
38  #endif
39 #endif
40 
41 #include "../../common/typeDefs.h"
42 #include "../../common/interval.h"
43 #include "../../common/qtMetaTypeDeclarations.h"
44 #include "structmember.h"
45 #include <qobject.h>
46 
47 namespace ito
48 {
50  {
51 
52  public:
53 
54  //-------------------------------------------------------------------------------------------------
55  // typedefs
56  //-------------------------------------------------------------------------------------------------
57  typedef struct
58  {
59  PyObject_HEAD
60  ito::AutoInterval interval;
61  }
63 
64 
65  #define PyAutoInterval_Check(op) PyObject_TypeCheck(op, &ito::PythonAutoInterval::PyAutoIntervalType)
66 
67 
68  //-------------------------------------------------------------------------------------------------
69  // constructor, deconstructor, alloc, dellaoc
70  //-------------------------------------------------------------------------------------------------
71 
72  static void PyAutoInterval_dealloc(PyAutoInterval *self);
73  static PyObject *PyAutoInterval_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
74  static int PyAutoInterval_init(PyAutoInterval *self, PyObject *args, PyObject *kwds);
75 
76  static PyAutoInterval* createEmptyPyAutoInterval();
77 
78 
79  //-------------------------------------------------------------------------------------------------
80  // general members
81  //-------------------------------------------------------------------------------------------------
82  static PyObject *PyAutoInterval_name(PyAutoInterval *self);
83 
84  static PyObject* PyAutoInterval_repr(PyAutoInterval *self);
85 
86  static PyObject* PyAutoInterval_RichCompare(PyAutoInterval *self, PyObject *other, int cmp_op);
87 
88  static PyGetSetDef PyAutoInterval_getseters[];
89 
90  static PyObject* PyAutoInterval_getValue(PyAutoInterval *self, void *closure);
91  static int PyAutoInterval_setValue(PyAutoInterval *self, PyObject *value, void *closure);
92 
93  static PyObject* PyAutoInterval_Reduce(PyAutoInterval *self, PyObject *args);
94  static PyObject* PyAutoInterval_SetState(PyAutoInterval *self, PyObject *args);
95 
96  //-------------------------------------------------------------------------------------------------
97  // getter / setter
98  //-------------------------------------------------------------------------------------------------
99  static PyObject* PyAutoInterval_getMin(PyAutoInterval *self, void *closure);
100  static int PyAutoInterval_setMin(PyAutoInterval *self, PyObject *value, void *closure);
101 
102  static PyObject* PyAutoInterval_getMax(PyAutoInterval *self, void *closure);
103  static int PyAutoInterval_setMax(PyAutoInterval *self, PyObject *value, void *closure);
104 
105  static PyObject* PyAutoInterval_getAuto(PyAutoInterval *self, void *closure);
106  static int PyAutoInterval_setAuto(PyAutoInterval *self, PyObject *value, void *closure);
107 
108 
109  //-------------------------------------------------------------------------------------------------
110  // type structures
111  //-------------------------------------------------------------------------------------------------
112  static PyMemberDef PyAutoInterval_members[];
113  static PyMethodDef PyAutoInterval_methods[];
114  static PyTypeObject PyAutoIntervalType;
115  static PyModuleDef PyAutoIntervalModule;
116 
117  //-------------------------------------------------------------------------------------------------
118  // helper methods
119  //-------------------------------------------------------------------------------------------------
120 
121  //-------------------------------------------------------------------------------------------------
122  // static type methods
123  //-------------------------------------------------------------------------------------------------
124 
125 
126 };
127 
128 } //end namespace ito
129 
130 #endif
Definition: apiFunctionsGraph.cpp:39
Definition: pythonAutoInterval.h:49
Definition: pythonAutoInterval.h:57
class for a interval type containing a min-max-range and an auto-flag.
Definition: interval.h:49