VTK
dox/Common/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 "vtkSystemIncludes.h"
00069 #include "vtkArrayRange.h"
00070 #include <vector> // STL Header
00071 
00072 class VTK_COMMON_EXPORT vtkArrayExtents
00073 {
00074 public:
00075   typedef vtkArrayCoordinates::DimensionT DimensionT;
00076   typedef vtkArrayCoordinates::CoordinateT CoordinateT;
00077   typedef vtkTypeUInt64 SizeT;
00078 
00080   vtkArrayExtents();
00081 
00084   explicit vtkArrayExtents(const CoordinateT i);
00086   explicit vtkArrayExtents(const vtkArrayRange& i);
00087 
00091   vtkArrayExtents(const CoordinateT i, const CoordinateT j);
00093   vtkArrayExtents(const vtkArrayRange& i, const vtkArrayRange& j);
00094 
00098   vtkArrayExtents(const CoordinateT i, const CoordinateT j, const CoordinateT k);
00100   vtkArrayExtents(const vtkArrayRange& i, const vtkArrayRange& j, const vtkArrayRange& k);
00101 
00104   static const vtkArrayExtents Uniform(DimensionT n, CoordinateT m);
00105 
00108   void Append(const vtkArrayRange& extent);
00109 
00111   DimensionT GetDimensions() const;
00112 
00116   SizeT GetSize() const;
00117 
00122   void SetDimensions(DimensionT dimensions);
00123 
00125   vtkArrayRange& operator[](DimensionT i);
00126 
00128   const vtkArrayRange& operator[](DimensionT i) const;
00129 
00131   vtkArrayRange GetExtent(DimensionT i) const;
00132 
00134   void SetExtent(DimensionT i, const vtkArrayRange&);
00135 
00137   bool operator==(const vtkArrayExtents& rhs) const;
00138 
00140   bool operator!=(const vtkArrayExtents& rhs) const;
00141 
00148   bool ZeroBased() const;
00149 
00153   bool SameShape(const vtkArrayExtents& rhs) const;
00154 
00161   void GetLeftToRightCoordinatesN(SizeT n, vtkArrayCoordinates& coordinates) const;
00162 
00169   void GetRightToLeftCoordinatesN(SizeT n, vtkArrayCoordinates& coordinates) const;
00170 
00175   bool Contains(const vtkArrayExtents& extents) const;
00176 
00182   bool Contains(const vtkArrayCoordinates& coordinates) const;
00183 
00184   VTK_COMMON_EXPORT friend ostream& operator<<(
00185     ostream& stream, const vtkArrayExtents& rhs);
00186 
00187 private:
00188   //BTX
00189   std::vector<vtkArrayRange> Storage;
00190   //ETX
00191 };
00192 
00193 #endif