From cad18d9eb222f6d2412b2cc5883f304999dc2e0f Mon Sep 17 00:00:00 2001 From: Rainer Kartmann <rainer.kartmann@kit.edu> Date: Wed, 13 Jan 2021 09:09:46 +0100 Subject: [PATCH] Use AronDataNavigator instead of AronData in EntityUpdate --- source/RobotAPI/libraries/armem/core/Commit.cpp | 12 ------------ source/RobotAPI/libraries/armem/core/Commit.h | 7 +------ .../libraries/armem/core/ice_conversions.cpp | 4 ++-- .../libraries/armem/memory/EntityInstance.cpp | 2 +- .../libraries/armem/test/ArMemMemoryTest.cpp | 11 +++++++---- 5 files changed, 11 insertions(+), 25 deletions(-) diff --git a/source/RobotAPI/libraries/armem/core/Commit.cpp b/source/RobotAPI/libraries/armem/core/Commit.cpp index 5a52cc508..838205dd0 100644 --- a/source/RobotAPI/libraries/armem/core/Commit.cpp +++ b/source/RobotAPI/libraries/armem/core/Commit.cpp @@ -34,16 +34,4 @@ namespace armarx::armem }, results); } - - std::vector<aron::datanavigator::AronDataNavigatorPtr> EntityUpdate::getInstancesDataNavigator() const - { - return aron::datanavigator::AronDataNavigator::FromAronData(instancesData); - } - - aron::datanavigator::AronDataNavigatorPtr EntityUpdate::getInstanceDataNavigator(size_t index) const - { - ARMARX_CHECK_FITS_SIZE(index, instancesData.size()); - return aron::datanavigator::AronDataNavigator::FromAronData(instancesData.at(index)); - } - } diff --git a/source/RobotAPI/libraries/armem/core/Commit.h b/source/RobotAPI/libraries/armem/core/Commit.h index db5ade523..6361aa97c 100644 --- a/source/RobotAPI/libraries/armem/core/Commit.h +++ b/source/RobotAPI/libraries/armem/core/Commit.h @@ -2,7 +2,6 @@ #include <vector> -#include <RobotAPI/interface/aron.h> #include <RobotAPI/libraries/aron/aroncore/navigators/datanavigator/AronDataNavigator.h> #include "../core/MemoryID.h" @@ -21,7 +20,7 @@ namespace armarx::armem MemoryID entityID; /// The entity data. - std::vector<::armarx::aron::data::AronDataPtr> instancesData; + std::vector<aron::datanavigator::AronDataNavigatorPtr> instancesData; /** * @brief Time when this entity update was created (e.g. time of image recording). @@ -45,10 +44,6 @@ namespace armarx::armem */ Time timeSent = Time::microSeconds(-1); - - std::vector<aron::datanavigator::AronDataNavigatorPtr> getInstancesDataNavigator() const; - aron::datanavigator::AronDataNavigatorPtr getInstanceDataNavigator(size_t index) const; - }; diff --git a/source/RobotAPI/libraries/armem/core/ice_conversions.cpp b/source/RobotAPI/libraries/armem/core/ice_conversions.cpp index f5913fad7..a5bed94aa 100644 --- a/source/RobotAPI/libraries/armem/core/ice_conversions.cpp +++ b/source/RobotAPI/libraries/armem/core/ice_conversions.cpp @@ -83,7 +83,7 @@ namespace armarx { update.entityID = MemoryID::fromString(ice.entityID); - update.instancesData = ice.instancesData; + update.instancesData = aron::datanavigator::AronDataNavigator::FromAronData(ice.instancesData); update.timeCreated = Time::microSeconds(ice.timeCreatedMicroSeconds); update.confidence = ice.confidence; @@ -93,7 +93,7 @@ namespace armarx void armem::toIce(data::EntityUpdate& ice, const EntityUpdate& update) { ice.entityID = update.entityID.str(); - ice.instancesData = update.instancesData; + ice.instancesData = aron::datanavigator::AronDataNavigator::ToAronData(update.instancesData); ice.timeCreatedMicroSeconds = update.timeCreated.toMicroSeconds(); ice.confidence = update.confidence; diff --git a/source/RobotAPI/libraries/armem/memory/EntityInstance.cpp b/source/RobotAPI/libraries/armem/memory/EntityInstance.cpp index 469aea44a..12810b26e 100644 --- a/source/RobotAPI/libraries/armem/memory/EntityInstance.cpp +++ b/source/RobotAPI/libraries/armem/memory/EntityInstance.cpp @@ -33,7 +33,7 @@ namespace armarx::armem ARMARX_CHECK_FITS_SIZE(index, update.instancesData.size()); this->index() = index; - setData(update.getInstanceDataNavigator(size_t(index))); + setData(update.instancesData.at(size_t(index))); this->_metadata.confidence = update.confidence; diff --git a/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp b/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp index f58f4a9b9..e0e62360b 100644 --- a/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp +++ b/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp @@ -25,10 +25,13 @@ #define ARMARX_BOOST_TEST #include <RobotAPI/Test.h> + #include "../memory/Memory.h" #include "../error/ArMemError.h" + #include <iostream> +#include <RobotAPI/libraries/aron/aroncore/navigators/datanavigator/AronPrimitiveDataNavigator.h> namespace armem = armarx::armem; @@ -111,8 +114,8 @@ BOOST_AUTO_TEST_CASE(test_segment_setup) update.entityID = armem::MemoryID::fromString("Memory/ImageRGB/SomeRGBImageProvider/image"); update.instancesData = { - aron::data::AronDataPtr(new aron::data::AronData()), - aron::data::AronDataPtr(new aron::data::AronData()) + std::make_shared<aron::datanavigator::AronIntDataNavigator>(), + std::make_shared<aron::datanavigator::AronIntDataNavigator>() }; update.timeCreated = armem::Time::milliSeconds(1000); BOOST_CHECK_NO_THROW(providerSegment.update(update)); @@ -132,7 +135,7 @@ BOOST_AUTO_TEST_CASE(test_segment_setup) // Another update (on memory). - update.instancesData = { aron::data::AronDataPtr(new aron::data::AronData()) }; + update.instancesData = { std::make_shared<aron::datanavigator::AronIntDataNavigator>() }; update.timeCreated = armem::Time::milliSeconds(2000); memory->update(update); BOOST_CHECK_EQUAL(entity.history.size(), 2); @@ -141,7 +144,7 @@ BOOST_AUTO_TEST_CASE(test_segment_setup) // A third update (on entity). - update.instancesData = { aron::data::AronDataPtr(new aron::data::AronData()) }; + update.instancesData = { std::make_shared<aron::datanavigator::AronIntDataNavigator>() }; update.timeCreated = armem::Time::milliSeconds(3000); entity.update(update); BOOST_CHECK_EQUAL(entity.history.size(), 3); -- GitLab