Commit a1a94d0c authored by David Gobbi's avatar David Gobbi Committed by Kitware Robot
Browse files

Merge topic 'extern-template'

e7b9d312 Add extern template decls for vtkArrayIterator
31a63a45 Simplify extern template declarations for arrays
ff7ce07d Simplify extern template declaration
be8d2a8e

 Simplify template macros in vtkPythonArgs
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Brad King's avatarBrad King <brad.king@kitware.com>
Merge-request: !1904
parents 7a18dbd8 e7b9d312
Pipeline #25869 failed with stage
in 0 seconds
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned char);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(unsigned char);
#include "vtkUnsignedCharArray.h"
#include "vtkObjectFactory.h"
......
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned int);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(unsigned int);
#include "vtkUnsignedIntArray.h"
#include "vtkObjectFactory.h"
......
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned long);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(unsigned long);
#include "vtkUnsignedLongArray.h"
#include "vtkObjectFactory.h"
......
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned long long);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(unsigned long long);
#include "vtkUnsignedLongLongArray.h"
#include "vtkObjectFactory.h"
......
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned short);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(unsigned short);
#include "vtkUnsignedShortArray.h"
#include "vtkObjectFactory.h"
......
......@@ -26,15 +26,14 @@
#include "vtkVariantArray.h"
#include "vtkArrayIteratorTemplate.h"
#include "vtkDataArray.h"
#include "vtkIdList.h"
#include "vtkObjectFactory.h"
#include "vtkSortDataArray.h"
#include "vtkStringArray.h"
#include "vtkVariant.h"
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(vtkVariant);
#include <utility>
#include <algorithm>
#include <map>
......
......@@ -13,18 +13,10 @@
=========================================================================*/
#define vtkImageIterator_cxx
#include "vtkImageIterator.txx"
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<signed char>;
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<char>;
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<int>;
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<long>;
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<long long>;
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<short>;
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<float>;
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<double>;
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<unsigned long>;
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<unsigned long long>;
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<unsigned short>;
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<unsigned char>;
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator<unsigned int>;
vtkInstantiateTemplateMacro(
template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator
)
......@@ -80,5 +80,11 @@ protected:
vtkIdType ContinuousIncrements[3];
};
#ifndef vtkImageIterator_cxx
vtkExternTemplateMacro(
extern template class VTKCOMMONDATAMODEL_EXPORT vtkImageIterator
)
#endif
#endif
// VTK-HeaderTest-Exclude: vtkImageIterator.h
......@@ -13,33 +13,10 @@
=========================================================================*/
#include "vtkConfigure.h"
#if defined(_MSC_VER) && !defined(VTK_DISPLAY_WIN32_WARNINGS)
#pragma warning ( disable : 4275 )
#endif
// Do not include vtkImageIterator.txx here - will cause implicit template
// instantiation, breaking symbol visibility for the iterator with GCC.
// Silencing the MSVC warning after discussions about the fact that the explicit
// instantiation of the this class tries to implicitly instantiate the member
// class. This is not an error, and the symbols should be found at link time.
#if defined(_MSC_VER)
# pragma warning (disable:4661)
#endif
#define vtkImageProgressIterator_cxx
#include "vtkImageProgressIterator.txx"
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<signed char>;
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<char>;
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<int>;
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<long>;
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<long long>;
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<short>;
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<float>;
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<double>;
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<unsigned long>;
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<unsigned long long>;
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<unsigned short>;
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<unsigned char>;
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator<unsigned int>;
vtkInstantiateTemplateMacro(
template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator
)
......@@ -58,5 +58,11 @@ protected:
int ID;
};
#ifndef vtkImageProgressIterator_cxx
vtkExternTemplateMacro(
extern template class VTKCOMMONEXECUTIONMODEL_EXPORT vtkImageProgressIterator
)
#endif
#endif
// VTK-HeaderTest-Exclude: vtkImageProgressIterator.h
......@@ -13,22 +13,10 @@
=========================================================================*/
#include "vtkImageStencilIterator.h"
#ifndef VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION
#define vtkImageStencilIterator_cxx
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<signed char>;
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<char>;
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<int>;
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<long>;
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<short>;
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<float>;
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<double>;
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<unsigned long>;
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<unsigned short>;
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<unsigned char>;
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<unsigned int>;
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<long long>;
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator<unsigned long long>;
#include "vtkImageStencilIterator.h"
#endif
vtkInstantiateTemplateMacro(
template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator
)
......@@ -125,5 +125,20 @@ protected:
DType *SpanEndPointer; // end of current span
};
#ifndef vtkImageStencilIterator_cxx
#ifdef _MSC_VER
#pragma warning (push)
// The following is needed when the vtkImageStencilIterator template
// class is declared dllexport and is used within vtkImagingCore
#pragma warning (disable: 4910) // extern and dllexport incompatible
#endif
vtkExternTemplateMacro(
extern template class VTKIMAGINGCORE_EXPORT vtkImageStencilIterator
)
#ifdef _MSC_VER
#pragma warning (pop)
#endif
#endif
#endif
// VTK-HeaderTest-Exclude: vtkImageStencilIterator.h
......@@ -22,7 +22,7 @@ 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
#define vtkPythonArgs_cxx
#include "vtkPythonArgs.h"
#include "vtkPythonUtil.h"
......@@ -1380,10 +1380,6 @@ vtkPythonArgs::Array<T>::Array(Py_ssize_t n) : Pointer(0)
}
// Instantiate the Array class template over all types:
#define vtkForPythonArrayTypeMacro(type) \
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array<type>;
vtkExpandForPythonArrayTypesMacro()
#undef vtkForPythonArrayTypeMacro
vtkPythonArgsTemplateMacro(
template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array
)
......@@ -807,32 +807,27 @@ PyObject *vtkPythonArgs::BuildBytes(const char *a, int 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)
#define vtkPythonArgsTemplateMacro(decl) \
decl<bool>; \
decl<float>; \
decl<double>; \
decl<char>; \
decl<signed char>; \
decl<unsigned char>; \
decl<short>; \
decl<unsigned short>; \
decl<int>; \
decl<unsigned int>; \
decl<long>; \
decl<unsigned long>; \
decl<long long>; \
decl<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
#if defined(VTK_USE_EXTERN_TEMPLATE) && !defined(vtkPythonArgs_cxx)
vtkPythonArgsTemplateMacro(
extern template class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs::Array
)
#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