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 
65 #ifndef __vtkArrayExtents_h
66 #define __vtkArrayExtents_h
67 
68 #include "vtkSystemIncludes.h"
69 #include "vtkArrayRange.h"
70 #include <vector> // STL Header
71 
73 {
74 public:
77  typedef vtkTypeUInt64 SizeT;
78 
81 
84  explicit vtkArrayExtents(const CoordinateT i);
86  explicit vtkArrayExtents(const vtkArrayRange& i);
87 
91  vtkArrayExtents(const CoordinateT i, const CoordinateT j);
93  vtkArrayExtents(const vtkArrayRange& i, const vtkArrayRange& j);
94 
98  vtkArrayExtents(const CoordinateT i, const CoordinateT j, const CoordinateT k);
100  vtkArrayExtents(const vtkArrayRange& i, const vtkArrayRange& j, const vtkArrayRange& k);
101 
104  static const vtkArrayExtents Uniform(DimensionT n, CoordinateT m);
105 
108  void Append(const vtkArrayRange& extent);
109 
111  DimensionT GetDimensions() const;
112 
116  SizeT GetSize() const;
117 
122  void SetDimensions(DimensionT dimensions);
123 
125  vtkArrayRange& operator[](DimensionT i);
126 
128  const vtkArrayRange& operator[](DimensionT i) const;
129 
131  vtkArrayRange GetExtent(DimensionT i) const;
132 
134  void SetExtent(DimensionT i, const vtkArrayRange&);
135 
137  bool operator==(const vtkArrayExtents& rhs) const;
138 
140  bool operator!=(const vtkArrayExtents& rhs) const;
141 
148  bool ZeroBased() const;
149 
153  bool SameShape(const vtkArrayExtents& rhs) const;
154 
161  void GetLeftToRightCoordinatesN(SizeT n, vtkArrayCoordinates& coordinates) const;
162 
169  void GetRightToLeftCoordinatesN(SizeT n, vtkArrayCoordinates& coordinates) const;
170 
175  bool Contains(const vtkArrayExtents& extents) const;
176 
182  bool Contains(const vtkArrayCoordinates& coordinates) const;
183 
184  VTK_COMMON_EXPORT friend ostream& operator<<(
185  ostream& stream, const vtkArrayExtents& rhs);
186 
187 private:
188  //BTX
189  std::vector<vtkArrayRange> Storage;
190  //ETX
191 };
192 
193 #endif