VTK  9.5.2
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
7#ifndef vtkInvoker_h
8#define vtkInvoker_h
9
10#include "vtkObject.h"
11
12#include "vtkCommonCoreModule.h" // for export macro
13#include "vtkLogger.h" // for vtkLogger::Verbosity enum
14#include "vtkMarshalContext.h" // for vtkMarshalContext
15#include "vtkSmartPointer.h" // for vktSmartPointer
16
17// clang-format off
18#include "vtk_nlohmannjson.h" // for json
19#include VTK_NLOHMANN_JSON(json_fwd.hpp) // for json
20// clang-format on
21
22#include <memory> // for unique_ptr
23#include <typeinfo> // for type_info
24
25VTK_ABI_NAMESPACE_BEGIN
26
27class VTKCOMMONCORE_EXPORT vtkInvoker : public vtkObject
28{
29public:
30 static vtkInvoker* New();
31 vtkTypeMacro(vtkInvoker, vtkObject);
32 void PrintSelf(ostream& os, vtkIndent indent) override;
33
35 std::function<nlohmann::json(vtkInvoker*, vtkObjectBase*, const char*, const nlohmann::json&)>;
36
37 nlohmann::json Invoke(
38 const vtkTypeUInt32& identifier, const std::string& methodName, const nlohmann::json& args);
39
41
48 void RegisterHandler(const std::type_info& type, HandlerType Invoker);
49 HandlerType GetHandler(const std::type_info& type) const;
50 bool UnRegisterHandler(const std::type_info& type);
52
54
59 vtkSetSmartPointerMacro(Context, vtkMarshalContext);
60 vtkGetSmartPointerMacro(Context, vtkMarshalContext);
62
64
79
80protected:
82 ~vtkInvoker() override;
83
86
87private:
88 vtkInvoker(const vtkInvoker&) = delete;
89 void operator=(const vtkInvoker&) = delete;
90 class vtkInternals;
91 std::unique_ptr<vtkInternals> Internals;
92};
93
94VTK_ABI_NAMESPACE_END
95#endif
a simple class to control print indentation
Definition vtkIndent.h:29
vtkSmartPointer< vtkMarshalContext > Context
Definition vtkInvoker.h:84
HandlerType GetHandler(const std::type_info &type) const
The handlers are used to call a named method.
~vtkInvoker() override
std::function< nlohmann::json(vtkInvoker *, vtkObjectBase *, const char *, const nlohmann::json &)> HandlerType
Definition vtkInvoker.h:34
nlohmann::json Invoke(const vtkTypeUInt32 &identifier, const std::string &methodName, const nlohmann::json &args)
vtkLogger::Verbosity InvokerLogVerbosity
Definition vtkInvoker.h:85
void SetInvokerLogVerbosity(vtkLogger::Verbosity verbosity)
Set/Get the log verbosity of messages that are emitted when data is uploaded to GPU memory.
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:195
Shared context used by vtkSerializer and vtkDeserializer.
Hold a reference to a vtkObjectBase instance.