diff --git a/source/RobotAPI/components/armem/ArMemExampleClient/ArMemExampleClient.cpp b/source/RobotAPI/components/armem/ArMemExampleClient/ArMemExampleClient.cpp index 4ebf12662861e3b0a2b400630d37dd9ecf6ebf5d..3ba12d84756bf70cdd98449910ea5dd42b0b3473 100644 --- a/source/RobotAPI/components/armem/ArMemExampleClient/ArMemExampleClient.cpp +++ b/source/RobotAPI/components/armem/ArMemExampleClient/ArMemExampleClient.cpp @@ -106,11 +106,8 @@ namespace armarx sleep(2); ARMARX_IMPORTANT << "Running now."; - armem::client::Reader reader(memory); - armem::client::Writer writer(memory); - - armem::MemoryID snapshotID = commitSingleSnapshot(writer, entityID); - commitMultipleSnapshots(writer, entityID, 3); + armem::MemoryID snapshotID = commitSingleSnapshot(entityID); + commitMultipleSnapshots(entityID, 3); if (true) { @@ -118,18 +115,18 @@ namespace armarx } if (true) { - querySnapshot(reader, snapshotID); + querySnapshot(snapshotID); } if (true) { - commitPrimitives(writer); - queryPrimitives(reader); + commitPrimitives(); + queryPrimitives(); } CycleUtil c(500); while (!task->isStopped()) { - commitSingleSnapshot(writer, entityID); + commitSingleSnapshot(entityID); c.waitForCycleDuration(); } } @@ -203,7 +200,7 @@ namespace armarx } } - void ArMemExampleClient::querySnapshot(armem::client::Reader& reader, const armem::MemoryID& snapshotID) + void ArMemExampleClient::querySnapshot(const armem::MemoryID& snapshotID) { ARMARX_IMPORTANT << "Querying exact snapshot of entity: (via query builder)" @@ -217,7 +214,7 @@ namespace armarx .entities().withID(snapshotID) .snapshots().withID(snapshotID); - armem::client::QueryResult qResult = reader.query(qb.buildQueryInput()); + armem::client::QueryResult qResult = memoryReader.query(qb.buildQueryInput()); ARMARX_INFO << "Result: " << "\n- success: \t" << qResult.success << "\n- error message: \t" << qResult.errorMessage @@ -287,7 +284,7 @@ namespace armarx return armem::MemoryID::fromString(result.segmentID); } - armem::MemoryID ArMemExampleClient::commitSingleSnapshot(armem::client::Writer& writer, const armem::MemoryID& entityID) + armem::MemoryID ArMemExampleClient::commitSingleSnapshot(const armem::MemoryID& entityID) { armem::Commit commit; armem::EntityUpdate& update = commit.updates.emplace_back(); @@ -304,7 +301,7 @@ namespace armarx << "Committing:" << "\n- entityID: \t'" << update.entityID.str() << "'" ; - armem::CommitResult commitResult = writer.commit(commit); + armem::CommitResult commitResult = memoryWriter.commit(commit); ARMARX_CHECK_EQUAL(commitResult.results.size(), 1); armem::EntityUpdateResult& result = commitResult.results.at(0); @@ -313,7 +310,7 @@ namespace armarx return result.snapshotID; } - void ArMemExampleClient::commitMultipleSnapshots(armem::client::Writer& writer, const armem::MemoryID& entityID, int num) + void ArMemExampleClient::commitMultipleSnapshots(const armem::MemoryID& entityID, int num) { armem::Commit commit; for (int i = 0; i < num; ++i) @@ -328,16 +325,16 @@ namespace armarx } ARMARX_INFO << "Commiting " << commit.updates.size() << " more updates."; - armem::CommitResult commitResult = writer.commit(commit); + armem::CommitResult commitResult = memoryWriter.commit(commit); ARMARX_CHECK_EQUAL(commitResult.results.size(), commit.updates.size()); } - void ArMemExampleClient::commitPrimitives(armem::client::Writer& writer) + void ArMemExampleClient::commitPrimitives() { ARMARX_IMPORTANT << "Adding segment " << "Primitive" << "/" << getName(); - auto addSegmentResult = writer.addSegment("Primitive", getName()); + auto addSegmentResult = memoryWriter.addSegment("Primitive", getName()); if (!addSegmentResult.success) { ARMARX_ERROR << addSegmentResult.errorMessage; @@ -373,14 +370,14 @@ namespace armarx update.instancesData = { primitive.toAron() }; } - armem::CommitResult commitResult = writer.commit(commit); + armem::CommitResult commitResult = memoryWriter.commit(commit); if (!commitResult.allSuccess()) { ARMARX_WARNING << commitResult.allErrorMessages(); } } - void ArMemExampleClient::queryPrimitives(armem::client::Reader& reader) + void ArMemExampleClient::queryPrimitives() { // Query all entities from provider. armem::client::QueryBuilder qb; @@ -390,7 +387,7 @@ namespace armarx .entities().all() .snapshots().all(); - armem::client::QueryResult result = reader.query(qb.buildQueryInput()); + armem::client::QueryResult result = memoryReader.query(qb.buildQueryInput()); if (result) { tab.queryResult = std::move(result.memory); diff --git a/source/RobotAPI/components/armem/ArMemExampleClient/ArMemExampleClient.h b/source/RobotAPI/components/armem/ArMemExampleClient/ArMemExampleClient.h index 789dcaf50d73eb0def6f53b01bc5590d4b816876..1ff6d97d36d552dfeb77bb17a0870b4e2d135929 100644 --- a/source/RobotAPI/components/armem/ArMemExampleClient/ArMemExampleClient.h +++ b/source/RobotAPI/components/armem/ArMemExampleClient/ArMemExampleClient.h @@ -112,14 +112,14 @@ namespace armarx void waitForMemory(); armem::MemoryID addProviderSegment(); - armem::MemoryID commitSingleSnapshot(armem::client::Writer& writer, const armem::MemoryID& entityID); - void commitMultipleSnapshots(armem::client::Writer& writer, const armem::MemoryID& entityID, int num = 3); + armem::MemoryID commitSingleSnapshot(const armem::MemoryID& entityID); + void commitMultipleSnapshots(const armem::MemoryID& entityID, int num = 3); void queryLatestRawIce(const armem::MemoryID& entityID); - void querySnapshot(armem::client::Reader& reader, const armem::MemoryID& snapshotID); + void querySnapshot(const armem::MemoryID& snapshotID); - void commitPrimitives(armem::client::Writer& writer); - void queryPrimitives(armem::client::Reader& reader); + void commitPrimitives(); + void queryPrimitives(); private: diff --git a/source/RobotAPI/interface/CMakeLists.txt b/source/RobotAPI/interface/CMakeLists.txt index 09a7502102c009e07733934a998385dc5703a9db..47dce8075cc3bcf7e80db2273f2a663268e91b3e 100644 --- a/source/RobotAPI/interface/CMakeLists.txt +++ b/source/RobotAPI/interface/CMakeLists.txt @@ -103,8 +103,8 @@ set(SLICE_FILES aron/Aron.ice armem.ice - armem/ReadingInterface.ice - armem/WritingInterface.ice + armem/ReadingMemoryInterface.ice + armem/WritingMemoryInterface.ice armem/MemoryInterface.ice armem/MemoryListenerInterface.ice armem/MemoryNameSystemInterface.ice diff --git a/source/RobotAPI/interface/armem.ice b/source/RobotAPI/interface/armem.ice index a01037e52a60b33cf9422b5c69b61eeb858a4e44..c86d4d5fb6588a716a5b1f4cfe0cdbab29066bb8 100644 --- a/source/RobotAPI/interface/armem.ice +++ b/source/RobotAPI/interface/armem.ice @@ -1,7 +1,7 @@ #pragma once -#include <RobotAPI/interface/armem/ReadingInterface.ice> -#include <RobotAPI/interface/armem/WritingInterface.ice> +#include <RobotAPI/interface/armem/ReadingMemoryInterface.ice> +#include <RobotAPI/interface/armem/WritingMemoryInterface.ice> #include <RobotAPI/interface/armem/MemoryInterface.ice> #include <RobotAPI/interface/armem/MemoryListenerInterface.ice> diff --git a/source/RobotAPI/interface/armem/MemoryInterface.ice b/source/RobotAPI/interface/armem/MemoryInterface.ice index 90be8cb274e8fa2f136c1fb63b316e2ca6700c1d..b44718d2285757e67c4edf59d8b21f41b7b97d7b 100644 --- a/source/RobotAPI/interface/armem/MemoryInterface.ice +++ b/source/RobotAPI/interface/armem/MemoryInterface.ice @@ -1,7 +1,7 @@ #pragma once -#include <RobotAPI/interface/armem/ReadingInterface.ice> -#include <RobotAPI/interface/armem/WritingInterface.ice> +#include <RobotAPI/interface/armem/ReadingMemoryInterface.ice> +#include <RobotAPI/interface/armem/WritingMemoryInterface.ice> module armarx @@ -9,7 +9,7 @@ module armarx module armem { - interface MemoryInterface extends ReadingInterface, WritingInterface + interface MemoryInterface extends ReadingMemoryInterface, WritingMemoryInterface { }; diff --git a/source/RobotAPI/interface/armem/ReadingInterface.ice b/source/RobotAPI/interface/armem/ReadingMemoryInterface.ice similarity index 82% rename from source/RobotAPI/interface/armem/ReadingInterface.ice rename to source/RobotAPI/interface/armem/ReadingMemoryInterface.ice index a50056efb2fa78671f62e6173296d352affb5e07..e38e3dc44fd96b76b218c634229a4dcbca8ef4e7 100644 --- a/source/RobotAPI/interface/armem/ReadingInterface.ice +++ b/source/RobotAPI/interface/armem/ReadingMemoryInterface.ice @@ -8,7 +8,7 @@ module armarx module armem { - interface ReadingInterface + interface ReadingMemoryInterface { data::QueryResult query(data::QueryInput input); }; diff --git a/source/RobotAPI/interface/armem/WritingInterface.ice b/source/RobotAPI/interface/armem/WritingMemoryInterface.ice similarity index 91% rename from source/RobotAPI/interface/armem/WritingInterface.ice rename to source/RobotAPI/interface/armem/WritingMemoryInterface.ice index 902e80dded2f9717bd3570ca3dd1051b308b3fd0..068fe2429cf2ae09bc5e6cacf5c8343fa5e713df 100644 --- a/source/RobotAPI/interface/armem/WritingInterface.ice +++ b/source/RobotAPI/interface/armem/WritingMemoryInterface.ice @@ -1,5 +1,7 @@ #pragma once + +#include <RobotAPI/interface/armem/memory.ice> #include <RobotAPI/interface/aron.ice> @@ -30,7 +32,7 @@ module armarx struct EntityUpdate { - string entityID; + MemoryID entityID; aron::data::AronDataList instancesData; long timeCreatedMicroSeconds; @@ -43,7 +45,7 @@ module armarx { bool success = false; - string snapshotID; + MemoryID snapshotID; long timeArrivedMicroSeconds; string errorMessage; @@ -61,7 +63,7 @@ module armarx } - interface WritingInterface + interface WritingMemoryInterface { /// Register multiple core or provider segments. data::AddSegmentsResult addSegments(data::AddSegmentsInput input); diff --git a/source/RobotAPI/libraries/armem/CMakeLists.txt b/source/RobotAPI/libraries/armem/CMakeLists.txt index e93b5017214036c1e781e82741de96c57e01a971..ef0d4e6cbfaddcb6f7a11de1c92d2366d326b273 100644 --- a/source/RobotAPI/libraries/armem/CMakeLists.txt +++ b/source/RobotAPI/libraries/armem/CMakeLists.txt @@ -51,7 +51,7 @@ set(LIB_FILES client/QueryBuilder.cpp client/query/selectors.cpp - component/IceMemory.cpp + component/MemoryToIceAdapter.cpp component/MemoryComponentPlugin.cpp component/MemoryRemoteGui.cpp component/RemoteGuiAronDataVisitor.cpp @@ -109,7 +109,7 @@ set(LIB_HEADERS client/query/query_fns.h client/query/selectors.h - component/IceMemory.h + component/MemoryToIceAdapter.h component/MemoryComponentPlugin.h component/MemoryRemoteGui.h component/RemoteGuiAronDataVisitor.h diff --git a/source/RobotAPI/libraries/armem/client/QueryBuilder.h b/source/RobotAPI/libraries/armem/client/QueryBuilder.h index dcfd855cc064a6addccf7b3b57c64c0b9789b4ca..2e38d09865a192123f30f061fdadeeef42d8eee5 100644 --- a/source/RobotAPI/libraries/armem/client/QueryBuilder.h +++ b/source/RobotAPI/libraries/armem/client/QueryBuilder.h @@ -1,7 +1,6 @@ #pragma once #include <RobotAPI/interface/armem/query.h> -#include <RobotAPI/interface/armem/ReadingInterface.h> #include "../core/DataMode.h" #include "Query.h" diff --git a/source/RobotAPI/libraries/armem/client/Reader.cpp b/source/RobotAPI/libraries/armem/client/Reader.cpp index e0869b987cfb6d4280706716666ced809c8aec4f..558703dcc1cc1110dc244b6f596cb220d7996f31 100644 --- a/source/RobotAPI/libraries/armem/client/Reader.cpp +++ b/source/RobotAPI/libraries/armem/client/Reader.cpp @@ -9,7 +9,7 @@ namespace armarx::armem::client { - Reader::Reader(ReadingInterfacePrx memory) : memory(memory) + Reader::Reader(ReadingMemoryInterfacePrx memory) : memory(memory) { } @@ -112,7 +112,7 @@ namespace armarx::armem::client void - Reader::setReadingMemory(ReadingInterfacePrx memory) + Reader::setReadingMemory(ReadingMemoryInterfacePrx memory) { this->memory = memory; } diff --git a/source/RobotAPI/libraries/armem/client/Reader.h b/source/RobotAPI/libraries/armem/client/Reader.h index fe293ddbabdf4aaca6856db5bd6fb99dfbe21e04..2a7e4f4c1101b5924f11f9e52faebbc8cad79dcf 100644 --- a/source/RobotAPI/libraries/armem/client/Reader.h +++ b/source/RobotAPI/libraries/armem/client/Reader.h @@ -7,7 +7,7 @@ #include <vector> // RobotAPI -#include <RobotAPI/interface/armem/ReadingInterface.h> +#include <RobotAPI/interface/armem/ReadingMemoryInterface.h> #include <RobotAPI/interface/armem/MemoryListenerInterface.h> #include <RobotAPI/libraries/armem/core/ice_conversions.h> #include <RobotAPI/libraries/armem/memory/Memory.h> @@ -32,7 +32,7 @@ namespace armarx::armem::client * @brief Construct a memory reader. * @param memory The memory proxy. */ - Reader(ReadingInterfacePrx memory = nullptr); + Reader(ReadingMemoryInterfacePrx memory = nullptr); QueryResult query(const QueryInput& input); @@ -50,7 +50,7 @@ namespace armarx::armem::client void subscribe(const MemoryID& entityID, callback callback); - void setReadingMemory(ReadingInterfacePrx memory); + void setReadingMemory(ReadingMemoryInterfacePrx memory); operator bool() const { @@ -59,7 +59,7 @@ namespace armarx::armem::client public: - ReadingInterfacePrx memory; + ReadingMemoryInterfacePrx memory; private: diff --git a/source/RobotAPI/libraries/armem/client/ReaderComponentPlugin.cpp b/source/RobotAPI/libraries/armem/client/ReaderComponentPlugin.cpp index d7eeff0feb7bda07299ce6791643feef38980284..fca6d9442ba419d26a3d6ca9cda23ad90ebb436c 100644 --- a/source/RobotAPI/libraries/armem/client/ReaderComponentPlugin.cpp +++ b/source/RobotAPI/libraries/armem/client/ReaderComponentPlugin.cpp @@ -45,7 +45,7 @@ armarx::armem::client::ReaderComponentPluginUser::memoryUpdated( void -armarx::armem::client::ReaderComponentPluginUser::setReadingMemory(ReadingInterfacePrx memory) +armarx::armem::client::ReaderComponentPluginUser::setReadingMemory(ReadingMemoryInterfacePrx memory) { memoryReader.setReadingMemory(memory); } diff --git a/source/RobotAPI/libraries/armem/client/ReaderComponentPlugin.h b/source/RobotAPI/libraries/armem/client/ReaderComponentPlugin.h index 66c3cd3631560ba21e441edf10adf191c0a758d1..4ed9bea8fa74e455c2ccf976eb00d97b0828295c 100644 --- a/source/RobotAPI/libraries/armem/client/ReaderComponentPlugin.h +++ b/source/RobotAPI/libraries/armem/client/ReaderComponentPlugin.h @@ -49,7 +49,7 @@ namespace armarx::armem::client protected: - void setReadingMemory(ReadingInterfacePrx memory); + void setReadingMemory(ReadingMemoryInterfacePrx memory); protected: diff --git a/source/RobotAPI/libraries/armem/client/Writer.cpp b/source/RobotAPI/libraries/armem/client/Writer.cpp index c7a14a15d4816e1991337c41f321188ed18ede5e..f506221179100c532d71d341b1462fa8273d5951 100644 --- a/source/RobotAPI/libraries/armem/client/Writer.cpp +++ b/source/RobotAPI/libraries/armem/client/Writer.cpp @@ -8,7 +8,7 @@ namespace armarx::armem::client { - Writer::Writer(WritingInterfacePrx memory) : memory(memory) + Writer::Writer(WritingMemoryInterfacePrx memory) : memory(memory) { } @@ -108,7 +108,7 @@ namespace armarx::armem::client void - Writer::setWritingMemory(WritingInterfacePrx memory) + Writer::setWritingMemory(WritingMemoryInterfacePrx memory) { this->memory = memory; } diff --git a/source/RobotAPI/libraries/armem/client/Writer.h b/source/RobotAPI/libraries/armem/client/Writer.h index 7ed6e44a3964e4003c69e36cba1b4855d699f3fc..67e7f57d0ff3733ebf6d2e7a007309875ba5c03e 100644 --- a/source/RobotAPI/libraries/armem/client/Writer.h +++ b/source/RobotAPI/libraries/armem/client/Writer.h @@ -1,6 +1,6 @@ #pragma once -#include <RobotAPI/interface/armem/WritingInterface.h> +#include <RobotAPI/interface/armem/WritingMemoryInterface.h> #include <RobotAPI/libraries/armem/core/ice_conversions.h> @@ -19,7 +19,7 @@ namespace armarx::armem::client * @brief Construct a memory writer. * @param memory The memory proxy. */ - Writer(WritingInterfacePrx memory = nullptr); + Writer(WritingMemoryInterfacePrx memory = nullptr); data::AddSegmentResult addSegment(const std::string& coreSegmentName, const std::string& providerSegmentName); @@ -33,7 +33,7 @@ namespace armarx::armem::client EntityUpdateResult commit(const EntityUpdate& update); - void setWritingMemory(WritingInterfacePrx memory); + void setWritingMemory(WritingMemoryInterfacePrx memory); operator bool() const { @@ -46,7 +46,7 @@ namespace armarx::armem::client public: - WritingInterfacePrx memory; + WritingMemoryInterfacePrx memory; }; diff --git a/source/RobotAPI/libraries/armem/client/WriterComponentPlugin.cpp b/source/RobotAPI/libraries/armem/client/WriterComponentPlugin.cpp index f5c648090570b5eb0a1bf4cf6947efdce2aed9d7..5ed4dc1f79cd130f5090411c413bd5a8122c4df3 100644 --- a/source/RobotAPI/libraries/armem/client/WriterComponentPlugin.cpp +++ b/source/RobotAPI/libraries/armem/client/WriterComponentPlugin.cpp @@ -27,7 +27,7 @@ armarx::armem::client::WriterComponentPluginUser::~WriterComponentPluginUser() void -armarx::armem::client::WriterComponentPluginUser::setWritingMemory(WritingInterfacePrx memory) +armarx::armem::client::WriterComponentPluginUser::setWritingMemory(WritingMemoryInterfacePrx memory) { memoryWriter.setWritingMemory(memory); } diff --git a/source/RobotAPI/libraries/armem/client/WriterComponentPlugin.h b/source/RobotAPI/libraries/armem/client/WriterComponentPlugin.h index f93c9a230e26c00bd7d89d51cd37e2afd83ca27f..4f3eeb3bdcbd474bab5c1d068d31d50dc6d66f56 100644 --- a/source/RobotAPI/libraries/armem/client/WriterComponentPlugin.h +++ b/source/RobotAPI/libraries/armem/client/WriterComponentPlugin.h @@ -38,7 +38,7 @@ namespace armarx::armem::client protected: - void setWritingMemory(WritingInterfacePrx memory); + void setWritingMemory(WritingMemoryInterfacePrx memory); protected: diff --git a/source/RobotAPI/libraries/armem/component/MemoryComponentPlugin.cpp b/source/RobotAPI/libraries/armem/component/MemoryComponentPlugin.cpp index 47f1d8eee1187917c59b00b5c27de575c839f2d1..fdb50c345ef4f0c33538c04b80483c6bd1427287 100644 --- a/source/RobotAPI/libraries/armem/component/MemoryComponentPlugin.cpp +++ b/source/RobotAPI/libraries/armem/component/MemoryComponentPlugin.cpp @@ -4,7 +4,7 @@ #include "../error.h" -#include "IceMemory.h" +#include "MemoryToIceAdapter.h" namespace armarx::armem::plugins diff --git a/source/RobotAPI/libraries/armem/component/MemoryComponentPlugin.h b/source/RobotAPI/libraries/armem/component/MemoryComponentPlugin.h index 89a56ae141c51c733144de66c277a594fe2dbe3b..82aaf5bc8b485463005000492d665feb92134307 100644 --- a/source/RobotAPI/libraries/armem/component/MemoryComponentPlugin.h +++ b/source/RobotAPI/libraries/armem/component/MemoryComponentPlugin.h @@ -10,7 +10,7 @@ #include "../memory/Memory.h" #include "../mns/MemoryNameSystemClientPlugin.h" -#include "IceMemory.h" +#include "MemoryToIceAdapter.h" namespace armarx::armem @@ -88,7 +88,7 @@ namespace armarx::armem Memory memory; /// Helps connecting `memory` to ice. Used to handle Ice callbacks. - IceMemory iceMemory { &memory }; + MemoryToIceAdapter iceMemory { &memory }; private: diff --git a/source/RobotAPI/libraries/armem/component/MemoryRemoteGui.cpp b/source/RobotAPI/libraries/armem/component/MemoryRemoteGui.cpp index 6d818d55d9c921affb822c4df0836ce37263a126..46b53f7684bfeaf3e19a1c947bd631028c0f31e3 100644 --- a/source/RobotAPI/libraries/armem/component/MemoryRemoteGui.cpp +++ b/source/RobotAPI/libraries/armem/component/MemoryRemoteGui.cpp @@ -1,7 +1,5 @@ #include "MemoryRemoteGui.h" -#include <stack> - #include <ArmarXCore/core/exceptions/local/ExpressionException.h> #include <RobotAPI/libraries/aron/aroncore/navigators/datanavigator/AronAllDataNavigators.h> diff --git a/source/RobotAPI/libraries/armem/component/IceMemory.cpp b/source/RobotAPI/libraries/armem/component/MemoryToIceAdapter.cpp similarity index 82% rename from source/RobotAPI/libraries/armem/component/IceMemory.cpp rename to source/RobotAPI/libraries/armem/component/MemoryToIceAdapter.cpp index 076e754a4886b3f952d291bf866a516f303ea001..7bee07e7b0f9d1a5f6c686542c70f82df31493fc 100644 --- a/source/RobotAPI/libraries/armem/component/IceMemory.cpp +++ b/source/RobotAPI/libraries/armem/component/MemoryToIceAdapter.cpp @@ -1,4 +1,4 @@ -#include "IceMemory.h" +#include "MemoryToIceAdapter.h" #include <ArmarXCore/core/exceptions/local/ExpressionException.h> @@ -10,12 +10,12 @@ namespace armarx::armem { - IceMemory::IceMemory(Memory* memory) : memory(memory) + MemoryToIceAdapter::MemoryToIceAdapter(Memory* memory) : memory(memory) { } - void IceMemory::setMemoryListener(MemoryListenerInterfacePrx memoryListener) + void MemoryToIceAdapter::setMemoryListener(MemoryListenerInterfacePrx memoryListener) { this->memoryListener = memoryListener; } @@ -23,7 +23,7 @@ namespace armarx::armem // WRITING - armem::data::AddSegmentResult IceMemory::addSegment(const armem::data::AddSegmentInput& input, bool addCoreSegments) + armem::data::AddSegmentResult MemoryToIceAdapter::addSegment(const armem::data::AddSegmentInput& input, bool addCoreSegments) { ARMARX_DEBUG << "Adding segment '" << input.coreSegmentName << "/" << input.providerSegmentName << "'."; ARMARX_CHECK_NOT_NULL(memory); @@ -78,7 +78,7 @@ namespace armarx::armem } - armem::data::AddSegmentsResult IceMemory::addSegments(const armem::data::AddSegmentsInput& input, bool addCoreSegments) + armem::data::AddSegmentsResult MemoryToIceAdapter::addSegments(const armem::data::AddSegmentsInput& input, bool addCoreSegments) { ARMARX_CHECK_NOT_NULL(memory); @@ -90,7 +90,7 @@ namespace armarx::armem return output; } - armem::data::CommitResult IceMemory::commit(const armem::data::Commit& commitIce, Time timeArrived) + armem::data::CommitResult MemoryToIceAdapter::commit(const armem::data::Commit& commitIce, Time timeArrived) { ARMARX_CHECK_NOT_NULL(memory); @@ -105,13 +105,13 @@ namespace armarx::armem } - armem::data::CommitResult IceMemory::commit(const armem::data::Commit& commitIce) + armem::data::CommitResult MemoryToIceAdapter::commit(const armem::data::Commit& commitIce) { return commit(commitIce, armem::Time::now()); } - armem::CommitResult IceMemory::commit(const armem::InternalCommit& commit) + armem::CommitResult MemoryToIceAdapter::commit(const armem::InternalCommit& commit) { std::vector<data::MemoryID> updatedIDs; const bool publishUpdates = memoryListener; @@ -152,7 +152,7 @@ namespace armarx::armem // READING - armem::data::QueryResult IceMemory::query(const armem::data::QueryInput& input) + armem::data::QueryResult MemoryToIceAdapter::query(const armem::data::QueryInput& input) { ARMARX_CHECK_NOT_NULL(memory); diff --git a/source/RobotAPI/libraries/armem/component/IceMemory.h b/source/RobotAPI/libraries/armem/component/MemoryToIceAdapter.h similarity index 88% rename from source/RobotAPI/libraries/armem/component/IceMemory.h rename to source/RobotAPI/libraries/armem/component/MemoryToIceAdapter.h index 9c257d2c0915e41811391ae69ecf454eb8d7f8ea..fbd41bd4a39b46cbc5ee5ea5df22814e29412f88 100644 --- a/source/RobotAPI/libraries/armem/component/IceMemory.h +++ b/source/RobotAPI/libraries/armem/component/MemoryToIceAdapter.h @@ -16,13 +16,12 @@ namespace armarx::armem * This involves conversion of ice types to C++ types as well as * catchin exceptions and converting them to error messages */ - // ToDo: Rename to MemoryToIceAdapter - class IceMemory + class MemoryToIceAdapter { public: - /// Construct an IceMemory from an existing Memory. - IceMemory(Memory* memory = nullptr); + /// Construct an MemoryToIceAdapter from an existing Memory. + MemoryToIceAdapter(Memory* memory = nullptr); void setMemoryListener(MemoryListenerInterfacePrx memoryListener); diff --git a/source/RobotAPI/libraries/armem/component/RemoteGuiAronDataVisitor.h b/source/RobotAPI/libraries/armem/component/RemoteGuiAronDataVisitor.h index c009416a7068706d88ea93cad079d439650091cc..ebc924ba06395a640d31d950d0cd5b66b7806a4c 100644 --- a/source/RobotAPI/libraries/armem/component/RemoteGuiAronDataVisitor.h +++ b/source/RobotAPI/libraries/armem/component/RemoteGuiAronDataVisitor.h @@ -96,7 +96,10 @@ namespace armarx::armem template <class Navigator> void addValueLabel(Navigator& n, const std::string& typeName) { - groups.top().addChild(Label(this->makeValueLabelText(n, typeName))); + if (not groups.empty()) + { + groups.top().addChild(Label(this->makeValueLabelText(n, typeName))); + } } template <class Navigator> std::string makeValueLabelText(Navigator& n, const std::string& typeName) diff --git a/source/RobotAPI/libraries/armem/core/ice_conversions.cpp b/source/RobotAPI/libraries/armem/core/ice_conversions.cpp index a5bed94aadc790b46e887056b74537a99b59daa2..24defd3c195d6841621be01fe5eb60818e6a24ec 100644 --- a/source/RobotAPI/libraries/armem/core/ice_conversions.cpp +++ b/source/RobotAPI/libraries/armem/core/ice_conversions.cpp @@ -81,7 +81,7 @@ namespace armarx void armem::fromIce(const data::EntityUpdate& ice, EntityUpdate& update) { - update.entityID = MemoryID::fromString(ice.entityID); + fromIce(ice.entityID, update.entityID); update.instancesData = aron::datanavigator::AronDataNavigator::FromAronData(ice.instancesData); update.timeCreated = Time::microSeconds(ice.timeCreatedMicroSeconds); @@ -92,7 +92,8 @@ namespace armarx void armem::toIce(data::EntityUpdate& ice, const EntityUpdate& update) { - ice.entityID = update.entityID.str(); + toIce(ice.entityID, update.entityID); + ice.instancesData = aron::datanavigator::AronDataNavigator::ToAronData(update.instancesData); ice.timeCreatedMicroSeconds = update.timeCreated.toMicroSeconds(); @@ -104,7 +105,7 @@ namespace armarx void armem::fromIce(const data::EntityUpdateResult& ice, EntityUpdateResult& result) { result.success = ice.success; - result.snapshotID = MemoryID::fromString(ice.snapshotID); + fromIce(ice.snapshotID, result.snapshotID); result.timeArrived = Time::microSeconds(ice.timeArrivedMicroSeconds); result.errorMessage = ice.errorMessage; } @@ -112,7 +113,7 @@ namespace armarx void armem::toIce(data::EntityUpdateResult& ice, const EntityUpdateResult& result) { ice.success = result.success; - ice.snapshotID = result.snapshotID.str(); + toIce(ice.snapshotID, result.snapshotID); ice.timeArrivedMicroSeconds = result.timeArrived.toMicroSeconds(); ice.errorMessage = result.errorMessage; }