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 =========================================================================*/
24 #ifndef vtkInformationInternals_h
25 #define vtkInformationInternals_h
26 
27 #include "vtkInformationKey.h"
28 #include "vtkObjectBase.h"
29 
30 #define VTK_INFORMATION_USE_HASH_MAP
31 #ifdef VTK_INFORMATION_USE_HASH_MAP
32 #include <unordered_map>
33 #else
34 #include <map>
35 #endif
36 
37 //----------------------------------------------------------------------------
39 {
40 public:
43 #ifdef VTK_INFORMATION_USE_HASH_MAP
44  struct HashFun
45  {
46  size_t operator()(KeyType key) const { return static_cast<size_t>(key - KeyType(nullptr)); }
47  };
48  typedef std::unordered_map<KeyType, DataType, HashFun> MapType;
49 #else
50  typedef std::map<KeyType, DataType> MapType;
51 #endif
53 
54 #ifdef VTK_INFORMATION_USE_HASH_MAP
56  : Map(33)
57  {
58  }
59 #endif
60 
62  {
63  for (MapType::iterator i = this->Map.begin(); i != this->Map.end(); ++i)
64  {
65  if (vtkObjectBase* value = i->second)
66  {
67  value->UnRegister(nullptr);
68  }
69  }
70  }
71 
72 private:
74 };
75 
76 #undef VTK_INFORMATION_USE_HASH_MAP
77 
78 #endif
79 // VTK-HeaderTest-Exclude: vtkInformationInternals.h
vtkInformationInternals::DataType
vtkObjectBase * DataType
Definition: vtkInformationInternals.h:42
vtkInformationInternals::Map
MapType Map
Definition: vtkInformationInternals.h:52
vtkObjectBase.h
vtkX3D::value
Definition: vtkX3D.h:226
vtkInformationInternals
internal structure for vtkInformation
Definition: vtkInformationInternals.h:38
vtkX3D::key
Definition: vtkX3D.h:263
vtkInformationInternals::~vtkInformationInternals
~vtkInformationInternals()
Definition: vtkInformationInternals.h:61
vtkInformationInternals::vtkInformationInternals
vtkInformationInternals()
Definition: vtkInformationInternals.h:55
vtkInformationInternals::MapType
std::unordered_map< KeyType, DataType, HashFun > MapType
Definition: vtkInformationInternals.h:48
vtkObjectBase
abstract base class for most VTK objects
Definition: vtkObjectBase.h:63
vtkInformationInternals::KeyType
vtkInformationKey * KeyType
Definition: vtkInformationInternals.h:41
vtkInformationInternals::HashFun::operator()
size_t operator()(KeyType key) const
Definition: vtkInformationInternals.h:46
vtkInformationInternals::HashFun
Definition: vtkInformationInternals.h:44
vtkInformationKey.h
vtkInformationKey
Superclass for vtkInformation keys.
Definition: vtkInformationKey.h:38