VTK
vtkArrayExtents.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkArrayExtents.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 
66 #ifndef vtkArrayExtents_h
67 #define vtkArrayExtents_h
68 
69 #include "vtkCommonCoreModule.h" // For export macro
70 #include "vtkSystemIncludes.h"
71 #include "vtkArrayRange.h"
72 #include <vector> // STL Header
73 
74 class VTKCOMMONCORE_EXPORT vtkArrayExtents
75 {
76 public:
79  typedef vtkTypeUInt64 SizeT;
80 
85 
90  explicit vtkArrayExtents(const CoordinateT i);
94  explicit vtkArrayExtents(const vtkArrayRange& i);
95 
100  vtkArrayExtents(const CoordinateT i, const CoordinateT j);
104  vtkArrayExtents(const vtkArrayRange& i, const vtkArrayRange& j);
105 
111  vtkArrayExtents(const CoordinateT i, const CoordinateT j, const CoordinateT k);
115  vtkArrayExtents(const vtkArrayRange& i, const vtkArrayRange& j, const vtkArrayRange& k);
116 
121  static const vtkArrayExtents Uniform(DimensionT n, CoordinateT m);
122 
127  void Append(const vtkArrayRange& extent);
128 
132  DimensionT GetDimensions() const;
133 
139  SizeT GetSize() const;
140 
147  void SetDimensions(DimensionT dimensions);
148 
152  vtkArrayRange& operator[](DimensionT i);
153 
157  const vtkArrayRange& operator[](DimensionT i) const;
158 
162  vtkArrayRange GetExtent(DimensionT i) const;
163 
167  void SetExtent(DimensionT i, const vtkArrayRange&);
168 
172  bool operator==(const vtkArrayExtents& rhs) const;
173 
177  bool operator!=(const vtkArrayExtents& rhs) const;
178 
187  bool ZeroBased() const;
188 
195  bool SameShape(const vtkArrayExtents& rhs) const;
196 
205  void GetLeftToRightCoordinatesN(SizeT n, vtkArrayCoordinates& coordinates) const;
206 
215  void GetRightToLeftCoordinatesN(SizeT n, vtkArrayCoordinates& coordinates) const;
216 
223  bool Contains(const vtkArrayExtents& extents) const;
224 
232  bool Contains(const vtkArrayCoordinates& coordinates) const;
233 
234  VTKCOMMONCORE_EXPORT friend ostream& operator<<(
235  ostream& stream, const vtkArrayExtents& rhs);
236 
237 private:
238 
239  std::vector<vtkArrayRange> Storage;
240 
241 };
242 
243 #endif
244 // VTK-HeaderTest-Exclude: vtkArrayExtents.h
Stores coordinate into an N-way array.
Stores the number of dimensions and valid coordinate ranges along each dimension for vtkArray...
Stores a half-open range of array coordinates.
Definition: vtkArrayRange.h:51
vtkTypeUInt64 SizeT
vtkArrayCoordinates::CoordinateT CoordinateT
VTKCOMMONCORE_EXPORT bool operator!=(const vtkUnicodeString &lhs, const vtkUnicodeString &rhs)
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)
VTKCOMMONCORE_EXPORT bool operator==(const vtkUnicodeString &lhs, const vtkUnicodeString &rhs)
vtkArrayCoordinates::DimensionT DimensionT