VTK
Classes | 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

#define vtkArrayDownCast_FastCastMacro (   ArrayT)
Value:
template <> struct vtkArrayDownCast_impl<ArrayT> \
{ \
inline ArrayT* operator()(vtkAbstractArray *array) \
{ \
return ArrayT::FastDownCast(array); \
} \
};
Abstract superclass for all arrays.
Implementation of vtkArrayDownCast.
ArrayT * operator()(vtkAbstractArray *array)

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

Definition at line 718 of file vtkAbstractArray.h.

#define vtkArrayDownCast_TemplateFastCastMacro (   ArrayT)
Value:
template <typename ValueT> struct vtkArrayDownCast_impl<ArrayT<ValueT> > \
{ \
inline ArrayT<ValueT>* operator()(vtkAbstractArray *array) \
{ \
return ArrayT<ValueT>::FastDownCast(array); \
} \
};
Abstract superclass for all arrays.
Implementation of vtkArrayDownCast.
ArrayT * operator()(vtkAbstractArray *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 735 of file vtkAbstractArray.h.

Function Documentation

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 706 of file vtkAbstractArray.h.