31 #ifdef EMLABCPP_USE_NLOHMANN_JSON
32 #include <nlohmann/json.hpp>
37 #ifdef EMLABCPP_USE_NLOHMANN_JSON
39 template < std::
size_t N >
40 inline void from_json( nlohmann::json
const& j, point< N >& p )
47 template < std::
size_t N >
48 inline void to_json( nlohmann::json& j, point< N >
const& p )
53 inline void to_json( nlohmann::json& j, quaternion
const& quat )
55 j = { quat[0], quat[1], quat[2], quat[3] };
58 inline void from_json( nlohmann::json
const& j, quaternion& quat )
61 j.at( 0 ).get<
float >(),
62 j.at( 1 ).get<
float >(),
63 j.at( 2 ).get<
float >(),
64 j.at( 3 ).get<
float >() };
67 inline void to_json( nlohmann::json& j, pose
const& p )
69 j[
"position"] = p.position;
70 j[
"orientation"] = p.orientation;
73 inline void from_json( nlohmann::json
const& j, pose& p )
76 j.at(
"position" ).get<
point< 3 > >(), j.at(
"orientation" ).get< quaternion >() };
79 template <
typename Item, std::
size_t N >
80 inline void to_json( nlohmann::json& j, simplex< Item, N >
const& sim )
82 std::copy( sim.begin(), sim.end(), std::back_inserter( j ) );
85 template <
typename Item, std::
size_t N >
86 inline void from_json( nlohmann::json
const& j, simplex< Item, N >& sim )
88 sim = simplex< Item, N >{ j.get< std::array< Item, N + 1 > >() };
std::array< float, N > container
Definition: vec_point_base.h:37
MIT License.
Definition: impl.h:31
view(Container &cont) -> view< iterator_of_t< Container > >
The container deduction guide uses iterator_of_t.
void copy(Container &&cont, Iterator iter)
Definition: algorithm.h:455
concept container
Definition: concepts.h:93