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

Common/KWCommon/vtkAbstractMap.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkAbstractMap.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 =========================================================================*/
00029 #include "vtkContainer.h"
00030 
00031 #ifndef __vtkAbstractMap_h
00032 #define __vtkAbstractMap_h
00033 
00034 // This is an item of the map.
00035 template<class KeyType, class DataType>
00036 class vtkAbstractMapItem
00037 {
00038 public:
00039   KeyType Key;
00040   DataType Data;
00041 };
00042 
00043 template<class KeyType, class DataType>
00044 class vtkAbstractIterator;
00045 
00046 template<class KeyType, class DataType>
00047 class vtkAbstractMap : public vtkContainer
00048 {
00049   virtual const char* GetClassNameInternal() const {return "vtkAbstractMap";}
00050 public:
00051   typedef vtkContainer Superclass; 
00052 
00069 protected:
00070   vtkAbstractMap();
00071 
00072 private:
00073   vtkAbstractMap(const vtkAbstractMap&); // Not implemented
00074   void operator=(const vtkAbstractMap&); // Not implemented
00075 };
00076 
00077 //----------------------------------------------------------------------------
00078 template<class KeyType, class DataType>
00079 int vtkContainerCompareMethod(const vtkAbstractMapItem<KeyType, DataType>& d1,
00080                               const vtkAbstractMapItem<KeyType, DataType>& d2)
00081 {
00082   // Use only the Key for comparison.
00083   return ::vtkContainerCompareMethod(d1.Key, d2.Key);
00084 }
00085 
00086 //----------------------------------------------------------------------------
00087 template<class KeyType, class DataType>
00088 vtkAbstractMapItem<KeyType, DataType>
00089 vtkContainerCreateMethod(const vtkAbstractMapItem<KeyType, DataType>& item)
00090 {
00091   // Copy both components from the input.
00092   vtkAbstractMapItem<KeyType, DataType> result =
00093     {
00094       static_cast<KeyType>(vtkContainerCreateMethod(item.Key)),
00095       static_cast<DataType>(vtkContainerCreateMethod(item.Data))
00096     };
00097   return result;
00098 }
00099 
00100 //----------------------------------------------------------------------------
00101 template<class KeyType, class DataType>
00102 void vtkContainerDeleteMethod(vtkAbstractMapItem<KeyType, DataType>& item)
00103 {
00104   // Delete both components.
00105   vtkContainerDeleteMethod(item.Key);
00106   vtkContainerDeleteMethod(item.Data);
00107 }
00108 
00109 //----------------------------------------------------------------------------
00110 
00111 #ifdef VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION
00112 #include "vtkAbstractMap.txx"
00113 #endif 
00114 
00115 #endif
00116 
00117 
00118 

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