sbknumpycheck.h 871 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (C) 2021 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
  3. #ifndef SBKNUMPYCHECK_H
  4. #define SBKNUMPYCHECK_H
  5. #include <sbkpython.h>
  6. #include <shibokenmacros.h>
  7. // This header provides a PyArray_Check() definition that can be used to avoid
  8. // having to include the numpy headers. When using numpy headers, make sure
  9. // to include this header after them to skip the definition. Also remember
  10. // that import_array() must then be called to initialize numpy.
  11. namespace Shiboken::Numpy
  12. {
  13. /// Check whether the object is a PyArrayObject
  14. /// \param pyIn object
  15. /// \return Whether it is a PyArrayObject
  16. LIBSHIBOKEN_API bool check(PyObject *pyIn);
  17. } //namespace Shiboken::Numpy
  18. #ifndef PyArray_Check
  19. # define PyArray_Check(op) Shiboken::Numpy::check(op)
  20. #endif
  21. #endif // SBKNUMPYCHECK_H