VTK
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
vtkDataArrayTemplate< T > Class Template Reference

Implementation template for vtkDataArray. More...

#include <vtkDataArrayTemplate.h>

Inheritance diagram for vtkDataArrayTemplate< T >:
Inheritance graph
[legend]
Collaboration diagram for vtkDataArrayTemplate< T >:
Collaboration graph
[legend]

List of all members.

Public Types

enum  DeleteMethod { VTK_DATA_ARRAY_FREE, VTK_DATA_ARRAY_DELETE }
typedef vtkDataArray Superclass

Public Member Functions

void PrintSelf (ostream &os, vtkIndent indent)
int Allocate (vtkIdType sz, vtkIdType ext=1000)
void Initialize ()
int GetDataTypeSize ()
void SetNumberOfTuples (vtkIdType number)
virtual void SetTuple (vtkIdType i, vtkIdType j, vtkAbstractArray *source)
virtual void InsertTuple (vtkIdType i, vtkIdType j, vtkAbstractArray *source)
virtual vtkIdType InsertNextTuple (vtkIdType j, vtkAbstractArray *source)
doubleGetTuple (vtkIdType i)
void Squeeze ()
vtkIdType Capacity ()
virtual int Resize (vtkIdType numTuples)
GetValue (vtkIdType id)
void SetNumberOfValues (vtkIdType number)
void InsertValue (vtkIdType id, T f)
void SetVariantValue (vtkIdType id, vtkVariant value)
vtkIdType InsertNextValue (T f)
double GetComponent (vtkIdType i, int j)
void SetComponent (vtkIdType i, int j, double c)
virtual void InsertComponent (vtkIdType i, int j, double c)
virtual void ExportToVoidPointer (void *out_ptr)
virtual vtkArrayIteratorNewIterator ()
virtual void DataChanged ()
virtual void DataElementChanged (vtkIdType id)
virtual void ClearLookup ()
void GetTuple (vtkIdType i, double *tuple)
void GetTupleValue (vtkIdType i, T *tuple)
void SetTuple (vtkIdType i, const float *tuple)
void SetTuple (vtkIdType i, const double *tuple)
void SetTupleValue (vtkIdType i, const T *tuple)
void InsertTuple (vtkIdType i, const float *tuple)
void InsertTuple (vtkIdType i, const double *tuple)
void InsertTupleValue (vtkIdType i, const T *tuple)
vtkIdType InsertNextTuple (const float *tuple)
vtkIdType InsertNextTuple (const double *tuple)
vtkIdType InsertNextTupleValue (const T *tuple)
void GetValueRange (T range[2], int comp)
T * GetValueRange (int comp)
void SetValue (vtkIdType id, T value)
virtual void RemoveTuple (vtkIdType id)
virtual void RemoveFirstTuple ()
virtual void RemoveLastTuple ()
T * WritePointer (vtkIdType id, vtkIdType number)
virtual void * WriteVoidPointer (vtkIdType id, vtkIdType number)
T * GetPointer (vtkIdType id)
virtual void * GetVoidPointer (vtkIdType id)
void DeepCopy (vtkDataArray *da)
void DeepCopy (vtkAbstractArray *aa)
void SetArray (T *array, vtkIdType size, int save, int deleteMethod)
void SetArray (T *array, vtkIdType size, int save)
virtual void SetVoidArray (void *array, vtkIdType size, int save)
virtual void SetVoidArray (void *array, vtkIdType size, int save, int deleteMethod)
virtual vtkIdType LookupValue (vtkVariant value)
virtual void LookupValue (vtkVariant value, vtkIdList *ids)
vtkIdType LookupValue (T value)
void LookupValue (T value, vtkIdList *ids)

Protected Member Functions

 vtkDataArrayTemplate (vtkIdType numComp)
 ~vtkDataArrayTemplate ()
T * ResizeAndExtend (vtkIdType sz)
T * Realloc (vtkIdType sz)
virtual void ComputeScalarRange (double range[2], int comp)
virtual void ComputeVectorRange (double range[2])

Protected Attributes

T * Array
ValueRange [2]
int TupleSize
doubleTuple
int SaveUserArray
int DeleteMethod

Detailed Description

template<class T>
class vtkDataArrayTemplate< T >

Implementation template for vtkDataArray.

There is a vtkDataArray subclass for each native type supported by VTK. This template is used to implement all the subclasses in the same way while avoiding code duplication.

Definition at line 33 of file vtkDataArrayTemplate.h.


