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 =========================================================================*/
29 #ifndef vtkTestDataArray_h
30 #define vtkTestDataArray_h
31 
32 #include "vtkCommonCoreModule.h" // For export macro
33 #include "vtkGenericDataArray.h"
34 
35 template <class ArrayT>
36 class vtkTestDataArray : public vtkGenericDataArray<vtkTestDataArray<ArrayT>,
37  typename ArrayT::ValueType>
38 {
39 public:
40  typedef ArrayT ArrayType;
41  typedef typename ArrayType::ValueType ValueType;
46 
49 
52 
53  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
54  { GenericDataArrayType::PrintSelf(os,indent); }
55 
56  ValueType GetValue(vtkIdType valueIdx) const
57  { return this->Array->GetValue(valueIdx); }
59  { this->Array->SetValue(valueIdx,value); }
60 
61  void GetTypedTuple(vtkIdType tupleIdx, ValueType* tuple) const
62  { this->Array->SetTypedTuple(tupleIdx,tuple); }
63  void SetTypedTuple(vtkIdType tupleIdx, const ValueType* tuple)
64  { this->Array->SetTypedTuple(tupleIdx,tuple); }
65 
66  ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
67  { return this->Array->GetTypedComponent(tupleIdx,compIdx); }
68  void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
69  { this->Array->SetTypedComponent(tupleIdx,compIdx,value); }
70 
71  void *GetVoidPointer(vtkIdType valueIdx) VTK_OVERRIDE
72  { return this->Array->GetVoidPointer(valueIdx); }
73 
74 protected:
75  vtkTestDataArray() { this->Array = ArrayType::New(); }
76  ~vtkTestDataArray() { this->Array->Delete(); }
77 
78  bool AllocateTuples(vtkIdType numTuples)
79  { return this->Array->Allocate(numTuples) != 0; }
80  bool ReallocateTuples(vtkIdType numTuples)
81  { return this->Array->Allocate(numTuples) != 0; }
82 
83 private:
84  ArrayType* Array;
85 
86  vtkTestDataArray(const vtkTestDataArray &) VTK_DELETE_FUNCTION;
87  void operator=(const vtkTestDataArray &) VTK_DELETE_FUNCTION;
88 };
89 
90 #endif
91 // VTK-HeaderTest-Exclude: vtkTestDataArray.h
void * GetVoidPointer(vtkIdType valueIdx) override
Return a void pointer.
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)
int vtkIdType
Definition: vtkType.h:345
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
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkAbstractTemplateTypeMacro(SelfType, GenericDataArrayType) vtkAOSArrayNewInstanceMacro(SelfType) static vtkTestDataArray< ArrayType > *New()
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) 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
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
ValueType GetValue(vtkIdType valueIdx) const
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
bool AllocateTuples(vtkIdType numTuples)