VTK
dox/Common/Core/vtkArrayExtents.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkArrayExtents.h
00005 
00006 -------------------------------------------------------------------------
00007   Copyright 2008 Sandia Corporation.
00008   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009   the U.S. Government retains certain rights in this software.
00010 -------------------------------------------------------------------------
00011 
00012   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00013   All rights reserved.
00014   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00015 
00016      This software is distributed WITHOUT ANY WARRANTY; without even
00017      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00018      PURPOSE.  See the above copyright notice for more information.
00019 
00020 =========================================================================*/
00021 
00065 #ifndef __vtkArrayExtents_h
00066 #define __vtkArrayExtents_h
00067 
00068 #include "vtkCommonCoreModule.h" // For export macro
00069 #include "vtkSystemIncludes.h"
00070 #include "vtkArrayRange.h"
00071 #include <vector> // STL Header
00072 
00073 class VTKCOMMONCORE_EXPORT vtkArrayExtents
00074 {
00075 public:
00076   typedef vtkArrayCoordinates::DimensionT DimensionT;
00077   typedef vtkArrayCoordinates::CoordinateT CoordinateT;
00078   typedef vtkTypeUInt64 SizeT;
00079 
00081   vtkArrayExtents();
00082 
00085   explicit vtkArrayExtents(const CoordinateT i);
00087   explicit vtkArrayExtents(const vtkArrayRange& i);
00088 
00092   vtkArrayExtents(const CoordinateT i, const CoordinateT j);
00094   vtkArrayExtents(const vtkArrayRange& i, const vtkArrayRange& j);
00095 
00099   vtkArrayExtents(const CoordinateT i, const CoordinateT j, const CoordinateT k);
00101   vtkArrayExtents(const vtkArrayRange& i, const vtkArrayRange& j, const vtkArrayRange& k);
00102 
00105   static const vtkArrayExtents Uniform(DimensionT n, CoordinateT m);
00106 
00109   void Append(const vtkArrayRange& extent);
00110 
00112   DimensionT GetDimensions() const;
00113 
00117   SizeT GetSize() const;
00118 
00123   void SetDimensions(DimensionT dimensions);
00124 
00126   vtkArrayRange& operator[](DimensionT i);
00127 
00129   const vtkArrayRange& operator[](DimensionT i) const;
00130 
00132   vtkArrayRange GetExtent(DimensionT i) const;
00133 
00135   void SetExtent(DimensionT i, const vtkArrayRange&);
00136 
00138   bool operator==(const vtkArrayExtents& rhs) const;
00139 
00141   bool operator!=(const vtkArrayExtents& rhs) const;
00142 
00149   bool ZeroBased() const;
00150 
00154   bool SameShape(const vtkArrayExtents& rhs) const;
00155 
00162   void GetLeftToRightCoordinatesN(SizeT n, vtkArrayCoordinates& coordinates) const;
00163 
00170   void GetRightToLeftCoordinatesN(SizeT n, vtkArrayCoordinates& coordinates) const;
00171 
00176   bool Contains(const vtkArrayExtents& extents) const;
00177 
00183   bool Contains(const vtkArrayCoordinates& coordinates) const;
00184 
00185   VTKCOMMONCORE_EXPORT friend ostream& operator<<(
00186     ostream& stream, const vtkArrayExtents& rhs);
00187 
00188 private:
00189   //BTX
00190   std::vector<vtkArrayRange> Storage;
00191   //ETX
00192 };
00193 
00194 #endif
00195 // VTK-HeaderTest-Exclude: vtkArrayExtents.h