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

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 running with stage
in 686 minutes and 19 seconds
......@@ -156,6 +156,7 @@ SET(Module_SRCS
vtkArrayExtentsList.cxx
vtkArrayIterator.cxx
vtkArrayIteratorTemplate.txx
vtkArrayIteratorTemplateInstantiate.cxx
vtkArrayRange.cxx
vtkArraySort.cxx
vtkArrayWeights.cxx
......@@ -584,6 +585,7 @@ set_source_files_properties(
vtkArrayExtents.cxx
vtkArrayExtentsList.cxx
vtkArrayIteratorTemplate.txx
vtkArrayIteratorTemplateInstantiate.cxx
vtkArrayRange.cxx
vtkArraySort.cxx
vtkArrayWeights.cxx
......@@ -621,7 +623,6 @@ set_source_files_properties(
vtkArrayIteratorIncludes.h
vtkArrayIteratorTemplate.h
vtkArrayIteratorTemplateImplicit.txx
vtkArrayIteratorTemplate.txx
vtkArrayPrint.h
vtkArrayPrint.txx
vtkAtomicTypeConcepts.h
......@@ -670,6 +671,7 @@ set_source_files_properties(
set_source_files_properties(
vtkABI.h
vtkAOSDataArrayTemplate.txx
vtkArrayIteratorTemplateInstantiate.cxx
vtkAtomic.h
vtkAutoInit.h
vtkIOStream.cxx
......@@ -704,6 +706,7 @@ set_source_files_properties(
)
set_source_files_properties(
vtkArrayIteratorTemplateInstantiate.cxx # Has no header
vtkSOADataArrayTemplateInstantiate.cxx # Has no header
PROPERTIES SKIP_HEADER_INSTALL 1
)
......
......@@ -226,9 +226,6 @@ private:
// Declare vtkArrayDownCast implementations for AoS containers:
vtkArrayDownCast_TemplateFastCastMacro(vtkAOSDataArrayTemplate)
# define VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
template class VTKCOMMONCORE_EXPORT vtkAOSDataArrayTemplate< T >
// This macro is used by the subclasses to create dummy
// declarations for these functions such that the wrapper
// can see them. The wrappers ignore vtkAOSDataArrayTemplate.
......@@ -264,9 +261,27 @@ vtkArrayDownCast_TemplateFastCastMacro(vtkAOSDataArrayTemplate)
// libraries other than vtkCommonCore that instantiations of
// vtkAOSDataArrayTemplate can be found externally. This prevents each library
// from instantiating these on their own.
#ifndef VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATING
#if defined(VTK_BUILD_SHARED_LIBS)
#if defined(_MSC_VER)
#ifdef VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATING
#define VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
template class VTKCOMMONCORE_EXPORT vtkAOSDataArrayTemplate< T >
#elif defined(VTK_USE_EXTERN_TEMPLATE)
#ifndef VTK_AOS_DATA_ARRAY_TEMPLATE_EXTERN
#define VTK_AOS_DATA_ARRAY_TEMPLATE_EXTERN
#ifdef _MSC_VER
#pragma warning (push)
// The following is needed when the vtkAOSDataArrayTemplate is declared
// dllexport and is used from another class in vtkCommonCore
#pragma warning (disable: 4910) // extern and dllexport incompatible
#endif
vtkExternTemplateMacro(
extern template class VTKCOMMONCORE_EXPORT vtkAOSDataArrayTemplate)
#ifdef _MSC_VER
#pragma warning (pop)
#endif
#endif // VTK_AOS_DATA_ARRAY_TEMPLATE_EXTERN
// The following clause is only for MSVC 2008 and 2010
#elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
#pragma warning (push)
// C4091: 'extern ' : ignored on left of 'int' when no variable is declared
......@@ -290,37 +305,11 @@ vtkArrayDownCast_TemplateFastCastMacro(vtkAOSDataArrayTemplate)
// Use an "extern explicit instantiation" to give the class a DLL
// interface. This is a compiler-specific extension.
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(char);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(double);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(float);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(int);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(long);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(long long);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(short);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(signed char);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned char);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned int);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned long);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned long long);
extern VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned short);
vtkInstantiateTemplateMacro(
extern template class VTKCOMMONCORE_EXPORT vtkAOSDataArrayTemplate)
#pragma warning (pop)
#elif defined(VTK_USE_EXTERN_TEMPLATE)
extern template class vtkAOSDataArrayTemplate<char>;
extern template class vtkAOSDataArrayTemplate<double>;
extern template class vtkAOSDataArrayTemplate<float>;
extern template class vtkAOSDataArrayTemplate<int>;
extern template class vtkAOSDataArrayTemplate<long>;
extern template class vtkAOSDataArrayTemplate<long long>;
extern template class vtkAOSDataArrayTemplate<short>;
extern template class vtkAOSDataArrayTemplate<signed char>;
extern template class vtkAOSDataArrayTemplate<unsigned char>;
extern template class vtkAOSDataArrayTemplate<unsigned int>;
extern template class vtkAOSDataArrayTemplate<unsigned long>;
extern template class vtkAOSDataArrayTemplate<unsigned long long>;
extern template class vtkAOSDataArrayTemplate<unsigned short>;
#endif // _MSC_VER
#endif // VTK_BUILD_SHARED_LIBS
#endif // VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATING
#endif
// VTK-HeaderTest-Exclude: vtkAOSDataArrayTemplate.h
......@@ -35,9 +35,6 @@
#include "vtkArrayIteratorTemplate.h"
#include "vtkBitArrayIterator.h"
// DataTypes for Iterators.
#include "vtkStdString.h"
#endif
// VTK-HeaderTest-Exclude: vtkArrayIteratorIncludes.h
......@@ -26,6 +26,10 @@
#include "vtkCommonCoreModule.h" // For export macro
#include "vtkArrayIterator.h"
#include "vtkStdString.h" // For template instantiation
#include "vtkUnicodeString.h" // For template instantiation
#include "vtkVariant.h" // For template instantiation
template <class T>
class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate : public vtkArrayIterator
{
......@@ -101,26 +105,28 @@ private:
vtkAbstractArray* Array;
};
#define VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(T) \
template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate< T >
#endif // !defined(vtkArrayIteratorTemplate_h)
// This portion must be OUTSIDE the include blockers. Each
// vtkArrayIteratorTemplate subclass uses this to give its instantiation
// of this template a DLL interface.
#if defined(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE)
# if defined(VTK_BUILD_SHARED_LIBS) && defined(_MSC_VER)
# pragma warning (push)
# pragma warning (disable: 4091) // warning C4091: 'extern ' :
// ignored on left of 'int' when no variable is declared
# pragma warning (disable: 4231) // Compiler-specific extension warning.
// Use an "extern explicit instantiation" to give the class a DLL
// interface. This is a compiler-specific extension.
extern VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(VTK_ARRAY_ITERATOR_TEMPLATE_TYPE);
# pragma warning (pop)
# endif
# undef VTK_ARRAY_ITERATOR_TEMPLATE_TYPE
#ifdef VTK_USE_EXTERN_TEMPLATE
#ifndef vtkArrayIteratorTemplateInstantiate_cxx
#ifdef _MSC_VER
#pragma warning (push)
// The following is needed when the vtkArrayIteratorTemplate is declared
// dllexport and is used from another class in vtkCommonCore
#pragma warning (disable: 4910) // extern and dllexport incompatible
#endif
vtkInstantiateTemplateMacro(
extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
extern template class VTKCOMMONCORE_EXPORT
vtkArrayIteratorTemplate<vtkStdString>;
extern template class VTKCOMMONCORE_EXPORT
vtkArrayIteratorTemplate<vtkUnicodeString>;
extern template class VTKCOMMONCORE_EXPORT
vtkArrayIteratorTemplate<vtkVariant>;
#ifdef _MSC_VER
#pragma warning (pop)
#endif
#endif
#endif // VTK_USE_EXTERN_TEMPLATE
#endif
// VTK-HeaderTest-Exclude: vtkArrayIteratorTemplate.h
/*=========================================================================
Program: Visualization Toolkit
Module: vtkArrayIteratorTemplateInstantiate.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#define vtkArrayIteratorTemplateInstantiate_cxx
#include "vtkArrayIteratorTemplate.txx"
vtkInstantiateTemplateMacro(
template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkStdString>;
template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkUnicodeString>;
template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate<vtkVariant>;
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(char);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(char);
#include "vtkCharArray.h"
#include "vtkObjectFactory.h"
......
......@@ -166,7 +166,7 @@
/** extern template declarations for C++11
*/
#if __cplusplus >= 201103L && !defined(_MSC_VER) && !defined(__MINGW32__)
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700)
#define VTK_USE_EXTERN_TEMPLATE
#endif
......
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(double);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(double);
#include "vtkDoubleArray.h"
#include "vtkObjectFactory.h"
......
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(float);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(float);
#include "vtkFloatArray.h"
#include "vtkObjectFactory.h"
......
......@@ -19,8 +19,6 @@
// #define VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATING
// #include "vtkAOSDataArrayTemplate.txx"
// VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(vtkIdType);
// #include "vtkArrayIteratorTemplate.txx"
// VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(vtkIdType);
#include "vtkIdTypeArray.h"
......
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(int);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(int);
#include "vtkIntArray.h"
#include "vtkObjectFactory.h"
......
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(long);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(long);
#include "vtkLongArray.h"
#include "vtkObjectFactory.h"
......
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(long long);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(long long);
#include "vtkLongLongArray.h"
#include "vtkObjectFactory.h"
......
......@@ -211,18 +211,33 @@ private:
// Declare vtkArrayDownCast implementations for SoA containers:
vtkArrayDownCast_TemplateFastCastMacro(vtkSOADataArrayTemplate)
# define VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate< T >
#endif // header guard
// This portion must be OUTSIDE the include blockers. This is used to tell
// libraries other than vtkCommonCore that instantiations of
// vtkSOADataArrayTemplate can be found externally. This prevents each library
// from instantiating these on their own.
#ifndef VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING
#if defined(VTK_BUILD_SHARED_LIBS)
#if defined(_MSC_VER)
#ifdef VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING
#define VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate< T >
#elif defined(VTK_USE_EXTERN_TEMPLATE)
#ifndef VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
#define VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
#ifdef _MSC_VER
#pragma warning (push)
// The following is needed when the vtkSOADataArrayTemplate is declared
// dllexport and is used from another class in vtkCommonCore
#pragma warning (disable: 4910) // extern and dllexport incompatible
#endif
vtkExternTemplateMacro(
extern template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate)
#ifdef _MSC_VER
#pragma warning (pop)
#endif
#endif // VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
// The following clause is only for MSVC 2008 and 2010
#elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
#pragma warning (push)
// C4091: 'extern ' : ignored on left of 'int' when no variable is declared
......@@ -246,37 +261,11 @@ vtkArrayDownCast_TemplateFastCastMacro(vtkSOADataArrayTemplate)
// Use an "extern explicit instantiation" to give the class a DLL
// interface. This is a compiler-specific extension.
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(char);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(double);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(float);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(int);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(long);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(long long);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(short);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(signed char);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned char);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned int);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned long);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned long long);
extern VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(unsigned short);
vtkInstantiateTemplateMacro(
extern template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate)
#pragma warning (pop)
#elif defined(VTK_USE_EXTERN_TEMPLATE)
extern template class vtkSOADataArrayTemplate<char>;
extern template class vtkSOADataArrayTemplate<double>;
extern template class vtkSOADataArrayTemplate<float>;
extern template class vtkSOADataArrayTemplate<int>;
extern template class vtkSOADataArrayTemplate<long>;
extern template class vtkSOADataArrayTemplate<long long>;
extern template class vtkSOADataArrayTemplate<short>;
extern template class vtkSOADataArrayTemplate<signed char>;
extern template class vtkSOADataArrayTemplate<unsigned char>;
extern template class vtkSOADataArrayTemplate<unsigned int>;
extern template class vtkSOADataArrayTemplate<unsigned long>;
extern template class vtkSOADataArrayTemplate<unsigned long long>;
extern template class vtkSOADataArrayTemplate<unsigned short>;
#endif // _MSC_VER
#endif // VTK_BUILD_SHARED_LIBS
#endif // VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING
#endif
// VTK-HeaderTest-Exclude: vtkSOADataArrayTemplate.h
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(short);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(short);
#include "vtkShortArray.h"
#include "vtkObjectFactory.h"
......
......@@ -17,9 +17,6 @@
#include "vtkAOSDataArrayTemplate.txx"
VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(signed char);
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(signed char);
#include "vtkSignedCharArray.h"
#include "vtkObjectFactory.h"
......
......@@ -13,8 +13,6 @@
=========================================================================*/
// We do not provide a definition for the copy constructor or
// operator=. Block the warning.
#ifdef _MSC_VER
......@@ -23,9 +21,6 @@
#include "vtkStdString.h"
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(vtkStdString);
#include "vtkStringArray.h"
#include "vtkArrayIteratorTemplate.h"
......
......@@ -298,6 +298,4 @@ private:
};
#endif
......@@ -320,5 +320,30 @@ inline vtkTypeBool vtkDataTypesCompare(int a, int b)
}
#endif
/*--------------------------------------------------------------------------*/
/** A macro to instantiate a template over all numerical types */
#define vtkInstantiateTemplateMacro(decl) \
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>;
/** A macro to declare extern templates for all numerical types */
#ifdef VTK_USE_EXTERN_TEMPLATE
#define vtkExternTemplateMacro(decl) \
vtkInstantiateTemplateMacro(decl)
#else
#define vtkExternTemplateMacro(decl)
#endif
#endif
// VTK-HeaderTest-Exclude: vtkType.h
......@@ -15,9 +15,7 @@
#include "vtkUnicodeString.h"
#include "vtkArrayIteratorTemplate.txx"
VTK_ARRAY_ITERATOR_TEMPLATE_INSTANTIATE(vtkUnicodeString);
#include "vtkArrayIteratorTemplate.h"
#include "vtkIdList.h"
#include "vtkObjectFactory.h"
#include "vtkUnicodeStringArray.h"
......
......@@ -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>; \