json_conversions.cpp
Go to the documentation of this file.
1 #include "json_conversions.h"
2 
5 
6 void
7 armarx::to_json(nlohmann::json& j, const FramedPose& fp)
8 {
9  j = nlohmann::json{{"agent", fp.agent},
10  {"frame", fp.frame},
11  {"qw", fp.orientation->qw},
12  {"qx", fp.orientation->qx},
13  {"qy", fp.orientation->qy},
14  {"qz", fp.orientation->qz},
15  {"x", fp.position->x},
16  {"y", fp.position->y},
17  {"z", fp.position->z}};
18 }
19 
20 void
21 armarx::from_json(const nlohmann::json& j, FramedPose& fp)
22 {
23  j.at("agent").get_to(fp.agent);
24  j.at("frame").get_to(fp.frame);
25  j.at("qw").get_to(fp.orientation->qw);
26  j.at("qx").get_to(fp.orientation->qx);
27  j.at("qy").get_to(fp.orientation->qy);
28  j.at("qz").get_to(fp.orientation->qz);
29  j.at("x").get_to(fp.position->x);
30  j.at("y").get_to(fp.position->y);
31  j.at("z").get_to(fp.position->z);
32 }
33 
34 void
35 armarx::to_json(simox::json::json& j, const Names& value)
36 {
37  j["recognized"] = value.recognized;
38  j["spoken"] = value.spoken;
39 }
40 
41 void
42 armarx::from_json(const simox::json::json& j, Names& value)
43 {
44  j.at("recognized").get_to(value.recognized);
45  j.at("spoken").get_to(value.spoken);
46 }
armarx::to_json
void to_json(nlohmann::json &j, const Vector2f &value)
armarx::FramedPose
The FramedPose class.
Definition: FramedPose.h:258
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
FramedPose.h
armarx::Names
Definition: Names.h:9
armarx::from_json
void from_json(const nlohmann::json &j, Vector2f &value)
Names.h
json_conversions.h