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
47  {
48  return static_cast<size_t>(key - KeyType(nullptr));
49  }
50  };
51  typedef std::unordered_map<KeyType, DataType, HashFun> MapType;
52 #else
53  typedef std::map<KeyType, DataType> MapType;
54 #endif
56 
57 #ifdef VTK_INFORMATION_USE_HASH_MAP
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 
73 #undef VTK_INFORMATION_USE_HASH_MAP
74 
75 #endif
76 // VTK-HeaderTest-Exclude: vtkInformationInternals.h
vtkInformationInternals::DataType
vtkObjectBase * DataType
Definition: vtkInformationInternals.h:42
vtkInformationInternals::Map
MapType Map
Definition: vtkInformationInternals.h:55
vtkObjectBase.h
vtkX3D::value
Definition: vtkX3D.h:220
vtkInformationInternals
internal structure for vtkInformation
Definition: vtkInformationInternals.h:38
vtkX3D::key
Definition: vtkX3D.h:257
vtkInformationInternals::~vtkInformationInternals
~vtkInformationInternals()
Definition: vtkInformationInternals.h:61
vtkInformationInternals::vtkInformationInternals
vtkInformationInternals()
Definition: vtkInformationInternals.h:58
vtkInformationInternals::MapType
std::unordered_map< KeyType, DataType, HashFun > MapType
Definition: vtkInformationInternals.h:51
vtkObjectBase
abstract base class for most VTK objects
Definition: vtkObjectBase.h:65
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:41