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 
00083 
00085   explicit vtkArrayExtents(const CoordinateT i);
00086   // Description:
00087   // Create one-dimensional extents.
00088   explicit vtkArrayExtents(const vtkArrayRange& i);
00090 
00092 
00095   vtkArrayExtents(const CoordinateT i, const CoordinateT j);
00096   // Description:
00097   // Create two-dimensional extents.
00098   vtkArrayExtents(const vtkArrayRange& i, const vtkArrayRange& j);
00100 
00102 
00105   vtkArrayExtents(const CoordinateT i, const CoordinateT j, const CoordinateT k);
00106   // Description:
00107   // Create three-dimensional extents.
00108   vtkArrayExtents(const vtkArrayRange& i, const vtkArrayRange& j, const vtkArrayRange& k);
00110 
00113   static const vtkArrayExtents Uniform(DimensionT n, CoordinateT m);
00114 
00117   void Append(const vtkArrayRange& extent);
00118 
00120   DimensionT GetDimensions() const;
00121 
00125   SizeT GetSize() const;
00126 
00131   void SetDimensions(DimensionT dimensions);
00132 
00134   vtkArrayRange& operator[](DimensionT i);
00135 
00137   const vtkArrayRange& operator[](DimensionT i) const;
00138 
00140   bool operator==(const vtkArrayExtents& rhs) const;
00141 
00143   bool operator!=(const vtkArrayExtents& rhs) const;
00144 
00151   bool ZeroBased() const;
00152 
00156   bool SameShape(const vtkArrayExtents& rhs) const;
00157 
00164   void GetLeftToRightCoordinatesN(SizeT n, vtkArrayCoordinates& coordinates) const;
00165 
00172   void GetRightToLeftCoordinatesN(SizeT n, vtkArrayCoordinates& coordinates) const;
00173 
00178   bool Contains(const vtkArrayExtents& extents) const;
00179 
00185   bool Contains(const vtkArrayCoordinates& coordinates) const;
00186 
00187   VTK_COMMON_EXPORT friend ostream& operator<<(
00188     ostream& stream, const vtkArrayExtents& rhs);
00189 
00190 private:
00191   //BTX
00192   std::vector<vtkArrayRange> Storage;
00193   //ETX
00194 };
00195 
00196 #endif