Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Common/KWCommon/vtkVector.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkVector.h,v $
00004 
00005   Copyright (c) Kitware, Inc.
00006   All rights reserved.
00007   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00018 #ifndef __vtkVector_h
00019 #define __vtkVector_h
00020 
00021 #include "vtkAbstractList.h"
00022 
00023 extern "C" 
00024 { 
00025   typedef int (*vtkVectorSortFunctionType)(const void *, const void *);
00026 }
00027 
00028 template <class DType> class vtkVectorIterator;
00029 
00030 template <class DType>
00031 class vtkVector : public vtkAbstractList<DType>
00032 {
00033   friend class vtkVectorIterator<DType>;
00034   virtual const char* GetClassNameInternal() const { return "vtkVector"; }
00035 
00036 public:
00037   typedef vtkAbstractList<DType> Superclass;
00038   typedef vtkVectorIterator<DType> IteratorType;
00039   
00040   static vtkVector<DType> *New();
00041 
00044   vtkVectorIterator<DType> *NewIterator();
00045   
00047   int AppendItem(DType a);
00048   
00050   void CopyItems(vtkVector<DType> *in);
00051 
00053   int PrependItem(DType a);
00054   
00060   int InsertItem(vtkIdType loc, DType a);
00061   
00064   int SetItem(vtkIdType loc, DType a);
00065 
00068   void SetItemNoCheck(vtkIdType loc, DType a);
00069 
00071   int RemoveItem(vtkIdType id);
00072   
00074   int GetItem(vtkIdType id, DType& ret);
00075       
00077   void GetItemNoCheck(vtkIdType id, DType& ret);
00078       
00081   int FindItem(DType a, vtkIdType &res);
00082 
00084 
00087   int FindItem(DType a, 
00088                vtkAbstractListCompareFunction(DType, compare), 
00089                vtkIdType &res);
00091   
00094   int IsItemPresent(DType a);
00095 
00099   vtkIdType GetNumberOfItems() const { return this->NumberOfItems; }
00100   
00102   vtkIdType GetSize() const { return this->Size; }
00103 
00105   void RemoveAllItems();
00106 
00109   int SetSize(vtkIdType size);
00110 
00112 
00114   void SetResize(int r) { this->Resize = r; }
00115   void ResizeOn() { this->SetResize(1); }
00116   void ResizeOff() { this->SetResize(0); }
00117   int GetResize() const { return this->Resize; }
00119 
00121   void DebugList();
00122 
00125   void Sort(vtkVectorSortFunctionType);
00126 
00127 protected:
00128   vtkVector() {
00129     this->Array = 0; this->NumberOfItems = 0; this->Size = 0; 
00130     this->Resize = 1; }
00131   virtual ~vtkVector();
00132   vtkIdType NumberOfItems;
00133   vtkIdType Size;
00134   int Resize;
00135   DType *Array;
00136 
00137 private:
00138   vtkVector(const vtkVector<DType>&); // Not implemented
00139   void operator=(const vtkVector<DType>&); // Not implemented
00140 };
00141 
00142 #ifdef VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION
00143 #include "vtkVector.txx"
00144 #endif 
00145 
00146 #endif
00147 
00148 
00149 

Generated on Tue May 30 12:31:38 2006 for ParaView by doxygen 1.3.5