Commit e7b9d312 authored by David Gobbi's avatar David Gobbi

Add extern template decls for vtkArrayIterator

The template instantiations were moved out of the array classes and into
their own source file, rather than adding the extern template declarations
into the header file of each array class.  This was done to avoid repeating
the same code block across many header files.
parent 31a63a45
Pipeline #25788 passed with stage
......@@ -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
)
......
......@@ -274,7 +274,7 @@ vtkArrayDownCast_TemplateFastCastMacro(vtkAOSDataArrayTemplate)
#pragma warning (disable: 4910) // extern and dllexport incompatible
#endif
vtkExternTemplateMacro(
extern template class VTKCOMMONCORE_EXTERN vtkAOSDataArrayTemplate)
extern template class VTKCOMMONCORE_EXPORT vtkAOSDataArrayTemplate)
#ifdef _MSC_VER
#pragma warning (pop)
#endif
......
......@@ -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"
......
......@@ -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"
......
......@@ -230,7 +230,7 @@ vtkArrayDownCast_TemplateFastCastMacro(vtkSOADataArrayTemplate)
#pragma warning (disable: 4910) // extern and dllexport incompatible
#endif
vtkExternTemplateMacro(
extern template class VTKCOMMONCORE_EXTERN vtkSOADataArrayTemplate)
extern template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate)
#ifdef _MSC_VER
#pragma warning (pop)
#endif
......
......@@ -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
......@@ -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>
......
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