VTK
9.7.1
Main Page
Related Pages
Modules
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
10
#ifndef vtkSerializer_h
11
#define vtkSerializer_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.hpp) // for json
23
// clang-format on
24
25
#include <memory>
// for unique_ptr
26
#include <typeinfo>
// for type_info
27
28
VTK_ABI_NAMESPACE_BEGIN
29
30
class
VTKCOMMONCORE_EXPORT
vtkSerializer
:
public
vtkObject
31
{
32
public
:
33
static
vtkSerializer
*
New
();
34
vtkTypeMacro(
vtkSerializer
,
vtkObject
);
35
void
PrintSelf
(ostream& os,
vtkIndent
indent)
override
;
36
37
using
HandlerType
= std::function<nlohmann::json(vtkObjectBase*, vtkSerializer*)>;
38
42
nlohmann::json SerializeJSON(
vtkObjectBase
* objectBase);
43
45
52
void
RegisterHandler(
const
std::type_info&
type
,
HandlerType
handler);
53
HandlerType
GetHandler(
const
std::type_info&
type
)
const
;
54
bool
UnRegisterHandler(
const
std::type_info&
type
);
56
58
67
vtkSetSmartPointerMacro(Context,
vtkMarshalContext
);
68
vtkGetSmartPointerMacro(Context,
vtkMarshalContext
);
70
72
84
void
SetSerializerLogVerbosity(
vtkLogger::Verbosity
verbosity);
85
vtkLogger::Verbosity
GetSerializerLogVerbosity();
87
88
protected
:
89
vtkSerializer
();
90
~
vtkSerializer
()
override
;
91
92
vtkSmartPointer<vtkMarshalContext>
Context
;
93
vtkLogger::Verbosity
SerializerLogVerbosity =
vtkLogger::VERBOSITY_INVALID
;
94
95
private
:
96
vtkSerializer
(
const
vtkSerializer
&) =
delete
;
97
void
operator=(
const
vtkSerializer
&) =
delete
;
98
class
vtkInternals;
99
std::unique_ptr<vtkInternals> Internals;
100
};
101
VTK_ABI_NAMESPACE_END
102
#endif
vtkLogger::Verbosity
Verbosity
Definition:
vtkLogger.h:192
vtkObject
abstract base class for most VTK objects
Definition:
vtkObject.h:52
vtkX3D::type
Definition:
vtkX3D.h:517
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSerializer::HandlerType
std::function< nlohmann::json(vtkObjectBase *, vtkSerializer *)> HandlerType
Definition:
vtkSerializer.h:37
vtkSmartPointer< vtkMarshalContext >
vtkLogger.h
vtkLogger::VERBOSITY_INVALID
Definition:
vtkLogger.h:195
vtkIndent
a simple class to control print indentation
Definition:
vtkIndent.h:28
vtkMarshalContext.h
vtkObjectBase
abstract base class for most VTK objects
Definition:
vtkObjectBase.h:68
vtkMarshalContext
Shared context used by vtkSerializer and vtkDeserializer
Definition:
vtkMarshalContext.h:40
vtkSmartPointer.h
vtkSerializer::Context
vtkSmartPointer< vtkMarshalContext > Context
Definition:
vtkSerializer.h:92
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkObject.h
vtkSerializer
Serialize VTK objects to JSON.
Definition:
vtkSerializer.h:30
Generated on Tue Oct 20 2026 10:48:18 for VTK by
1.8.10