VTK
9.4.20251007
Main Page
Related Pages
Topics
Namespaces
Classes
Files
File List
File Members
Common
Core
vtkSerializer.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 vtkSerializer_h
8
#define vtkSerializer_h
9
10
#include "
vtkObject.h
"
11
12
#include "vtkCommonCoreModule.h"
// for export macro
13
#include "
vtkMarshalContext.h
"
// for vtkMarshalContext
14
#include "
vtkSmartPointer.h
"
// for vktSmartPointer
15
16
// clang-format off
17
#include "vtk_nlohmannjson.h"
// for json
18
#include VTK_NLOHMANN_JSON(json.hpp)
// for json
19
// clang-format on
20
21
#include <memory>
// for unique_ptr
22
#include <typeinfo>
// for type_info
23
24
VTK_ABI_NAMESPACE_BEGIN
25
26
class
VTKCOMMONCORE_EXPORT
vtkSerializer
:
public
vtkObject
27
{
28
public
:
29
static
vtkSerializer
*
New
();
30
vtkTypeMacro(
vtkSerializer
,
vtkObject
);
31
void
PrintSelf
(ostream& os,
vtkIndent
indent)
override
;
32
33
using
HandlerType
= std::function<nlohmann::json(
vtkObjectBase
*,
vtkSerializer
*)>;
34
38
nlohmann::json
SerializeJSON
(
vtkObjectBase
* objectBase);
39
41
48
void
RegisterHandler
(
const
std::type_info& type,
HandlerType
handler);
49
HandlerType
GetHandler
(
const
std::type_info& type)
const
;
50
bool
UnRegisterHandler
(
const
std::type_info& type);
52
54
63
vtkSetSmartPointerMacro(
Context
,
vtkMarshalContext
);
64
vtkGetSmartPointerMacro(
Context
,
vtkMarshalContext
);
66
67
protected
:
68
vtkSerializer
();
69
~vtkSerializer
()
override
;
70
71
vtkSmartPointer<vtkMarshalContext>
Context
;
72
73
private
:
74
vtkSerializer
(
const
vtkSerializer
&) =
delete
;
75
void
operator=(
const
vtkSerializer
&) =
delete
;
76
class
vtkInternals;
77
std::unique_ptr<vtkInternals> Internals;
78
};
79
VTK_ABI_NAMESPACE_END
80
#endif
vtkIndent
a simple class to control print indentation
Definition
vtkIndent.h:29
vtkMarshalContext
Shared context used by vtkSerializer and vtkDeserializer
Definition
vtkMarshalContext.h:35
vtkObjectBase::vtkObjectBase
vtkObjectBase()
vtkObject::vtkObject
vtkObject()
vtkSerializer::GetHandler
HandlerType GetHandler(const std::type_info &type) const
The handlers are invoked to serialize an object of type type.
vtkSerializer::SerializeJSON
nlohmann::json SerializeJSON(vtkObjectBase *objectBase)
Serialize the VTK object.
vtkSerializer::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSerializer::UnRegisterHandler
bool UnRegisterHandler(const std::type_info &type)
The handlers are invoked to serialize an object of type type.
vtkSerializer::vtkSerializer
vtkSerializer()
vtkSerializer::New
static vtkSerializer * New()
vtkSerializer::Context
vtkSmartPointer< vtkMarshalContext > Context
Definition
vtkSerializer.h:71
vtkSerializer::HandlerType
std::function< nlohmann::json(vtkObjectBase *, vtkSerializer *)> HandlerType
Definition
vtkSerializer.h:33
vtkSerializer::~vtkSerializer
~vtkSerializer() override
vtkSerializer::RegisterHandler
void RegisterHandler(const std::type_info &type, HandlerType handler)
The handlers are invoked to serialize an object of type type.
vtkSmartPointer
Hold a reference to a vtkObjectBase instance.
Definition
vtkSmartPointer.h:32
vtkMarshalContext.h
vtkObject.h
vtkSmartPointer.h
Generated on
for VTK by
1.14.0