VTK  9.3.20240425
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
38VTK_ABI_NAMESPACE_BEGIN
40
41template <typename T>
42class vtkTypedArray : public vtkArray
43{
44public:
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
109protected:
110 vtkTypedArray() = default;
111 ~vtkTypedArray() override = default;
112
113private:
114 vtkTypedArray(const vtkTypedArray&) = delete;
115 void operator=(const vtkTypedArray&) = delete;
116};
117
118VTK_ABI_NAMESPACE_END
119#include "vtkTypedArray.txx"
120
121#endif
122
123// VTK-HeaderTest-Exclude: vtkTypedArray.h
Stores coordinate into an N-way array.
Abstract interface for N-dimensional arrays.
Definition vtkArray.h:52
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
vtkArrayExtents::CoordinateT CoordinateT
Definition vtkArray.h:57
vtkVariant GetVariantValue(CoordinateT i)
Returns the value stored in the array at the given coordinates.
Definition vtkArray.h:263
a simple class to control print indentation
Definition vtkIndent.h:108
Provides a type-specific interface to N-way arrays.
virtual const T & GetValue(const vtkArrayCoordinates &coordinates)=0
Returns the value stored in the array at the given coordinates.
vtkVariant GetVariantValue(const vtkArrayCoordinates &coordinates) override
Returns the value stored in the array at the given coordinates.
virtual void SetValue(CoordinateT i, CoordinateT j, const T &value)=0
Overwrites the value stored in the array at the given coordinates.
virtual void SetValue(CoordinateT i, const T &value)=0
Overwrites the value stored in the array at the given coordinates.
vtkTemplateTypeMacro(vtkTypedArray< T >, vtkArray)
void CopyValue(vtkArray *source, const vtkArrayCoordinates &source_coordinates, SizeT target_index) override
Overwrites a value with a value retrieved from another array.
vtkArray::CoordinateT CoordinateT
~vtkTypedArray() override=default
vtkVariant GetVariantValueN(SizeT n) override
Returns 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()).
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()).
virtual const T & GetValue(CoordinateT i, CoordinateT j, CoordinateT k)=0
Returns the value stored in the array at the given coordinates.
virtual const T & GetValueN(SizeT n)=0
Returns the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
virtual void SetValue(const vtkArrayCoordinates &coordinates, const T &value)=0
Overwrites the value stored in the array at the given coordinates.
vtkTypedArray()=default
void CopyValue(vtkArray *source, const vtkArrayCoordinates &source_coordinates, const vtkArrayCoordinates &target_coordinates) override
Overwrites a value with a value retrieved from another array.
void CopyValue(vtkArray *source, SizeT source_index, const vtkArrayCoordinates &target_coordinates) override
Overwrites a value with a value retrieved from another array.
virtual const T & GetValue(CoordinateT i, CoordinateT j)=0
Returns the value stored in the array at the given coordinates.
virtual void SetValue(CoordinateT i, CoordinateT j, CoordinateT k, const T &value)=0
Overwrites the value stored in the array at the given coordinates.
virtual const T & GetValue(CoordinateT i)=0
Returns 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.
vtkArray::SizeT SizeT
void SetVariantValue(const vtkArrayCoordinates &coordinates, const vtkVariant &value) override
Overwrites the value stored in the array at the given coordinates.
A type representing the union of many types.
Definition vtkVariant.h:162
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)