VTK  9.2.6
vtkJSONDataSetWriter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkJSONDataSetWriter.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
37
38#ifndef vtkJSONDataSetWriter_h
39#define vtkJSONDataSetWriter_h
40
41#include "vtkIOExportModule.h" // For export macro
42
43#include "vtkWriter.h"
44
45#include <string> // std::string used as parameters in a few methods
46
47class vtkDataSet;
48class vtkDataArray;
50class vtkArchiver;
51
52class VTKIOEXPORT_EXPORT vtkJSONDataSetWriter : public vtkWriter
53{
54public:
55 using vtkWriter::Write;
56
58
62 static void ComputeMD5(const unsigned char* content, int size, std::string& hash);
64
66
74 static std::string GetShortType(vtkDataArray* input, bool& needConversion);
76
78
82 static std::string GetUID(vtkDataArray*, bool& needConversion);
84
86
89 std::string GetValidString(const char*);
91
93
101 bool WriteArrayContents(vtkDataArray*, VTK_FILEPATH const char* relativeFilePath);
103
105
109 static bool WriteArrayAsRAW(vtkDataArray*, VTK_FILEPATH const char* filePath);
111
114 void PrintSelf(ostream& os, vtkIndent indent) override;
115
117
123
125
128 virtual void SetArchiver(vtkArchiver*);
129 vtkGetObjectMacro(Archiver, vtkArchiver);
131
133
134 bool IsDataSetValid() { return this->ValidDataSet; }
135
136protected:
139
140 void WriteData() final;
141 std::string WriteArray(vtkDataArray*, const char* className, const char* arrayName = nullptr);
142 std::string WriteDataSetAttributes(vtkDataSetAttributes* fields, const char* className);
143
147
148 int FillInputPortInformation(int port, vtkInformation* info) override;
149
150private:
152 void operator=(const vtkJSONDataSetWriter&) = delete;
153};
154
155#endif
Writes an archive.
Definition vtkArchiver.h:37
represent and manipulate attribute data in a dataset
abstract class to specify dataset behavior
Definition vtkDataSet.h:57
a simple class to control print indentation
Definition vtkIndent.h:34
Store vtkAlgorithm input/output information.
std::string WriteArray(vtkDataArray *, const char *className, const char *arrayName=nullptr)
static std::string GetShortType(vtkDataArray *input, bool &needConversion)
Compute the target JavaScript typed array name for the given vtkDataArray (Uin8, Uint16,...
vtkDataSet * GetInput(int port)
Get the input to this writer.
static void ComputeMD5(const unsigned char *content, int size, std::string &hash)
Compute a MD5 digest of a void/(const unsigned char) pointer to compute a string hash.
void Write(vtkDataSet *)
std::string WriteDataSetAttributes(vtkDataSetAttributes *fields, const char *className)
bool WriteArrayContents(vtkDataArray *, VTK_FILEPATH const char *relativeFilePath)
Write the contents of the vtkDataArray to disk based on the filePath provided without any extra infor...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void WriteData() final
vtkDataSet * GetInput()
Get the input to this writer.
static std::string GetUID(vtkDataArray *, bool &needConversion)
Return a Unique identifier for that array (i.e.: Float32_356_13f880891af7b77262c49cae09a41e28 )
static vtkJSONDataSetWriter * New()
~vtkJSONDataSetWriter() override
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
static bool WriteArrayAsRAW(vtkDataArray *, VTK_FILEPATH const char *filePath)
For backwards compatiblity, this static method writes a data array's contents directly to a file.
std::string GetValidString(const char *)
Return a Unique identifier for any invalid string.
virtual void SetArchiver(vtkArchiver *)
Specify the Scene Archiver object.
virtual int Write()
Write data to output.
#define vtkDataArray
#define VTK_FILEPATH