VTK
vtkTestDataArray.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSOADataArrayTemplate.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 =========================================================================*/
32 #ifndef vtkTestDataArray_h
33 #define vtkTestDataArray_h
34 
35 #include "vtkCommonCoreModule.h" // For export macro
36 #include "vtkGenericDataArray.h"
37 
38 template <class ArrayT>
39 class vtkTestDataArray : public vtkGenericDataArray<vtkTestDataArray<ArrayT>,
40  typename ArrayT::ValueType>
41 {
42 public:
43  typedef ArrayT ArrayType;
44  typedef typename ArrayType::ValueType ValueType;
48  friend class vtkGenericDataArray<vtkTestDataArray<ArrayT>, ValueType>;
49 
52 
53  static vtkTestDataArray<ArrayType>* New()
55 
56  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
57  { GenericDataArrayType::PrintSelf(os,indent); }
58 
59  ValueType GetValue(vtkIdType valueIdx) const
60  { return this->Array->GetValue(valueIdx); }
61  void SetValue(vtkIdType valueIdx, ValueType value)
62  { this->Array->SetValue(valueIdx,value); }
63 
64  void GetTypedTuple(vtkIdType tupleIdx, ValueType* tuple) const
65  { this->Array->SetTypedTuple(tupleIdx,tuple); }
66  void SetTypedTuple(vtkIdType tupleIdx, const ValueType* tuple)
67  { this->Array->SetTypedTuple(tupleIdx,tuple); }
68 
69  ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
70  { return this->Array->GetTypedComponent(tupleIdx,compIdx); }
71  void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
72  { this->Array->SetTypedComponent(tupleIdx,compIdx,value); }
73 
74  void *GetVoidPointer(vtkIdType valueIdx)
75  { return this->Array->GetVoidPointer(valueIdx); }
76 
77 protected:
78  vtkTestDataArray() { this->Array = ArrayType::New(); }
79  ~vtkTestDataArray() { this->Array->Delete(); }
80 
81  bool AllocateTuples(vtkIdType numTuples)
82  { return this->Array->Allocate(numTuples) != 0; }
83  bool ReallocateTuples(vtkIdType numTuples)
84  { return this->Array->Allocate(numTuples) != 0; }
85 
86 private:
87  ArrayType* Array;
88 
89  vtkTestDataArray(const vtkTestDataArray &) VTK_DELETE_FUNCTION;
90  void operator=(const vtkTestDataArray &) VTK_DELETE_FUNCTION;
91 };
92 
93 #endif
94 // VTK-HeaderTest-Exclude: vtkTestDataArray.h
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
void * GetVoidPointer(vtkIdType valueIdx)
Return a void pointer.
int vtkIdType
Definition: vtkType.h:287
Base interface for all typed vtkDataArray subclasses.
void SetValue(vtkIdType valueIdx, ValueType value)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTestDataArray< ArrayT > SelfType
ArrayType::ValueType ValueType
ValueType GetValue(vtkIdType valueIdx) const
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkAbstractTemplateTypeMacro(SelfType, GenericDataArrayType) vtkAOSArrayNewInstanceMacro(SelfType) static vtkTestDataArray< ArrayType > *New()
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
bool ReallocateTuples(vtkIdType numTuples)
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
#define VTK_STANDARD_NEW_BODY(thisClass)
#define vtkAOSArrayNewInstanceMacro(thisClass)
An implementation of vtkGenericDataArray for testing fallback algorithms.
vtkGenericDataArray< vtkTestDataArray< ArrayT >, ValueType > GenericDataArrayType
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
bool AllocateTuples(vtkIdType numTuples)