VTK  9.3.0
vtkCellGridResponders.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
35#ifndef vtkCellGridResponders_h
36#define vtkCellGridResponders_h
37
38#include "vtkCommonDataModelModule.h" // For export macro
39#include "vtkObject.h"
40#include "vtkSmartPointer.h" // For return values
41#include "vtkStringToken.h" // For API.
42#include "vtkTypeName.h" // For RegisterQueryResponder.
43
44#include <unordered_map>
45
46VTK_ABI_NAMESPACE_BEGIN
49class vtkCellMetadata;
50
51class VTKCOMMONDATAMODEL_EXPORT vtkCellGridResponders : public vtkObject
52{
53public:
55
57 void PrintSelf(ostream& os, vtkIndent indent) override;
58
62 template <typename CellType, typename QueryType, typename ResponderType>
63 void RegisterQueryResponder(ResponderType* responder)
64 {
65 vtkStringToken queryTypeKey = vtk::TypeName<QueryType>();
66 vtkStringToken cellTypeKey = vtk::TypeName<CellType>();
67 this->Responders[queryTypeKey][cellTypeKey] = responder;
68 }
69
75 bool Query(vtkCellMetadata* cellType, vtkCellGridQuery* query);
76
77protected:
79 ~vtkCellGridResponders() override = default;
80
81 std::unordered_map<vtkStringToken,
82 std::unordered_map<vtkStringToken, vtkSmartPointer<vtkCellGridResponderBase>>>
84 // std::unordered_multimap<vtkStringToken, vtkSmartPointer<vtkCellGridCache>> Caches;
85
86private:
88 void operator=(const vtkCellGridResponders&) = delete;
89};
90
91VTK_ABI_NAMESPACE_END
92#endif
Perform an operation on cells in a vtkCellMetadata instance.
Respond to a query on one particular type of cell.
A container that holds objects able to respond to queries specialized for particular vtkCellMetadata ...
std::unordered_map< vtkStringToken, std::unordered_map< vtkStringToken, vtkSmartPointer< vtkCellGridResponderBase > > > Responders
bool Query(vtkCellMetadata *cellType, vtkCellGridQuery *query)
Invoke a responder for the given query and cell type.
void RegisterQueryResponder(ResponderType *responder)
Register responder for processing a cell's data.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCellGridResponders()=default
~vtkCellGridResponders() override=default
static vtkCellGridResponders * New()
Metadata for a particular type of cell (finite element).
a simple class to control print indentation
Definition vtkIndent.h:29
abstract base class for most VTK objects
Definition vtkObject.h:49
Represent a string by its integer hash.