VTK
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:
61  vtkTemplateTypeMacro(vtkTypedArray<T>, vtkArray)
62  typedef typename vtkArray::CoordinateT CoordinateT;
63  typedef typename vtkArray::SizeT SizeT;
64 
67 
68  void PrintSelf(ostream &os, vtkIndent indent) override;
69 
70  // vtkArray API
71  vtkVariant GetVariantValue(const vtkArrayCoordinates& coordinates) override;
72  vtkVariant GetVariantValueN(const SizeT n) override;
73  void SetVariantValue(const vtkArrayCoordinates& coordinates, const vtkVariant& value) override;
74  void SetVariantValueN(const SizeT n, const vtkVariant& value) override;
75  void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const vtkArrayCoordinates& target_coordinates) override;
76  void CopyValue(vtkArray* source, const SizeT source_index, const vtkArrayCoordinates& target_coordinates) override;
77  void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const SizeT target_index) override;
78 
80 
85  virtual const T& GetValue(CoordinateT i) = 0;
86  virtual const T& GetValue(CoordinateT i, CoordinateT j) = 0;
87  virtual const T& GetValue(CoordinateT i, CoordinateT j, CoordinateT k) = 0;
88  virtual const T& GetValue(const vtkArrayCoordinates& coordinates) = 0;
90 
98  virtual const T& GetValueN(const SizeT n) = 0;
99 
101 
106  virtual void SetValue(CoordinateT i, const T& value) = 0;
107  virtual void SetValue(CoordinateT i, CoordinateT j, const T& value) = 0;
108  virtual void SetValue(CoordinateT i, CoordinateT j, CoordinateT k, const T& value) = 0;
109  virtual void SetValue(const vtkArrayCoordinates& coordinates, const T& value) = 0;
111 
119  virtual void SetValueN(const SizeT n, const T& value) = 0;
120 
121 protected:
123  ~vtkTypedArray() override {}
124 
125 private:
126  vtkTypedArray(const vtkTypedArray&) = delete;
127  void operator=(const vtkTypedArray&) = delete;
128 };
129 
130 #include "vtkTypedArray.txx"
131 
132 #endif
133 
134 // VTK-HeaderTest-Exclude: vtkTypedArray.h
vtkTypedArray::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkArray::SizeT
vtkArrayExtents::SizeT SizeT
Definition: vtkArray.h:78
vtkX3D::value
Definition: vtkX3D.h:220
vtkTypedArray::SizeT
vtkTemplateTypeMacro(vtkTypedArray< T >, vtkArray) typedef typename vtkArray typedef vtkArray::SizeT SizeT
Definition: vtkTypedArray.h:61
vtkTypedArray::CopyValue
void CopyValue(vtkArray *source, const vtkArrayCoordinates &source_coordinates, const vtkArrayCoordinates &target_coordinates) override
Overwrites a value with a value retrieved from another array.
vtkArray::SetVariantValue
void SetVariantValue(CoordinateT i, const vtkVariant &value)
Overwrites the value stored in the array at the given coordinates.
Definition: vtkArray.h:294
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:825
vtkTypedArray::GetValue
virtual const T & GetValue(CoordinateT i)=0
Returns the value stored in the array at the given coordinates.
vtkTypedArray::vtkTypedArray
vtkTypedArray()
Definition: vtkTypedArray.h:122
vtkTypedArray
Provides a type-specific interface to N-way arrays.
Definition: vtkTypedArray.h:58
vtkArray::GetVariantValue
vtkVariant GetVariantValue(CoordinateT i)
Returns the value stored in the array at the given coordinates.
Definition: vtkArray.h:279
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkVariant
A atomic type representing the union of many types.
Definition: vtkVariant.h:71
vtkTypedArray::GetVariantValue
vtkVariant GetVariantValue(const vtkArrayCoordinates &coordinates) override
vtkArray
Abstract interface for N-dimensional arrays.
Definition: vtkArray.h:70
vtkTypedArray::SetVariantValueN
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()).
vtkTypedArray::GetVariantValueN
vtkVariant GetVariantValueN(const SizeT n) override
Returns the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
vtkTypedArray::SetValueN
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()).
vtkTypedArray::~vtkTypedArray
~vtkTypedArray() override
Definition: vtkTypedArray.h:123
vtkTypedArray::SetValue
virtual void SetValue(CoordinateT i, const T &value)=0
Overwrites the value stored in the array at the given coordinates.
vtkArray::CoordinateT
vtkArrayExtents::CoordinateT CoordinateT
Definition: vtkArray.h:76
vtkTypedArray::GetValueN
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()).
vtkArray.h
vtkArrayCoordinates
Stores coordinate into an N-way array.
Definition: vtkArrayCoordinates.h:57
vtkTypedArray::SetVariantValue
void SetVariantValue(const vtkArrayCoordinates &coordinates, const vtkVariant &value) override