Skip to content
Snippets Groups Projects
Commit 8e5482eb authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Add json conversion for MemoryID

parent d976f96e
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@ set(LIB_FILES
core/Time.cpp
core/ice_conversions.cpp
core/aron_conversions.cpp
core/json_conversions.cpp
core/base/detail/MemoryItem.cpp
core/base/detail/MaxHistorySize.cpp
......@@ -112,6 +113,7 @@ set(LIB_HEADERS
core/SuccessHeader.h
core/Time.h
core/aron_conversions.h
core/json_conversions.h
core/ice_conversions.h
core/ice_conversions_templates.h
......
#include "json_conversions.h"
#include <RobotAPI/libraries/armem/core/MemoryID.h>
void armarx::armem::to_json(nlohmann::json& j, const MemoryID& bo)
{
j["memoryName"] = bo.memoryName;
j["coreSegmentName"] = bo.coreSegmentName;
j["providerSegmentName"] = bo.providerSegmentName;
j["entityName"] = bo.entityName;
j["timestamp_usec"] = bo.timestamp.toMicroSeconds();
j["timestamp_datetime"] = toDateTimeMilliSeconds(bo.timestamp);
j["instanceIndex"] = bo.instanceIndex;
}
void armarx::armem::from_json(const nlohmann::json& j, MemoryID& bo)
{
j.at("memoryName").get_to(bo.memoryName);
j.at("coreSegmentName").get_to(bo.coreSegmentName);
j.at("providerSegmentName").get_to(bo.providerSegmentName);
j.at("entityName").get_to(bo.entityName);
bo.timestamp = Time::microSeconds(j.at("timestamp_usec").get<int64_t>());
// j.at("timestamp_datetime").get_to(toDateTimeMilliSeconds(bo.timestamp));
j.at("instanceIndex").get_to(bo.instanceIndex);
}
#pragma once
#include <SimoxUtility/json/json.hpp>
namespace armarx::armem
{
class MemoryID;
void to_json(nlohmann::json& j, const MemoryID& bo);
void from_json(const nlohmann::json& j, MemoryID& bo);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment