@@ -57,12 +57,12 @@ BT_JSON_CONVERTER(Pose3D, v)
57
57
}
58
58
59
59
// specialized functions
60
- void jsonFromTime (const Time& t, nlohmann::json& j)
60
+ void jsonFromTime (const Time & t, nlohmann::json & j)
61
61
{
62
62
j[" stamp" ] = double (t.sec ) + 1e-9 * double (t.nsec );
63
63
}
64
64
65
- void jsonToTime (const nlohmann::json& j, Time& t)
65
+ void jsonToTime (const nlohmann::json & j, Time & t)
66
66
{
67
67
double sec = j[" stamp" ];
68
68
t.sec = int (sec);
@@ -78,7 +78,7 @@ class JsonTest : public testing::Test
78
78
protected:
79
79
JsonTest ()
80
80
{
81
- BT::JsonExporter& exporter = BT::JsonExporter::get ();
81
+ BT::JsonExporter & exporter = BT::JsonExporter::get ();
82
82
exporter.addConverter <TestTypes::Pose3D>();
83
83
exporter.addConverter <std::vector<TestTypes::Pose3D>>();
84
84
exporter.addConverter <TestTypes::Vector3D>();
@@ -91,9 +91,9 @@ class JsonTest : public testing::Test
91
91
92
92
TEST_F (JsonTest, TwoWaysConversion)
93
93
{
94
- BT::JsonExporter& exporter = BT::JsonExporter::get ();
94
+ BT::JsonExporter & exporter = BT::JsonExporter::get ();
95
95
96
- TestTypes::Pose3D pose = { { 1 , 2 , 3 }, { 4 , 5 , 6 , 7 } };
96
+ TestTypes::Pose3D pose = {{ 1 , 2 , 3 }, {4 , 5 , 6 , 7 } };
97
97
98
98
nlohmann::json json;
99
99
exporter.toJson (BT::Any (69 ), json[" int" ]);
@@ -135,9 +135,9 @@ TEST_F(JsonTest, TwoWaysConversion)
135
135
136
136
TEST_F (JsonTest, CustomTime)
137
137
{
138
- BT::JsonExporter& exporter = BT::JsonExporter::get ();
138
+ BT::JsonExporter & exporter = BT::JsonExporter::get ();
139
139
140
- TestTypes::Time stamp = { 3 , 8000000 };
140
+ TestTypes::Time stamp = {3 , 8000000 };
141
141
nlohmann::json json;
142
142
exporter.toJson (BT::Any (stamp), json);
143
143
std::cout << json.dump () << std::endl;
@@ -180,7 +180,7 @@ TEST_F(JsonTest, BlackboardInOut)
180
180
auto bb_in = BT::Blackboard::create ();
181
181
bb_in->set (" int" , 42 );
182
182
bb_in->set (" real" , 3.14 );
183
- bb_in->set (" vect" , TestTypes::Vector3D{ 1.1 , 2.2 , 3.3 });
183
+ bb_in->set (" vect" , TestTypes::Vector3D{1.1 , 2.2 , 3.3 });
184
184
185
185
auto json = ExportBlackboardToJSON (*bb_in);
186
186
std::cout << json.dump (2 ) << std::endl;
@@ -199,7 +199,7 @@ TEST_F(JsonTest, BlackboardInOut)
199
199
200
200
TEST_F (JsonTest, VectorOfCustomTypes)
201
201
{
202
- BT::JsonExporter& exporter = BT::JsonExporter::get ();
202
+ BT::JsonExporter & exporter = BT::JsonExporter::get ();
203
203
204
204
std::vector<TestTypes::Pose3D> poses (2 );
205
205
poses[0 ].pos .x = 1 ;
@@ -240,7 +240,8 @@ TEST_F(JsonTest, VectorOfCustomTypes)
240
240
ASSERT_EQ (json[" poses" ][1 ][" rot" ][" z" ], 14 );
241
241
242
242
// check the two-ways transform, i.e. "from_json"
243
- auto poses2 = exporter.fromJson (json[" poses" ])->first .cast <std::vector<TestTypes::Pose3D>>();
243
+ auto poses2 =
244
+ exporter.fromJson (json[" poses" ])->first .cast <std::vector<TestTypes::Pose3D>>();
244
245
ASSERT_EQ (poses.size (), poses2.size ());
245
246
ASSERT_EQ (poses[0 ].pos .x , poses2[0 ].pos .x );
246
247
ASSERT_EQ (poses[0 ].pos .y , poses2[0 ].pos .y );
@@ -256,4 +257,4 @@ TEST_F(JsonTest, VectorOfCustomTypes)
256
257
ASSERT_EQ (poses[1 ].rot .x , poses2[1 ].rot .x );
257
258
ASSERT_EQ (poses[1 ].rot .y , poses2[1 ].rot .y );
258
259
ASSERT_EQ (poses[1 ].rot .z , poses2[1 ].rot .z );
259
- }
260
+ }
0 commit comments