Member Typedef Documentation

template<class T >
typedef vtkDataArray vtkDataArrayTemplate< T >::Superclass

Reimplemented from vtkDataArray.

Definition at line 36 of file vtkDataArrayTemplate.h.


Member Enumeration Documentation

template<class T >
enum vtkDataArrayTemplate::DeleteMethod
Enumerator:
VTK_DATA_ARRAY_FREE 
VTK_DATA_ARRAY_DELETE 

Definition at line 205 of file vtkDataArrayTemplate.h.


Constructor & Destructor Documentation

template<class T >
vtkDataArrayTemplate< T >::vtkDataArrayTemplate ( vtkIdType  numComp) [protected]
template<class T >
vtkDataArrayTemplate< T >::~vtkDataArrayTemplate ( ) [protected]

Member Function Documentation

template<class T >
void vtkDataArrayTemplate< T >::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkDataArray.

template<class T >
int vtkDataArrayTemplate< T >::Allocate ( vtkIdType  sz,
vtkIdType  ext = 1000 
) [virtual]

Allocate memory for this array. Delete old storage only if necessary. Note that ext is no longer used.

Implements vtkAbstractArray.

template<class T >
void vtkDataArrayTemplate< T >::Initialize ( ) [virtual]

Release storage and reset array to initial state.

Implements vtkAbstractArray.

template<class T >
int vtkDataArrayTemplate< T >::GetDataTypeSize ( ) [inline, virtual]

Return the size of the data type.

Implements vtkAbstractArray.

Definition at line 47 of file vtkDataArrayTemplate.h.

template<class T >
void vtkDataArrayTemplate< T >::SetNumberOfTuples ( vtkIdType  number) [virtual]

Set the number of n-tuples in the array.

Implements vtkAbstractArray.

template<class T >
virtual void vtkDataArrayTemplate< T >::SetTuple ( vtkIdType  i,
vtkIdType  j,
vtkAbstractArray source 
) [virtual]

Set the tuple at the ith location using the jth tuple in the source array. This method assumes that the two arrays have the same type and structure. Note that range checking and memory allocation is not performed; use in conjunction with SetNumberOfTuples() to allocate space.

Implements vtkDataArray.

template<class T >
virtual void vtkDataArrayTemplate< T >::InsertTuple ( vtkIdType  i,
vtkIdType  j,
vtkAbstractArray source 
) [virtual]

Insert the jth tuple in the source array, at ith location in this array. Note that memory allocation is performed as necessary to hold the data.

Implements vtkDataArray.

template<class T >
virtual vtkIdType vtkDataArrayTemplate< T >::InsertNextTuple ( vtkIdType  j,
vtkAbstractArray source 
) [virtual]

Insert the jth tuple in the source array, at the end in this array. Note that memory allocation is performed as necessary to hold the data. Returns the location at which the data was inserted.

Implements vtkDataArray.

template<class T >
double* vtkDataArrayTemplate< T >::GetTuple ( vtkIdType  i) [virtual]

Get a pointer to a tuple at the ith location. This is a dangerous method (it is not thread safe since a pointer is returned).

Implements vtkDataArray.

template<class T >
void vtkDataArrayTemplate< T >::GetTuple ( vtkIdType  i,
double tuple 
) [virtual]

Copy the tuple value into a user-provided array.

Implements vtkDataArray.

template<class T >
void vtkDataArrayTemplate< T >::GetTupleValue ( vtkIdType  i,
T *  tuple 
)

Copy the tuple value into a user-provided array.

template<class T >
void vtkDataArrayTemplate< T >::SetTuple ( vtkIdType  i,
const float tuple 
) [virtual]

Set the tuple value at the ith location in the array.

Implements vtkDataArray.

template<class T >
void vtkDataArrayTemplate< T >::SetTuple ( vtkIdType  i,
const double tuple 
) [virtual]

Set the tuple value at the ith location in the array.

Implements vtkDataArray.

template<class T >
void vtkDataArrayTemplate< T >::SetTupleValue ( vtkIdType  i,
const T *  tuple 
)

Set the tuple value at the ith location in the array.

template<class T >
void vtkDataArrayTemplate< T >::InsertTuple ( vtkIdType  i,
const float tuple 
) [virtual]

Insert (memory allocation performed) the tuple into the ith location in the array.

Implements vtkDataArray.

template<class T >
void vtkDataArrayTemplate< T >::InsertTuple ( vtkIdType  i,
const double tuple 
) [virtual]

