VTK  9.2.20220703
vtkTypedArray.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTypedArray.h
5 
6 -------------------------------------------------------------------------
7  Copyright 2008 Sandia Corporation.
8  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9  the U.S. Government retains certain rights in this software.
10 -------------------------------------------------------------------------
11 
12  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
13  All rights reserved.
14  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
15 
16  This software is distributed WITHOUT ANY WARRANTY; without even
17  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18  PURPOSE. See the above copyright notice for more information.
19 
20 =========================================================================*/
21 
50 #ifndef vtkTypedArray_h
51 #define vtkTypedArray_h
52 
53 #include "vtkArray.h"
54 
56 
57 template <typename T>
58 class vtkTypedArray : public vtkArray
59 {
60 public:
63  typedef typename vtkArray::SizeT SizeT;
64 
67 
68  inline void PrintSelf(ostream& os, vtkIndent indent) override;
69 
70  // vtkArray API
71  inline vtkVariant GetVariantValue(const vtkArrayCoordinates& coordinates) override;
72  inline vtkVariant GetVariantValueN(const SizeT n) override;
73  inline void SetVariantValue(
74  const vtkArrayCoordinates& coordinates, const vtkVariant& value) override;
75  inline void SetVariantValueN(const SizeT n, const vtkVariant& value) override;
76  inline void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates,
77  const vtkArrayCoordinates& target_coordinates) override;
78  inline void CopyValue(vtkArray* source, const SizeT source_index,
79  const vtkArrayCoordinates& target_coordinates) override;
80  inline void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates,
81  const SizeT target_index) override;
82 
84 
89  virtual const T& GetValue(CoordinateT i) = 0;
90  virtual const T& GetValue(CoordinateT i, CoordinateT j) = 0;
91  virtual const T& GetValue(CoordinateT i, CoordinateT j, CoordinateT k) = 0;
92  virtual const T& GetValue(const vtkArrayCoordinates& coordinates) = 0;
94 
102  virtual const T& GetValueN(const SizeT n) = 0;
103 
105 
110  virtual void SetValue(CoordinateT i, const T& value) = 0;
111  virtual void SetValue(CoordinateT i, CoordinateT j, const T& value) = 0;
112  virtual void SetValue(CoordinateT i, CoordinateT j, CoordinateT k, const T& value) = 0;
113  virtual void SetValue(const vtkArrayCoordinates& coordinates, const T& value) = 0;
115 
123  virtual void SetValueN(const SizeT n, const T& value) = 0;
124 
125 protected:
126  vtkTypedArray() = default;
127  ~vtkTypedArray() override = default;
128 
129 private:
130  vtkTypedArray(const vtkTypedArray&) = delete;
131  void operator=(const vtkTypedArray&) = delete;
132 };
133 
134 #include "vtkTypedArray.txx"
135 
136 #endif
137 
138 // VTK-HeaderTest-Exclude: vtkTypedArray.h
Stores coordinate into an N-way array.
Abstract interface for N-dimensional arrays.
Definition: vtkArray.h:68
void SetVariantValue(CoordinateT i, const vtkVariant &value)
Overwrites the value stored in the array at the given coordinates.
Definition: vtkArray.h:294
vtkArrayExtents::SizeT SizeT
Definition: vtkArray.h:75
vtkArrayExtents::CoordinateT CoordinateT
Definition: vtkArray.h:73
vtkVariant GetVariantValue(CoordinateT i)
Returns the value stored in the array at the given coordinates.
Definition: vtkArray.h:279
a simple class to control print indentation
Definition: vtkIndent.h:119
Provides a type-specific interface to N-way arrays.
Definition: vtkTypedArray.h:59
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)
vtkArray::CoordinateT CoordinateT
Definition: vtkTypedArray.h:62
~vtkTypedArray() override=default
vtkVariant GetVariantValueN(const SizeT n) override
Returns the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
void CopyValue(vtkArray *source, const SizeT source_index, const vtkArrayCoordinates &target_coordinates) override
Overwrites a value with a value retrieved from another array.
virtual const T & GetValueN(const SizeT n)=0
Returns the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
void SetVariantValueN(const SizeT n, const vtkVariant &value) override
Overwrites the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
void CopyValue(vtkArray *source, const vtkArrayCoordinates &source_coordinates, const SizeT target_index) override
Overwrites a value with a value retrieved from another array.
virtual void SetValueN(const SizeT n, const T &value)=0
Overwrites 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.
virtual const T & GetValue(CoordinateT i)=0
Returns 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.
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(const vtkArrayCoordinates &coordinates)=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
Definition: vtkTypedArray.h:63
virtual const T & GetValue(CoordinateT i, CoordinateT j, CoordinateT k)=0
Returns the value stored in the array at the given coordinates.
void SetVariantValue(const vtkArrayCoordinates &coordinates, const vtkVariant &value) override
Overwrites the value stored in the array at the given coordinates.
A atomic type representing the union of many types.
Definition: vtkVariant.h:159
@ value
Definition: vtkX3D.h:226
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)