Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkDataArrayTemplate.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkDataArrayTemplate.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00023 #ifndef __vtkDataArrayTemplate_h
00024 #define __vtkDataArrayTemplate_h
00025 
00026 #include "vtkDataArray.h"
00027 
00028 template <class T>
00029 class vtkDataArrayTemplate: public vtkDataArray
00030 {
00031 public:
00032   typedef vtkDataArray Superclass;
00033   void PrintSelf(ostream& os, vtkIndent indent);
00034 
00037   int Allocate(vtkIdType sz, vtkIdType ext=1000);
00038 
00040   void Initialize();
00041 
00043   int GetDataTypeSize() { return static_cast<int>(sizeof(T)); }
00044 
00046   void SetNumberOfTuples(vtkIdType number);
00047 
00050   double* GetTuple(vtkIdType i);
00051 
00053 
00054   void GetTuple(vtkIdType i, double* tuple);
00055   void GetTupleValue(vtkIdType i, T* tuple);
00057 
00059 
00060   void SetTuple(vtkIdType i, const float* tuple);
00061   void SetTuple(vtkIdType i, const double* tuple);
00062   void SetTupleValue(vtkIdType i, const T* tuple);
00064 
00066 
00068   void InsertTuple(vtkIdType i, const float* tuple);
00069   void InsertTuple(vtkIdType i, const double* tuple);
00070   void InsertTupleValue(vtkIdType i, const T* tuple);
00072 
00074 
00076   vtkIdType InsertNextTuple(const float* tuple);
00077   vtkIdType InsertNextTuple(const double* tuple);
00078   vtkIdType InsertNextTupleValue(const T* tuple);
00080 
00082   void Squeeze() { this->ResizeAndExtend (this->MaxId+1); }
00083 
00085   virtual int Resize(vtkIdType numTuples);
00086 
00088   T GetValue(vtkIdType id) { return this->Array[id]; }
00089 
00091 
00093   void SetValue(vtkIdType id, T value)
00094     { this->Array[id] = value;};
00096 
00100   void SetNumberOfValues(vtkIdType number);
00101 
00103   void InsertValue(vtkIdType id, T f);
00104 
00107   vtkIdType InsertNextValue(T f);
00108 
00112   double GetComponent(vtkIdType i, int j);
00113 
00118   void SetComponent(vtkIdType i, int j, double c);
00119 
00123   virtual void InsertComponent(vtkIdType i, int j, double c);
00124 
00126 
00129   T* WritePointer(vtkIdType id, vtkIdType number);
00130   void* WriteVoidPointer(vtkIdType id, vtkIdType number)
00131     { return this->WritePointer(id, 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 
00159   void ExportToVoidPointer(void *out_ptr);
00160 
00162   virtual void ComputeRange(int comp);
00163 protected:
00164   vtkDataArrayTemplate(vtkIdType numComp);
00165   ~vtkDataArrayTemplate();
00166 
00167   T* Array;   // pointer to data
00168   T* ResizeAndExtend(vtkIdType sz);  // function to resize data
00169 
00170   int TupleSize; //used for data conversion
00171   double* Tuple;
00172 
00173   int SaveUserArray;
00174 
00175   void ComputeScalarRange(int comp);
00176   void ComputeVectorRange();
00177 private:
00178   vtkDataArrayTemplate(const vtkDataArrayTemplate&);  // Not implemented.
00179   void operator=(const vtkDataArrayTemplate&);  // Not implemented.
00180 };
00181 
00182 #if !defined(VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
00183 # define VTK_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
00184    template class VTK_COMMON_EXPORT vtkDataArrayTemplate< T >
00185 #else
00186 # include "vtkDataArrayTemplateImplicit.txx"
00187 # define VTK_DATA_ARRAY_TEMPLATE_INSTANTIATE(T)
00188 #endif
00189 
00190 #endif // !defined(__vtkDataArrayTemplate_h)
00191 
00192 // This portion must be OUTSIDE the include blockers.  Each
00193 // vtkDataArray subclass uses this to give its instantiation of this
00194 // template a DLL interface.
00195 #if defined(VTK_DATA_ARRAY_TEMPLATE_TYPE)
00196 # if defined(VTK_BUILD_SHARED_LIBS) && defined(_MSC_VER)
00197 #  pragma warning (push)
00198 #  pragma warning (disable: 4091) // warning C4091: 'extern ' : 
00199    // ignored on left of 'int' when no variable is declared
00200 #  pragma warning (disable: 4231) // Compiler-specific extension warning.
00201    // Use an "extern explicit instantiation" to give the class a DLL
00202    // interface.  This is a compiler-specific extension.
00203    extern VTK_DATA_ARRAY_TEMPLATE_INSTANTIATE(VTK_DATA_ARRAY_TEMPLATE_TYPE);
00204 #  pragma warning (pop)
00205 # endif
00206 # undef VTK_DATA_ARRAY_TEMPLATE_TYPE
00207 #endif

Generated on Mon Jan 21 23:07:16 2008 for VTK by  doxygen 1.4.3-20050530