Insert (memory allocation performed) the tuple into the ith location in the array.

Implements vtkDataArray.

template<class T >
void vtkDataArrayTemplate< T >::InsertTupleValue ( vtkIdType  i,
const T *  tuple 
)

Insert (memory allocation performed) the tuple into the ith location in the array.

template<class T >
vtkIdType vtkDataArrayTemplate< T >::InsertNextTuple ( const float tuple) [virtual]

Insert (memory allocation performed) the tuple onto the end of the array.

Implements vtkDataArray.

template<class T >
vtkIdType vtkDataArrayTemplate< T >::InsertNextTuple ( const double tuple) [virtual]

Insert (memory allocation performed) the tuple onto the end of the array.

Implements vtkDataArray.

template<class T >
vtkIdType vtkDataArrayTemplate< T >::InsertNextTupleValue ( const T *  tuple)

Insert (memory allocation performed) the tuple onto the end of the array.

template<class T >
void vtkDataArrayTemplate< T >::GetValueRange ( range[2],
int  comp 
) [inline]

Get the range of array values for the given component in the native data type.

Definition at line 105 of file vtkDataArrayTemplate.h.

template<class T >
T* vtkDataArrayTemplate< T >::GetValueRange ( int  comp) [inline]

Get the range of array values for the given component in the native data type.

Definition at line 112 of file vtkDataArrayTemplate.h.

template<class T >
void vtkDataArrayTemplate< T >::Squeeze ( ) [inline, virtual]

Resize object to just fit data requirement. Reclaims extra memory.

Implements vtkAbstractArray.

Definition at line 120 of file vtkDataArrayTemplate.h.

template<class T >
vtkIdType vtkDataArrayTemplate< T >::Capacity ( ) [inline]

Return the capacity in typeof T units of the current array.

Definition at line 123 of file vtkDataArrayTemplate.h.

template<class T >
virtual int vtkDataArrayTemplate< T >::Resize ( vtkIdType  numTuples) [virtual]

Resize the array while conserving the data. Caution: No assumption can be made on the resulting size of the DataArray, meaning that the provided argument won't necessary be equal to the data array size, but at least the size will be bigger.

Implements vtkAbstractArray.

template<class T >
T vtkDataArrayTemplate< T >::GetValue ( vtkIdType  id) [inline]

Get the data at a particular index.

Definition at line 132 of file vtkDataArrayTemplate.h.

template<class T >
void vtkDataArrayTemplate< T >::SetValue ( vtkIdType  id,
value 
) [inline]

Set the data at a particular index. Does not do range checking. Make sure you use the method SetNumberOfValues() before inserting data.

Definition at line 137 of file vtkDataArrayTemplate.h.

template<class T >
void vtkDataArrayTemplate< T >::SetNumberOfValues ( vtkIdType  number)

Specify the number of values for this object to hold. Does an allocation as well as setting the MaxId ivar. Used in conjunction with SetValue() method for fast insertion.

template<class T >
void vtkDataArrayTemplate< T >::InsertValue ( vtkIdType  id,
f 
)

Insert data at a specified position in the array.

template<class T >
void vtkDataArrayTemplate< T >::SetVariantValue ( vtkIdType  id,
vtkVariant  value 
) [virtual]

Set a value in the array from a vtkVariant.

Implements vtkAbstractArray.

template<class T >
vtkIdType vtkDataArrayTemplate< T >::InsertNextValue ( f)

Insert data at the end of the array. Return its location in the array.

template<class T >
virtual void vtkDataArrayTemplate< T >::RemoveTuple ( vtkIdType  id) [virtual]

These methods remove tuples from the data array. They shift data and resize array, so the data array is still valid after this operation. Note, this operation is fairly slow.

Implements vtkDataArray.

template<class T >
virtual void vtkDataArrayTemplate< T >::RemoveFirstTuple ( ) [virtual]

These methods remove tuples from the data array. They shift data and resize array, so the data array is still valid after this operation. Note, this operation is fairly slow.

Implements vtkDataArray.

template<class T >
virtual void vtkDataArrayTemplate< T >::RemoveLastTuple ( ) [virtual]

These methods remove tuples from the data array. They shift data and resize array, so the data array is still valid after this operation. Note, this operation is fairly slow.

Implements vtkDataArray.

template<class T >
double vtkDataArrayTemplate< T >::GetComponent ( vtkIdType  i,
int  j 
) [virtual]

