VTK
vtkMappedDataArray.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMappedDataArray.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 ==============================================================================*/
34 #ifndef vtkMappedDataArray_h
35 #define vtkMappedDataArray_h
36 
37 #include "vtkTypedDataArray.h"
38 
39 #include "vtkTypeTemplate.h" // for vtkTypeTemplate
40 
41 template <class Scalar>
42 class vtkMappedDataArray : public vtkTypeTemplate<vtkMappedDataArray<Scalar>,
43  vtkTypedDataArray<Scalar> >
44 {
45 public:
47  typedef typename Superclass::ValueType ValueType;
48 
56 
57  void PrintSelf(ostream &os, vtkIndent indent);
58 
59  // vtkAbstractArray virtual method that must be reimplemented.
60  void DeepCopy(vtkAbstractArray *aa) = 0;
63  void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output) = 0;
64  void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output) = 0;
65  void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
66  vtkAbstractArray *source, double *weights) = 0;
68  vtkAbstractArray* source1, vtkIdType id2,
69  vtkAbstractArray* source2, double t) = 0;
70 
71  // vtkDataArray virtual method that must be reimplemented.
72  void DeepCopy(vtkDataArray *da) = 0;
73 
77  void * GetVoidPointer(vtkIdType id);
78 
82  void ExportToVoidPointer(void *ptr);
83 
89  void DataChanged();
90 
93  void SetVoidArray(void *, vtkIdType, int);
94 
96 
97  void * WriteVoidPointer(vtkIdType /*id*/, vtkIdType /*number*/)
98  {
99  vtkErrorMacro(<<"WriteVoidPointer: Method not implemented.");
100  return NULL;
101  }
103 
105  void Modified();
106 
107  // vtkAbstractArray override:
108  bool HasStandardMemoryLayout() { return false; }
109 
110 protected:
113 
114  virtual int GetArrayType()
115  {
117  }
118 
119 private:
120  vtkMappedDataArray(const vtkMappedDataArray &); // Not implemented.
121  void operator=(const vtkMappedDataArray &); // Not implemented.
122 
124 
125  ValueType *TemporaryScalarPointer;
126  size_t TemporaryScalarPointerSize;
127 };
129 
130 #include "vtkMappedDataArray.txx"
131 
132 // Adds an implementation of NewInstanceInternal() that returns a standard
133 // (unmapped) VTK array, if possible. Use this with classes that derive from
134 // vtkTypeTemplate, otherwise, use vtkMappedDataArrayTypeMacro.
135 #define vtkMappedDataArrayNewInstanceMacro(thisClass) \
136  protected: \
137  vtkObjectBase *NewInstanceInternal() const \
138  { \
139  if (vtkDataArray *da = \
140  vtkDataArray::CreateDataArray(thisClass::VTK_DATA_TYPE)) \
141  { \
142  return da; \
143  } \
144  return thisClass::New(); \
145  } \
146  public:
147 
148 // Same as vtkTypeMacro, but adds an implementation of NewInstanceInternal()
149 // that returns a standard (unmapped) VTK array, if possible.
150 #define vtkMappedDataArrayTypeMacro(thisClass, superClass) \
151  vtkAbstractTypeMacroWithNewInstanceType(thisClass, superClass, vtkDataArray) \
152  vtkMappedDataArrayNewInstanceMacro(thisClass)
153 
154 #endif //vtkMappedDataArray_h
155 
156 // VTK-HeaderTest-Exclude: vtkMappedDataArray.h
void PrintSelf(ostream &os, vtkIndent indent)
Provides the equivalent of vtkTypeMacro for use with template classes.
Map non-contiguous data structures into the vtkDataArray API.
Abstract superclass for all arrays.
int vtkIdType
Definition: vtkType.h:247
void ExportToVoidPointer(void *ptr)
vtkVariant GetVariantValue(vtkIdType idx)=0
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
a simple class to control print indentation
Definition: vtkIndent.h:38
void * GetVoidPointer(vtkIdType id)
void DeepCopy(vtkAbstractArray *aa)=0
virtual int GetArrayType()
list of point or cell ids
Definition: vtkIdList.h:35
void * WriteVoidPointer(vtkIdType, vtkIdType)
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
Superclass::ValueType ValueType
Extend vtkDataArray with abstract type-specific API.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output)=0
void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights)=0
vtkTypedDataArray< Scalar > Superclass
void SetVariantValue(vtkIdType idx, vtkVariant value)=0
static vtkMappedDataArray< Scalar > * FastDownCast(vtkAbstractArray *source)
void SetVoidArray(void *, vtkIdType, int)