VTK  9.0.20200603
Classes | Macros | Functions
vtkAbstractArray.h File Reference
#include "vtkCommonCoreModule.h"
#include "vtkObject.h"
#include "vtkVariant.h"
Include dependency graph for vtkAbstractArray.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  vtkAbstractArray
 Abstract superclass for all arrays. More...
 
struct  vtkArrayDownCast_impl< ArrayT >
 Implementation of vtkArrayDownCast. More...
 

Macros

#define vtkArrayDownCast_FastCastMacro(ArrayT)
 This macro is used to tell vtkArrayDownCast to use FastDownCast instead of SafeDownCast. More...
 
#define vtkArrayDownCast_TemplateFastCastMacro(ArrayT)
 Same as vtkArrayDownCast_FastCastMacro, but treats ArrayT as a single-parameter template (the parameter is the value type). More...
 

Functions

template<typename ArrayT >
ArrayT * vtkArrayDownCast (vtkAbstractArray *array)
 vtkArrayDownCast is to be used by generic (e.g. More...
 

Macro Definition Documentation

◆ vtkArrayDownCast_FastCastMacro

#define vtkArrayDownCast_FastCastMacro (   ArrayT)
Value:
template <> \
{ \
inline ArrayT* operator()(vtkAbstractArray* array) { return ArrayT::FastDownCast(array); } \
}

This macro is used to tell vtkArrayDownCast to use FastDownCast instead of SafeDownCast.

Definition at line 741 of file vtkAbstractArray.h.

◆ vtkArrayDownCast_TemplateFastCastMacro

#define vtkArrayDownCast_TemplateFastCastMacro (   ArrayT)
Value:
template <typename ValueT> \
{ \
inline ArrayT<ValueT>* operator()(vtkAbstractArray* array) \
{ \
return ArrayT<ValueT>::FastDownCast(array); \
} \
}

Same as vtkArrayDownCast_FastCastMacro, but treats ArrayT as a single-parameter template (the parameter is the value type).

Defines a vtkArrayDownCast implementation that uses the specified array template class with any value type.

Definition at line 756 of file vtkAbstractArray.h.

Function Documentation

◆ vtkArrayDownCast()

template<typename ArrayT >
ArrayT* vtkArrayDownCast ( vtkAbstractArray array)

vtkArrayDownCast is to be used by generic (e.g.

templated) code for quickly downcasting vtkAbstractArray pointers to more derived classes. The typical VTK downcast pattern (SafeDownCast) performs a string comparison on the class names in the object's inheritance hierarchy, which is quite expensive and can dominate computational resource usage when downcasting is needed in a worker function. To address this, certain arrays support a FastDownCast method, which replaces the chain of string comparisons with 1-2 integer comparisons and thus is significantly more efficient. However, not all arrays support the FastDownCast mechanism. vtkArrayDownCast exists to select between the two; Arrays that support FastDownCast will use it, while others will fallback to the slower SafeDownCast.

A more detailed description of this class and related tools can be found here.

Definition at line 729 of file vtkAbstractArray.h.

vtkArrayDownCast_impl
Implementation of vtkArrayDownCast.
Definition: vtkAbstractArray.h:705
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:75