Return the data component at the ith tuple and jth component location. Note that i is less then NumberOfTuples and j is less then NumberOfComponents.

Reimplemented from vtkDataArray.

template<class T >
void vtkDataArrayTemplate< T >::SetComponent ( vtkIdType  i,
int  j,
double  c 
) [virtual]

Set the data component at the ith tuple and jth component location. Note that i is less then NumberOfTuples and j is less then NumberOfComponents. Make sure enough memory has been allocated (use SetNumberOfTuples() and SetNumberOfComponents()).

Reimplemented from vtkDataArray.

template<class T >
virtual void vtkDataArrayTemplate< T >::InsertComponent ( vtkIdType  i,
int  j,
double  c 
) [virtual]

Insert the data component at ith tuple and jth component location. Note that memory allocation is performed as necessary to hold the data.

Reimplemented from vtkDataArray.

template<class T >
T* vtkDataArrayTemplate< T >::WritePointer ( vtkIdType  id,
vtkIdType  number 
)

Get the address of a particular data index. Make sure data is allocated for the number of items requested. Set MaxId according to the number of data values requested.

template<class T >
virtual void* vtkDataArrayTemplate< T >::WriteVoidPointer ( vtkIdType  id,
vtkIdType  number 
) [inline, virtual]

Get the address of a particular data index. Make sure data is allocated for the number of items requested. Set MaxId according to the number of data values requested.

Implements vtkDataArray.

Definition at line 186 of file vtkDataArrayTemplate.h.

template<class T >
T* vtkDataArrayTemplate< T >::GetPointer ( vtkIdType  id) [inline]

Get the address of a particular data index. Performs no checks to verify that the memory has been allocated etc.

Definition at line 193 of file vtkDataArrayTemplate.h.

template<class T >
virtual void* vtkDataArrayTemplate< T >::GetVoidPointer ( vtkIdType  id) [inline, virtual]

Get the address of a particular data index. Performs no checks to verify that the memory has been allocated etc.

Implements vtkAbstractArray.

Definition at line 194 of file vtkDataArrayTemplate.h.

template<class T >
void vtkDataArrayTemplate< T >::DeepCopy ( vtkDataArray da) [virtual]

Deep copy of another double array.

Reimplemented from vtkDataArray.

template<class T >
void vtkDataArrayTemplate< T >::DeepCopy ( vtkAbstractArray aa) [inline, virtual]

Deep copy of another double array.

Reimplemented from vtkDataArray.

Definition at line 200 of file vtkDataArrayTemplate.h.

template<class T >
void vtkDataArrayTemplate< T >::SetArray ( T *  array,
vtkIdType  size,
int  save,
int  deleteMethod 
)

This method lets the user specify data to be held by the array. The array argument is a pointer to the data. size is the size of the array supplied by the user. Set save to 1 to keep the class from deleting the array when it cleans up or reallocates memory. The class uses the actual array provided; it does not copy the data from the suppled array. If specified, the delete method determines how the data array will be deallocated. If the delete method is VTK_DATA_ARRAY_FREE, free() will be used. If the delete method is DELETE, delete[] will be used. The default is FREE.

template<class T >
void vtkDataArrayTemplate< T >::SetArray ( T *  array,
vtkIdType  size,
int  save 
) [inline]

This method lets the user specify data to be held by the array. The array argument is a pointer to the data. size is the size of the array supplied by the user. Set save to 1 to keep the class from deleting the array when it cleans up or reallocates memory. The class uses the actual array provided; it does not copy the data from the suppled array. If specified, the delete method determines how the data array will be deallocated. If the delete method is VTK_DATA_ARRAY_FREE, free() will be used. If the delete method is DELETE, delete[] will be used. The default is FREE.

Definition at line 223 of file vtkDataArrayTemplate.h.

template<class T >
virtual void vtkDataArrayTemplate< T >::SetVoidArray ( void *  array,
vtkIdType  size,
int  save 
) [inline, virtual]

This method lets the user specify data to be held by the array. The array argument is a pointer to the data. size is the size of the array supplied by the user. Set save to 1 to keep the class from deleting the array when it cleans up or reallocates memory. The class uses the actual array provided; it does not copy the data from the suppled array. If specified, the delete method determines how the data array will be deallocated. If the delete method is VTK_DATA_ARRAY_FREE, free() will be used. If the delete method is DELETE, delete[] will be used. The default is FREE.

Definition at line 225 of file vtkDataArrayTemplate.h.

