VTK  9.3.1
vtkTypedArray.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
4 
33 #ifndef vtkTypedArray_h
34 #define vtkTypedArray_h
35 
36 #include "vtkArray.h"
37 
38 VTK_ABI_NAMESPACE_BEGIN
40 
41 template <typename T>
42 class vtkTypedArray : public vtkArray
43 {
44 public:
47  typedef typename vtkArray::SizeT SizeT;
48 
51 
52  inline void PrintSelf(ostream& os, vtkIndent indent) override;
53 
54  // vtkArray API
55  inline vtkVariant GetVariantValue(const vtkArrayCoordinates& coordinates) override;
56  inline vtkVariant GetVariantValueN(SizeT n) override;
57  inline void SetVariantValue(
58  const vtkArrayCoordinates& coordinates, const vtkVariant& value) override;
59  inline void SetVariantValueN(SizeT n, const vtkVariant& value) override;
60  inline void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates,
61  const vtkArrayCoordinates& target_coordinates) override;
62  inline void CopyValue(
63  vtkArray* source, SizeT source_index, const vtkArrayCoordinates& target_coordinates) override;
64  inline void CopyValue(
65  vtkArray* source, const vtkArrayCoordinates& source_coordinates, SizeT target_index) override;
66 
68 
73  virtual const T& GetValue(CoordinateT i) = 0;
74  virtual const T& GetValue(CoordinateT i, CoordinateT j) = 0;
75  virtual const T& GetValue(CoordinateT i, CoordinateT j, CoordinateT k) = 0;
76  virtual const T& GetValue(const vtkArrayCoordinates& coordinates) = 0;
78 
86  virtual const T& GetValueN(SizeT n) = 0;
87 
89 
94  virtual void SetValue(CoordinateT i, const T& value) = 0;
95  virtual void SetValue(CoordinateT i, CoordinateT j, const T& value) = 0;
96  virtual void SetValue(CoordinateT i, CoordinateT j, CoordinateT k, const T& value) = 0;
97  virtual void SetValue(const vtkArrayCoordinates& coordinates, const T& value) = 0;
99 
107  virtual void SetValueN(SizeT n, const T& value) = 0;
108 
109 protected:
110  vtkTypedArray() = default;
111  ~vtkTypedArray() override = default;
112 
113 private:
114  vtkTypedArray(const vtkTypedArray&) = delete;
115  void operator=(const vtkTypedArray&) = delete;
116 };
117 
118 VTK_ABI_NAMESPACE_END
119 #include "vtkTypedArray.txx"
120 
121 #endif
122 
123 // VTK-HeaderTest-Exclude: vtkTypedArray.h
vtkVariant GetVariantValue(CoordinateT i)
Returns the value stored in the array at the given coordinates.
Definition: vtkArray.h:263
Stores coordinate into an N-way array.
virtual void SetValue(CoordinateT i, const T &value)=0
Overwrites the value stored in the array at the given coordinates.
vtkArray::SizeT SizeT
Definition: vtkTypedArray.h:47
virtual const T & GetValue(CoordinateT i)=0
Returns the value stored in the array at the given coordinates.
Abstract interface for N-dimensional arrays.
Definition: vtkArray.h:51
virtual const T & GetValueN(SizeT n)=0
Returns the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
~vtkTypedArray() override=default
vtkVariant GetVariantValue(const vtkArrayCoordinates &coordinates) override
Returns the value stored in the array at the given coordinates.
A type representing the union of many types.
Definition: vtkVariant.h:52
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkVariant GetVariantValueN(SizeT n) override
Returns the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
vtkTypedArray()=default
vtkTemplateTypeMacro(vtkTypedArray< T >, vtkArray)
void SetVariantValue(CoordinateT i, const vtkVariant &value)
Overwrites the value stored in the array at the given coordinates.
Definition: vtkArray.h:278
vtkArrayExtents::SizeT SizeT
Definition: vtkArray.h:59
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void SetVariantValue(const vtkArrayCoordinates &coordinates, const vtkVariant &value) override
Overwrites the value stored in the array at the given coordinates.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void CopyValue(vtkArray *source, const vtkArrayCoordinates &source_coordinates, const vtkArrayCoordinates &target_coordinates) override
Overwrites a value with a value retrieved from another array.
Provides a type-specific interface to N-way arrays.
Definition: vtkTypedArray.h:42
vtkArray::CoordinateT CoordinateT
Definition: vtkTypedArray.h:46
virtual void SetValueN(SizeT n, const T &value)=0
Overwrites the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
void SetVariantValueN(SizeT n, const vtkVariant &value) override
Overwrites the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
vtkArrayExtents::CoordinateT CoordinateT
Definition: vtkArray.h:57