VTK
vtkTypedDataArray.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTypedDataArray.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 =========================================================================*/
33 #ifndef vtkTypedDataArray_h
34 #define vtkTypedDataArray_h
35 
36 #include "vtkDataArray.h"
37 
38 #include "vtkCommonCoreModule.h" // For export macro
39 #include "vtkTypeTemplate.h" // For vtkTypeTemplate
40 #include "vtkTypeTraits.h" // For type metadata
41 
42 template <class Scalar> class vtkTypedDataArrayIterator;
43 
44 template <class Scalar>
46  public vtkTypeTemplate<vtkTypedDataArray<Scalar>, vtkDataArray>
47 {
48 public:
50  typedef Scalar ValueType;
51 
56 
60  Iterator Begin();
61 
65  Iterator End();
66 
69 
77 
79  int GetDataType();
80 
82  int GetDataTypeSize();
83 
87  virtual void SetNumberOfValues(vtkIdType num);
88 
90  virtual void SetTupleValue(vtkIdType i, const ValueType *t) = 0;
91 
94  virtual void InsertTupleValue(vtkIdType i, const ValueType *t) = 0;
95 
98  virtual vtkIdType InsertNextTupleValue(const ValueType *t) = 0;
99 
101 
102  virtual vtkIdType LookupTypedValue(ValueType value) = 0;
103  virtual void LookupTypedValue(ValueType value, vtkIdList *ids) = 0;
105 
107  virtual ValueType GetValue(vtkIdType idx) = 0;
108 
110  virtual ValueType& GetValueReference(vtkIdType idx) = 0;
111 
114  virtual void SetValue(vtkIdType idx, ValueType value) = 0;
115 
117  virtual void GetTupleValue(vtkIdType idx, ValueType *t) = 0;
118 
121  virtual vtkIdType InsertNextValue(ValueType v) = 0;
122 
124  virtual void InsertValue(vtkIdType idx, ValueType v) = 0;
125 
128 
129 protected:
132 
133 private:
134  vtkTypedDataArray(const vtkTypedDataArray &); // Not implemented.
135  void operator=(const vtkTypedDataArray &); // Not implemented.
136 };
137 
138 // Included here to resolve chicken/egg issue with container/iterator:
139 #include "vtkTypedDataArrayIterator.h" // For iterator
140 
141 template <class Scalar> inline
143 {
144  return Iterator(this, 0);
145 }
146 
147 template <class Scalar> inline
149 {
150  return Iterator(this, this->MaxId + 1);
151 }
152 
153 #include "vtkTypedDataArray.txx"
154 
155 #endif //vtkTypedDataArray_h
156 
157 // VTK-HeaderTest-Exclude: vtkTypedDataArray.h
virtual int GetArrayType()
Provides the equivalent of vtkTypeMacro for use with template classes.
Abstract superclass for all arrays.
virtual void SetTupleValue(vtkIdType i, const ValueType *t)=0
virtual vtkIdType InsertNextValue(ValueType v)=0
static vtkTypedDataArray< Scalar > * FastDownCast(vtkAbstractArray *source)
virtual vtkIdType InsertNextTupleValue(const ValueType *t)=0
int vtkIdType
Definition: vtkType.h:275
virtual void InsertValue(vtkIdType idx, ValueType v)=0
list of point or cell ids
Definition: vtkIdList.h:35
virtual void InsertTupleValue(vtkIdType i, const ValueType *t)=0
virtual ValueType GetValue(vtkIdType idx)=0
virtual vtkIdType LookupTypedValue(ValueType value)=0
virtual ValueType & GetValueReference(vtkIdType idx)=0
Extend vtkDataArray with abstract type-specific API.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
virtual void SetNumberOfValues(vtkIdType num)
virtual void GetTupleValue(vtkIdType idx, ValueType *t)=0
virtual void SetValue(vtkIdType idx, ValueType value)=0
STL-style random access iterator for vtkTypedDataArrays.
Template defining traits of native types used by VTK.
Definition: vtkTypeTraits.h:31
vtkTypedDataArrayIterator< ValueType > Iterator