JsonSimoxShapeSerializer.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef MEMORYX_FOUND
4
5#include <memory>
6
7#include <SimoxUtility/json/json.hpp>
8
9namespace memoryx
10{
12}
13
14namespace armarx::semantic
15{
16 class SimoxObjectShape;
17
18 /**
19 * @brief A serializer for `SimoxObjectShape` using the `memoryx::ObjectClassSegment`.
20 */
21 class JsonSimoxShapeSerializer
22 {
23 public:
24 JsonSimoxShapeSerializer(const memoryx::ObjectClassSegmentWrapper* classSegment = nullptr);
25
26 void to_json(nlohmann::json& j, const SimoxObjectShape& object) const;
27 void from_json(const nlohmann::json& j, SimoxObjectShape& object) const;
28
29
30 /**
31 * @brief Register the given serializer in `semrel::json::ShapeSerializers`.
32 *
33 * The passed instance is held alive by capturing lambdas stored in
34 * `semrel::json::ShapeSerializers`.
35 *
36 * @see `semrel::json::ShapeSerializers::registerSerializer()`
37 */
38 static void registerSerializer(const std::shared_ptr<JsonSimoxShapeSerializer>& instance,
39 bool overwrite = false);
40
41
42 private:
43 const memoryx::ObjectClassSegmentWrapper* classSegment = nullptr;
44 };
45
46} // namespace armarx::semantic
47
48#endif
void from_json(const nlohmann::json &j, PackagePath &pp)
void to_json(nlohmann::json &j, const PackagePath &pp)
VirtualRobot headers.