json_conversions.cpp
Go to the documentation of this file.
1
#include "
json_conversions.h
"
2
3
#include <
RobotAPI/libraries/armem/core/MemoryID.h
>
4
5
6
void
armarx::armem::to_json
(nlohmann::json& j,
const
MemoryID
&
bo
)
7
{
8
j[
"memoryName"
] =
bo
.memoryName;
9
j[
"coreSegmentName"
] =
bo
.coreSegmentName;
10
j[
"providerSegmentName"
] =
bo
.providerSegmentName;
11
j[
"entityName"
] =
bo
.entityName;
12
j[
"timestamp_usec"
] =
bo
.timestamp.toMicroSecondsSinceEpoch();
13
j[
"timestamp_datetime"
] =
toDateTimeMilliSeconds
(
bo
.timestamp);
14
j[
"instanceIndex"
] =
bo
.instanceIndex;
15
}
16
17
void
armarx::armem::from_json
(
const
nlohmann::json& j,
MemoryID
&
bo
)
18
{
19
j.at(
"memoryName"
).get_to(
bo
.memoryName);
20
j.at(
"coreSegmentName"
).get_to(
bo
.coreSegmentName);
21
j.at(
"providerSegmentName"
).get_to(
bo
.providerSegmentName);
22
j.at(
"entityName"
).get_to(
bo
.entityName);
23
bo
.timestamp =
Time
(Duration::MicroSeconds(j.at(
"timestamp_usec"
).get<int64_t>()));
24
// j.at("timestamp_datetime").get_to(toDateTimeMilliSeconds(bo.timestamp));
25
j.at(
"instanceIndex"
).get_to(
bo
.instanceIndex);
26
}
armarx::armem::to_json
void to_json(nlohmann::json &j, const MemoryID &bo)
Definition:
json_conversions.cpp:6
MemoryID.h
json_conversions.h
armarx::armem::MemoryID
A memory ID.
Definition:
MemoryID.h:47
armarx::armem::toDateTimeMilliSeconds
std::string toDateTimeMilliSeconds(const Time &time, int decimals=6)
Returns timeas e.g.
Definition:
Time.cpp:35
armarx::armem::Time
armarx::core::time::DateTime Time
Definition:
forward_declarations.h:13
armarx::armem::from_json
void from_json(const nlohmann::json &j, MemoryID &bo)
Definition:
json_conversions.cpp:17
armarx::aron::bo
const std::optional< BoT > & bo
Definition:
aron_conversions.h:168
RobotAPI
libraries
armem
core
json_conversions.cpp
Generated on Sat Oct 12 2024 09:14:02 for armarx_documentation by
1.8.17