vtkDataArrayTemplate.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00033 #ifndef __vtkDataArrayTemplate_h
00034 #define __vtkDataArrayTemplate_h
00035
00036 #include "vtkDataArray.h"
00037
00038 template <class T>
00039 class vtkDataArrayTemplate: public vtkDataArray
00040 {
00041 public:
00042 typedef vtkDataArray Superclass;
00043 void PrintSelf(ostream& os, vtkIndent indent);
00044
00047 int Allocate(vtkIdType sz, vtkIdType ext=1000);
00048
00050 void Initialize();
00051
00053 int GetDataTypeSize() { return static_cast<int>(sizeof(T)); }
00054
00056 void SetNumberOfTuples(vtkIdType number);
00057
00060 double* GetTuple(vtkIdType i);
00061
00063 void GetTuple(vtkIdType i, double* tuple);
00064
00066
00067 void SetTuple(vtkIdType i, const float* tuple);
00068 void SetTuple(vtkIdType i, const double* tuple);
00070
00072
00074 void InsertTuple(vtkIdType i, const float* tuple);
00075 void InsertTuple(vtkIdType i, const double* tuple);
00077
00079
00081 vtkIdType InsertNextTuple(const float* tuple);
00082 vtkIdType InsertNextTuple(const double* tuple);
00084
00086 void Squeeze() { this->ResizeAndExtend (this->MaxId+1); }
00087
00089 virtual void Resize(vtkIdType numTuples);
00090
00092 T GetValue(vtkIdType id) { return this->Array[id]; }
00093
00095
00097 void SetValue(vtkIdType id, T value)
00098 { this->Array[id] = value;};
00100
00104 void SetNumberOfValues(vtkIdType number);
00105
00107 void InsertValue(vtkIdType id, T f);
00108
00111 vtkIdType InsertNextValue(T f);
00112
00116 double GetComponent(vtkIdType i, int j);
00117
00122 void SetComponent(vtkIdType i, int j, double c);
00123
00127 virtual void InsertComponent(vtkIdType i, int j, double c);
00128
00132 T* WritePointer(vtkIdType id, vtkIdType number);
00133
00135
00137 T* GetPointer(vtkIdType id) { return this->Array + id; }
00138 void* GetVoidPointer(vtkIdType id) { return this->GetPointer(id); }
00140
00142 void DeepCopy(vtkDataArray* da);
00143
00145
00151 void SetArray(T* array, vtkIdType size, int save);
00152 void SetVoidArray(void* array, vtkIdType size, int save)
00153 { this->SetArray(static_cast<T*>(array), size, save); }
00155
00157 virtual void ComputeRange(int comp);
00158 protected:
00159 vtkDataArrayTemplate(vtkIdType numComp);
00160 ~vtkDataArrayTemplate();
00161
00162 T* Array;
00163 T* ResizeAndExtend(vtkIdType sz);
00164
00165 int TupleSize;
00166 double* Tuple;
00167
00168 int SaveUserArray;
00169
00170 void ComputeScalarRange(int comp);
00171 void ComputeVectorRange();
00172 private:
00173 vtkDataArrayTemplate(const vtkDataArrayTemplate&);
00174 void operator=(const vtkDataArrayTemplate&);
00175 };
00176
00177 #if !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
00178 # define VTK_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
00179 template class VTK_COMMON_EXPORT vtkDataArrayTemplate< T >
00180 #else
00181 # include "vtkDataArrayTemplateImplicit.txx"
00182 # define VTK_DATA_ARRAY_TEMPLATE_INSTANTIATE(T)
00183 #endif
00184
00185 #endif // !defined(__vtkDataArrayTemplate_h)
00186
00187
00188
00189
00190 #if defined(VTK_DATA_ARRAY_TEMPLATE_TYPE)
00191 # if defined(VTK_BUILD_SHARED_LIBS) && defined(_MSC_VER)
00192 # pragma warning (push)
00193 # pragma warning (disable: 4091) // warning C4091: 'extern ' :
00194
00195 # pragma warning (disable: 4231) // Compiler-specific extension warning.
00196
00197
00198 extern VTK_DATA_ARRAY_TEMPLATE_INSTANTIATE(VTK_DATA_ARRAY_TEMPLATE_TYPE);
00199 # pragma warning (pop)
00200 # endif
00201 # undef VTK_DATA_ARRAY_TEMPLATE_TYPE
00202 #endif