ice_conversions.cpp
Go to the documentation of this file.
1 #include "ice_conversions.h"
2 
5 
8 
10 
11 
12 namespace armarx::armem::base
13 {
14 
15  void detail::toIceItem(data::detail::MemoryItem& ice, const armem::base::detail::MemoryItem& item)
16  {
17  toIce(ice.id, item.id());
18  }
19  void detail::fromIceItem(const data::detail::MemoryItem& ice, armem::base::detail::MemoryItem& item)
20  {
21  fromIce(ice.id, item.id());
22  }
23 
24 
26  {
27  ice = data ? data->toAronDictDTO() : nullptr;
28  }
30  {
31  if (ice)
32  {
34  }
35  else
36  {
37  data = nullptr;
38  };
39  }
40 
41  void detail::toIce(aron::type::dto::GenericTypePtr& ice, const aron::type::ObjectPtr& bo)
42  {
43  ice = bo ? bo->toAronDTO() : nullptr;
44  }
45  void detail::fromIce(const aron::type::dto::GenericTypePtr& ice, aron::type::ObjectPtr& bo)
46  {
47  bo = ice
49  : nullptr;
50  }
51 
52 }
53 namespace armarx::armem
54 {
55 
57  {
58  ice.confidence = metadata.confidence;
59  toIce(ice.arrivedTime, metadata.arrivedTime);
60  toIce(ice.referencedTime, metadata.referencedTime);
61  toIce(ice.sentTime, metadata.sentTime);
62  toIce(ice.lastAccessedTime, metadata.lastAccessedTime);
63  ice.accessed = metadata.numAccessed;
64  }
66  {
67  metadata.confidence = ice.confidence;
68  fromIce(ice.arrivedTime, metadata.arrivedTime);
69  fromIce(ice.referencedTime, metadata.referencedTime);
70  fromIce(ice.sentTime, metadata.sentTime);
71  fromIce(ice.lastAccessedTime, metadata.lastAccessedTime);
72  metadata.numAccessed = ice.accessed;
73  }
74 
75 
76  void base::toIce(data::EntityInstanceMetadataPtr& ice, const EntityInstanceMetadata& metadata)
77  {
78  armarx::toIce<data::EntityInstanceMetadata>(ice, metadata);
79  }
80  void base::fromIce(const data::EntityInstanceMetadataPtr& ice, EntityInstanceMetadata& metadata)
81  {
82  armarx::fromIce<data::EntityInstanceMetadata>(ice, metadata);
83  }
84 
85 }
armarx::armem::base::detail::fromIceItem
void fromIceItem(const data::detail::MemoryItem &ice, MemoryItem &item)
Definition: ice_conversions.cpp:19
armarx::armem::base
Definition: CoreSegmentBase.h:15
armarx::armem::base::EntityInstanceMetadata::numAccessed
unsigned long numAccessed
A counter how often the instance has been accessed.
Definition: EntityInstanceBase.h:60
armarx::aron::type::Variant::FromAronDTO
static VariantPtr FromAronDTO(const type::dto::GenericType &, const Path &=Path())
create a variant object from an dto object
Definition: Variant.cpp:39
armarx::armem::base::detail::MemoryItem
Base class of memory classes on different levels.
Definition: MemoryItem.h:14
armarx::armem::wm::EntityInstanceMetadata
base::EntityInstanceMetadata EntityInstanceMetadata
Client-side working memory entity instance metadata.
Definition: memory_definitions.h:18
armarx::armem
Definition: LegacyRobotStateMemoryAdapter.cpp:31
armarx::armem::toIce
void toIce(data::MemoryID &ice, const MemoryID &id)
Definition: ice_conversions.cpp:21
armarx::armem::base::detail::toIceItem
void toIceItem(data::detail::MemoryItem &ice, const MemoryItem &item)
Definition: ice_conversions.cpp:15
ice_conversions.h
Dict.h
armarx::aron::data::Dict::FromAronDictDTO
static PointerType FromAronDictDTO(const data::dto::DictPtr &aron)
Definition: Dict.cpp:129
Object.h
armarx::armem::base::toIce
void toIce(data::EntityInstanceMetadata &ice, const EntityInstanceMetadata &metadata)
Definition: ice_conversions.cpp:56
armarx::armem::base::fromIce
void fromIce(const data::EntityInstanceMetadata &ice, EntityInstanceMetadata &metadata)
Definition: ice_conversions.cpp:65
armarx::armem::base::EntityInstanceMetadata::sentTime
Time sentTime
Time when this value was sent to the memory.
Definition: EntityInstanceBase.h:49
armarx::armem::base::detail::fromIce
void fromIce(const aron::data::dto::DictPtr &ice, aron::data::DictPtr &bo)
Definition: ice_conversions.cpp:29
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
ice_conversions.h
armarx::armem::base::detail::MemoryItem::id
MemoryID & id()
Definition: MemoryItem.h:27
armarx::armem::fromIce
void fromIce(const data::MemoryID &ice, MemoryID &id)
Definition: ice_conversions.cpp:31
armarx::armem::base::EntityInstanceMetadata::arrivedTime
Time arrivedTime
Time when this value has arrived at the memory.
Definition: EntityInstanceBase.h:51
armarx::armem::base::detail::toIce
void toIce(aron::data::dto::DictPtr &ice, const aron::data::DictPtr &bo)
Definition: ice_conversions.cpp:25
armarx::armem::base::EntityInstanceMetadata::referencedTime
Time referencedTime
Time this instance refers to.
Definition: EntityInstanceBase.h:46
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
armarx::aron::type::detail::SpecializedVariantBase< type::dto::AronObject, Object >::DynamicCastAndCheck
static std::shared_ptr< Object > DynamicCastAndCheck(const VariantPtr &n)
Definition: SpecializedVariant.h:124
armarx::armem::base::EntityInstanceMetadata
Metadata of an entity instance.
Definition: EntityInstanceBase.h:34
ice_conversions_templates.h
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
armarx::armem::base::EntityInstanceMetadata::lastAccessedTime
Time lastAccessedTime
An optional value indicating the time of last access.
Definition: EntityInstanceBase.h:57
armarx::armem::base::EntityInstanceMetadata::confidence
float confidence
An optional confidence, may be used for things like decay.
Definition: EntityInstanceBase.h:54
armarx::aron::bo
const std::optional< BoT > & bo
Definition: aron_conversions.h:168