template<class T >
virtual void vtkDataArrayTemplate< T >::SetVoidArray ( void *  array,
vtkIdType  size,
int  save,
int  deleteMethod 
) [inline, virtual]

This method lets the user specify data to be held by the array. The array argument is a pointer to the data. size is the size of the array supplied by the user. Set save to 1 to keep the class from deleting the array when it cleans up or reallocates memory. The class uses the actual array provided; it does not copy the data from the suppled array. If specified, the delete method determines how the data array will be deallocated. If the delete method is VTK_DATA_ARRAY_FREE, free() will be used. If the delete method is DELETE, delete[] will be used. The default is FREE.

Definition at line 227 of file vtkDataArrayTemplate.h.

template<class T >
virtual void vtkDataArrayTemplate< T >::ExportToVoidPointer ( void *  out_ptr) [virtual]

This method copies the array data to the void pointer specified by the user. It is up to the user to allocate enough memory for the void pointer.

template<class T >
virtual vtkArrayIterator* vtkDataArrayTemplate< T >::NewIterator ( ) [virtual]

Returns a vtkArrayIteratorTemplate<T>.

Implements vtkAbstractArray.

template<class T >
virtual vtkIdType vtkDataArrayTemplate< T >::LookupValue ( vtkVariant  value) [virtual]

Return the indices where a specific value appears.

Implements vtkAbstractArray.

template<class T >
virtual void vtkDataArrayTemplate< T >::LookupValue ( vtkVariant  value,
vtkIdList ids 
) [virtual]

Return the indices where a specific value appears.

Implements vtkAbstractArray.

template<class T >
vtkIdType vtkDataArrayTemplate< T >::LookupValue ( value)

Return the indices where a specific value appears.

template<class T >
void vtkDataArrayTemplate< T >::LookupValue ( value,
vtkIdList ids 
)

Return the indices where a specific value appears.

template<class T >
virtual void vtkDataArrayTemplate< T >::DataChanged ( ) [virtual]

Tell the array explicitly that the data has changed. This is only necessary to call when you modify the array contents without using the array's API (i.e. you retrieve a pointer to the data and modify the array contents). You need to call this so that the fast lookup will know to rebuild itself. Otherwise, the lookup functions will give incorrect results.

Implements vtkAbstractArray.

template<class T >
virtual void vtkDataArrayTemplate< T >::DataElementChanged ( vtkIdType  id) [virtual]

Tell the array explicitly that a single data element has changed. Like DataChanged(), then is only necessary when you modify the array contents without using the array's API.

template<class T >
virtual void vtkDataArrayTemplate< T >::ClearLookup ( ) [virtual]

Delete the associated fast lookup data structure on this array, if it exists. The lookup will be rebuilt on the next call to a lookup function.

Implements vtkAbstractArray.

template<class T >
T* vtkDataArrayTemplate< T >::ResizeAndExtend ( vtkIdType  sz) [protected]
template<class T >
T* vtkDataArrayTemplate< T >::Realloc ( vtkIdType  sz) [protected]
template<class T >
virtual void vtkDataArrayTemplate< T >::ComputeScalarRange ( double  range[2],
int  comp 
) [protected, virtual]

Slow range computation methods. Reimplement.

Reimplemented from vtkDataArray.

template<class T >
virtual void vtkDataArrayTemplate< T >::ComputeVectorRange ( double  range[2]) [protected, virtual]

Slow range computation methods. Reimplement.

Reimplemented from vtkDataArray.


Member Data Documentation

template<class T >
T* vtkDataArrayTemplate< T >::Array [protected]

Definition at line 274 of file vtkDataArrayTemplate.h.

template<class T >
T vtkDataArrayTemplate< T >::ValueRange[2] [protected]

Definition at line 275 of file vtkDataArrayTemplate.h.

template<class T >
int vtkDataArrayTemplate< T >::TupleSize [protected]

Definition at line 279 of file vtkDataArrayTemplate.h.

template<class T >
double* vtkDataArrayTemplate< T >::Tuple [protected]

Definition at line 280 of file vtkDataArrayTemplate.h.

template<class T >
int vtkDataArrayTemplate< T >::SaveUserArray [protected]

Definition at line 282 of file vtkDataArrayTemplate.h.

template<class T >
int vtkDataArrayTemplate< T >::DeleteMethod [protected]

Definition at line 283 of file vtkDataArrayTemplate.h.


The documentation for this class was generated from the following file: