aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/pyside_numpy.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-05-09 16:05:57 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-05-13 10:57:49 +0200
commit7f43e62608541f797cfefc036d913eb4e246e1b8 (patch)
tree6865c12d1a80b037e20139a0b742135b16f4965c /sources/pyside6/libpyside/pyside_numpy.h
parent9ba60057a22693242dab3b3edc6ba1240561e6da (diff)
Move numpyview from libpyside into libshiboken
libpyside then no longer depends on numpy. There is only one place left where numpy is initialized, allowing for dynamic loading. Task-number: PYSIDE-1924 Change-Id: I50d02814f8cc6eb85d8cdb5330cfff3b586656ad Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/pyside_numpy.h')
-rw-r--r--sources/pyside6/libpyside/pyside_numpy.h52
1 files changed, 1 insertions, 51 deletions
diff --git a/sources/pyside6/libpyside/pyside_numpy.h b/sources/pyside6/libpyside/pyside_numpy.h
index b012fa5f7..b62816784 100644
--- a/sources/pyside6/libpyside/pyside_numpy.h
+++ b/sources/pyside6/libpyside/pyside_numpy.h
@@ -41,6 +41,7 @@
#define PYSIDE_NUMPY_H
#include <sbkpython.h>
+#include <sbknumpycheck.h>
#include <pysidemacros.h>
@@ -48,46 +49,9 @@
#include <QtCore/QPoint>
#include <QtCore/QPointF>
-QT_FORWARD_DECLARE_CLASS(QDebug)
-
-// This header provides a PyArray_Check() definition that can be used to avoid
-// having to include the numpy headers. When using numpy headers, make sure
-// to include this header after them to skip the definition. Also remember
-// that import_array() must then be called to initialize numpy.
-
namespace PySide::Numpy
{
-bool init();
-
-/// Check whether the object is a PyArrayObject
-/// \param pyIn object
-/// \return Whether it is a PyArrayObject
-PYSIDE_API bool check(PyObject *pyIn);
-
-/// A simple view of an up to 2 dimensional, C-contiguous array of a standard
-/// type. It can be passed to compilation units that do not include the
-/// numpy headers.
-struct PYSIDE_API View
-{
- enum Type { Int, Unsigned, Float, Double};
-
- static View fromPyObject(PyObject *pyIn);
-
- operator bool() const { return ndim > 0; }
-
- /// Return whether rhs is of the same type and dimensionality
- bool sameLayout(const View &rhs) const;
- /// Return whether rhs is of the same type dimensionality and size
- bool sameSize(const View &rhs) const;
-
- int ndim = 0;
- qsizetype dimensions[2];
- qsizetype stride[2];
- void *data = nullptr;
- Type type = Int;
-};
-
/// Create a list of QPointF from 2 equally sized numpy array of x and y data
/// (float,double).
/// \param pyXIn X data array
@@ -104,20 +68,6 @@ PYSIDE_API QList<QPointF> xyDataToQPointFList(PyObject *pyXIn, PyObject *pyYIn);
PYSIDE_API QList<QPoint> xyDataToQPointList(PyObject *pyXIn, PyObject *pyYIn);
-struct debugPyArrayObject
-{
- explicit debugPyArrayObject(PyObject *object) : m_object(object) {}
-
- PyObject *m_object;
-};
-
-PYSIDE_API QDebug operator<<(QDebug debug, const debugPyArrayObject &a);
-PYSIDE_API QDebug operator<<(QDebug debug, const View &v);
-
} //namespace PySide::Numpy
-#ifndef PyArray_Check
-# define PyArray_Check(op) PySide::Numpy::check(op)
-#endif
-
#endif // PYSIDE_NUMPY_H