VTK  9.5.20250623
vtkInvoker.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
10#ifndef vtkInvoker_h
11#define vtkInvoker_h
12
13#include "vtkObject.h"
14
15#include "vtkCommonCoreModule.h" // for export macro
16#include "vtkLogger.h" // for vtkLogger::Verbosity enum
17#include "vtkMarshalContext.h" // for vtkMarshalContext
18#include "vtkSmartPointer.h" // for vktSmartPointer
19
20// clang-format off
21#include "vtk_nlohmannjson.h" // for json
22#include VTK_NLOHMANN_JSON(json_fwd.hpp) // for json
23// clang-format on
24
25#include <memory> // for unique_ptr
26#include <typeinfo> // for type_info
27
28VTK_ABI_NAMESPACE_BEGIN
29
30class VTKCOMMONCORE_EXPORT vtkInvoker : public vtkObject
31{
32public:
33 static vtkInvoker* New();
34 vtkTypeMacro(vtkInvoker, vtkObject);
35 void PrintSelf(ostream& os, vtkIndent indent) override;
36
38 std::function<nlohmann::json(vtkInvoker*, vtkObjectBase*, const char*, const nlohmann::json&)>;
39
40 nlohmann::json Invoke(
41 const vtkTypeUInt32& identifier, const std::string& methodName, const nlohmann::json& args);
42
44
51 void RegisterHandler(const std::type_info& type, HandlerType Invoker);
52 HandlerType GetHandler(const std::type_info& type) const;
53 bool UnRegisterHandler(const std::type_info& type);
55
57
62 vtkSetSmartPointerMacro(Context, vtkMarshalContext);
63 vtkGetSmartPointerMacro(Context, vtkMarshalContext);
65
67
82
83protected:
85 ~vtkInvoker() override;
86
89
90private:
91 vtkInvoker(const vtkInvoker&) = delete;
92 void operator=(const vtkInvoker&) = delete;
93 class vtkInternals;
94 std::unique_ptr<vtkInternals> Internals;
95};
96
97VTK_ABI_NAMESPACE_END
98#endif
a simple class to control print indentation
Definition vtkIndent.h:108
Deserialize VTK objects from JSON.
Definition vtkInvoker.h:31
vtkSmartPointer< vtkMarshalContext > Context
Definition vtkInvoker.h:87
HandlerType GetHandler(const std::type_info &type) const
The handlers are used to call a named method.
~vtkInvoker() override
nlohmann::json Invoke(const vtkTypeUInt32 &identifier, const std::string &methodName, const nlohmann::json &args)
void SetInvokerLogVerbosity(vtkLogger::Verbosity verbosity)
Set/Get the log verbosity of messages that are emitted when data is uploaded to GPU memory.
std::function< nlohmann::json(vtkInvoker *, vtkObjectBase *, const char *, const nlohmann::json &)> HandlerType
Definition vtkInvoker.h:38
bool UnRegisterHandler(const std::type_info &type)
The handlers are used to call a named method.
static vtkInvoker * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void RegisterHandler(const std::type_info &type, HandlerType Invoker)
The handlers are used to call a named method.
vtkLogger::Verbosity GetInvokerLogVerbosity()
Set/Get the log verbosity of messages that are emitted when data is uploaded to GPU memory.
@ VERBOSITY_INVALID
Definition vtkLogger.h:214
Shared context used by vtkSerializer and vtkDeserializer
abstract base class for most VTK objects
abstract base class for most VTK objects
Definition vtkObject.h:162
Hold a reference to a vtkObjectBase instance.