JsonIO.cpp
Go to the documentation of this file.
1
#include "
JsonIO.h
"
2
3
4
namespace
visionx::voxelgrid::io
5
{
6
7
8
void
JsonIO::writeJson
(
9
const
std::string&
filename
,
const
nlohmann::json& j,
10
int
indent,
char
indentChar)
11
{
12
std::ofstream ofs(
filename
);
13
writeJson
(ofs, j, indent, indentChar);
14
}
15
16
void
JsonIO::writeJson
(
17
std::ostream& os,
const
nlohmann::json& j,
18
int
indent,
char
indentChar)
19
{
20
os << j.dump(indent, indentChar);
21
}
22
23
nlohmann::json
JsonIO::readJson
(
const
std::string&
filename
)
24
{
25
std::ifstream ifs(
filename
);
26
return
readJson
(ifs);
27
}
28
29
nlohmann::json
JsonIO::readJson
(std::istream& is)
30
{
31
nlohmann::json j;
32
is >> j;
33
return
j;
34
}
35
36
37
38
}
visionx::voxelgrid::io
Definition:
BinaryIO.cpp:6
visionx::voxelgrid::io::JsonIO::writeJson
static void writeJson(const std::string &filename, const nlohmann::json &j, int indent=-1, char indentChar=' ')
Write JSON json to file.
Definition:
JsonIO.cpp:8
visionx::voxelgrid::io::JsonIO::readJson
static nlohmann::json readJson(const std::string &filename)
Read JSON from file.
Definition:
JsonIO.cpp:23
filename
std::string filename
Definition:
VisualizationRobot.cpp:83
JsonIO.h
VisionX
libraries
VoxelGridCore
io
JsonIO.cpp
Generated on Sat Oct 12 2024 09:14:18 for armarx_documentation by
1.8.17