VTK  9.1.0
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{
40public:
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
72private:
74};
75
76#undef VTK_INFORMATION_USE_HASH_MAP
77
78#endif
79// VTK-HeaderTest-Exclude: vtkInformationInternals.h
internal structure for vtkInformation
std::unordered_map< KeyType, DataType, HashFun > MapType
Superclass for vtkInformation keys.
abstract base class for most VTK objects
Definition: vtkObjectBase.h:70
@ key
Definition: vtkX3D.h:263
@ value
Definition: vtkX3D.h:226
size_t operator()(KeyType key) const