diff options
Diffstat (limited to 'sources/pyside6/libpyside/pyside_numpy.h')
| -rw-r--r-- | sources/pyside6/libpyside/pyside_numpy.h | 52 |
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 |
