VTK
vtkInformationInternals.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkInformationInternals.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
23 #ifndef vtkInformationInternals_h
24 #define vtkInformationInternals_h
25 
26 #include "vtkInformationKey.h"
27 #include "vtkObjectBase.h"
28 
29 #define VTK_INFORMATION_USE_HASH_MAP
30 #ifdef VTK_INFORMATION_USE_HASH_MAP
31 # include <vtksys/hash_map.hxx>
32 #else
33 # include <vtksys/stl/map>
34 #endif
35 
36 //----------------------------------------------------------------------------
38 {
39 public:
42 #ifdef VTK_INFORMATION_USE_HASH_MAP
43  struct HashFun
44  {
45  size_t operator()(KeyType key) const
46  {
47  return static_cast<size_t>(key - KeyType(0));
48  }
49  };
50  typedef vtksys::hash_map<KeyType, DataType, HashFun> MapType;
51 #else
52  typedef vtksys_stl::map<KeyType, DataType> MapType;
53 #endif
54  MapType Map;
55 
56 #ifdef VTK_INFORMATION_USE_HASH_MAP
58 #endif
59 
61  {
62  for(MapType::iterator i = this->Map.begin(); i != this->Map.end(); ++i)
63  {
64  if(vtkObjectBase* value = i->second)
65  {
66  value->UnRegister(0);
67  }
68  }
69  }
70 };
71 
72 #undef VTK_INFORMATION_USE_HASH_MAP
73 
74 #endif
75 // VTK-HeaderTest-Exclude: vtkInformationInternals.h
internal structure for vtkInformation
Superclass for vtkInformation keys.
size_t operator()(KeyType key) const
abstract base class for most VTK objects
Definition: vtkObjectBase.h:59
vtksys::hash_map< KeyType, DataType, HashFun > MapType