Commit 3edd29cc authored by David Gobbi's avatar David Gobbi Committed by Kitware Robot

Merge topic 'python-args-array-extern'

f20040e0 Add VTK_USE_EXTERN_TEMPLATE in vtkConfigure.h
4ef267b1 Add extern template decls for vtkPythonArgs::Array
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !1840
parents 33975acb f20040e0
Pipeline #24364 running with stage
in 264 minutes and 46 seconds
......@@ -305,7 +305,7 @@ extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned long long);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned short);
#pragma warning (pop)
#elif !defined(__MINGW32__)
#elif defined(VTK_USE_EXTERN_TEMPLATE)
extern template class vtkAOSDataArrayTemplate<char>;
extern template class vtkAOSDataArrayTemplate<double>;
extern template class vtkAOSDataArrayTemplate<float>;
......
......@@ -161,6 +161,12 @@
# define VTK_DELETE_FUNCTION
#endif
/** extern template declarations for C++11
*/
#if __cplusplus >= 201103L && !defined(_MSC_VER) && !defined(__MINGW32__)
#define VTK_USE_EXTERN_TEMPLATE
#endif
/** std::auto_ptr is deprecated in C++11 and will be removed in C++17
* use std::unique_ptr in C++11 and later compilers.
*/
......
......@@ -261,7 +261,7 @@ extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned long long);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned short);
#pragma warning (pop)
#elif !defined(__MINGW32__)
#elif defined(VTK_USE_EXTERN_TEMPLATE)
extern template class vtkSOADataArrayTemplate<char>;
extern template class vtkSOADataArrayTemplate<double>;
extern template class vtkSOADataArrayTemplate<float>;
......
......@@ -21,6 +21,9 @@ more efficient and flexible that the original PyArg_ParseTuple() code,
resulting in wrapper code that is faster and more compact.
-----------------------------------------------------------------------*/
// Keep vtkPythonArgs.h from declaring externs for templates we instantiate
#define VTK_PYTHON_ARGS_CXX
#include "vtkPythonArgs.h"
#include "vtkPythonUtil.h"
......@@ -1376,17 +1379,11 @@ vtkPythonArgs::Array<T>::Array(Py_ssize_t n) : Pointer(0)
}
}
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<bool>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<float>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<double>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<char>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<signed char>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<unsigned char>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<short>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<unsigned short>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<int>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<unsigned int>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<long>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<unsigned long>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<long long>;
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<unsigned long long>;
// Instantiate the Array class template over all types:
#define vtkForPythonArrayTypeMacro(type) \
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<type>;
vtkExpandForPythonArrayTypesMacro()
#undef vtkForPythonArrayTypeMacro
......@@ -805,4 +805,34 @@ PyObject *vtkPythonArgs::BuildBytes(const char *a, int n)
return PyBytes_FromStringAndSize(a, n);
}
// List of all types for the Array class template:
#define vtkExpandForPythonArrayTypesMacro() \
vtkForPythonArrayTypeMacro(bool) \
vtkForPythonArrayTypeMacro(float) \
vtkForPythonArrayTypeMacro(double) \
vtkForPythonArrayTypeMacro(char) \
vtkForPythonArrayTypeMacro(signed char) \
vtkForPythonArrayTypeMacro(unsigned char) \
vtkForPythonArrayTypeMacro(short) \
vtkForPythonArrayTypeMacro(unsigned short) \
vtkForPythonArrayTypeMacro(int) \
vtkForPythonArrayTypeMacro(unsigned int) \
vtkForPythonArrayTypeMacro(long) \
vtkForPythonArrayTypeMacro(unsigned long) \
vtkForPythonArrayTypeMacro(long long) \
vtkForPythonArrayTypeMacro(unsigned long long)
// Forward declare the Array class template over all types:
#if defined(VTK_USE_EXTERN_TEMPLATE) && !defined(VTK_PYTHON_ARGS_CXX)
#define vtkForPythonArrayTypeMacro(type) \
extern template class vtkPythonArgs::Array<type>;
vtkExpandForPythonArrayTypesMacro()
#undef vtkForPythonArrayTypeMacro
#endif
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment