diff --git a/source/RobotAPI/libraries/armem/core/base/EntitySnapshotBase.h b/source/RobotAPI/libraries/armem/core/base/EntitySnapshotBase.h index db1370f1ba081bfc35466698bdb70f9b5b07193d..defdf1c049fa5274b0d112f42d78037730d9eff5 100644 --- a/source/RobotAPI/libraries/armem/core/base/EntitySnapshotBase.h +++ b/source/RobotAPI/libraries/armem/core/base/EntitySnapshotBase.h @@ -43,18 +43,10 @@ namespace armarx::armem::base { } - /* - EntitySnapshotBase(const EntitySnapshotBase& other) : - Base(other) - { - } - - EntitySnapshotBase& operator=(const EntitySnapshotBase& other) - { - Base::operator=(other); - return *this; - } - */ + EntitySnapshotBase(const EntitySnapshotBase& other) = default; + EntitySnapshotBase(EntitySnapshotBase&& other) = default; + EntitySnapshotBase& operator=(const EntitySnapshotBase& other) = default; + EntitySnapshotBase& operator=(EntitySnapshotBase&& other) = default; virtual bool equalsDeep(const EntitySnapshotBase& other) const diff --git a/source/RobotAPI/libraries/armem/core/base/detail/MemoryContainerBase.h b/source/RobotAPI/libraries/armem/core/base/detail/MemoryContainerBase.h index 9a0804171c8f64982bffb952b447b43a6ee0bd6a..b2155c70dbf645ebe0e2783fd3189bf9b58800af 100644 --- a/source/RobotAPI/libraries/armem/core/base/detail/MemoryContainerBase.h +++ b/source/RobotAPI/libraries/armem/core/base/detail/MemoryContainerBase.h @@ -34,6 +34,11 @@ namespace armarx::armem::base::detail { } + MemoryContainerBase(const MemoryContainerBase& other) = default; + MemoryContainerBase(MemoryContainerBase&& other) = default; + MemoryContainerBase& operator=(const MemoryContainerBase& other) = default; + MemoryContainerBase& operator=(MemoryContainerBase&& other) = default; + // Container methods diff --git a/source/RobotAPI/libraries/armem/core/diskmemory/EntitySnapshot.cpp b/source/RobotAPI/libraries/armem/core/diskmemory/EntitySnapshot.cpp index 8de49551aeeea65331240123b3c3e8c5e72c003d..199e4f2c9b9eed9d9b099e773d96ba0a03fd7d16 100644 --- a/source/RobotAPI/libraries/armem/core/diskmemory/EntitySnapshot.cpp +++ b/source/RobotAPI/libraries/armem/core/diskmemory/EntitySnapshot.cpp @@ -8,18 +8,6 @@ namespace armarx::armem::d_ltm { - EntitySnapshot::EntitySnapshot(const EntitySnapshot& other) : - Base(other), - path(other.path) - { - } - - EntitySnapshot& EntitySnapshot::operator=(const EntitySnapshot& other) - { - other._copySelf(*this); - return *this; - } - std::filesystem::path EntitySnapshot::_fullPath() const { if (path) diff --git a/source/RobotAPI/libraries/armem/core/diskmemory/EntitySnapshot.h b/source/RobotAPI/libraries/armem/core/diskmemory/EntitySnapshot.h index d3402d634218d9afaffd46aa5c0bf62525b9f1f7..f73702857fc6700e5cfae5f6d08b369240d08f79 100644 --- a/source/RobotAPI/libraries/armem/core/diskmemory/EntitySnapshot.h +++ b/source/RobotAPI/libraries/armem/core/diskmemory/EntitySnapshot.h @@ -22,9 +22,8 @@ namespace armarx::armem::d_ltm public: using Base::EntitySnapshotBase; + using Base::operator=; - EntitySnapshot(const EntitySnapshot& other); - EntitySnapshot& operator=(const EntitySnapshot& other); // Conversion void reload(const std::shared_ptr<std::filesystem::path>&); diff --git a/source/RobotAPI/libraries/armem/core/longtermmemory/EntitySnapshot.cpp b/source/RobotAPI/libraries/armem/core/longtermmemory/EntitySnapshot.cpp index e89154efcf545b34b6c91e355b384d21df59be3e..73d4932155562ffe213504ce3b7bccfc93690b51 100644 --- a/source/RobotAPI/libraries/armem/core/longtermmemory/EntitySnapshot.cpp +++ b/source/RobotAPI/libraries/armem/core/longtermmemory/EntitySnapshot.cpp @@ -8,12 +8,6 @@ namespace armarx::armem::ltm { - EntitySnapshot& EntitySnapshot::operator=(const EntitySnapshot& other) - { - other._copySelf(*this); - return *this; - } - wm::EntitySnapshot EntitySnapshot::convert() const { wm::EntitySnapshot m; diff --git a/source/RobotAPI/libraries/armem/core/longtermmemory/EntitySnapshot.h b/source/RobotAPI/libraries/armem/core/longtermmemory/EntitySnapshot.h index bea3c55b7981f1c4a43f15a3fe931df8043b3a9e..79c0341643c4619270e6b264454ce50dffd0a202 100644 --- a/source/RobotAPI/libraries/armem/core/longtermmemory/EntitySnapshot.h +++ b/source/RobotAPI/libraries/armem/core/longtermmemory/EntitySnapshot.h @@ -21,9 +21,8 @@ namespace armarx::armem::ltm public: using Base::EntitySnapshotBase; + using Base::operator=; - /// Copy the instances from `other` to this. - EntitySnapshot& operator=(const EntitySnapshot& other); // Conversion wm::EntitySnapshot convert() const; diff --git a/source/RobotAPI/libraries/armem/core/workingmemory/EntitySnapshot.cpp b/source/RobotAPI/libraries/armem/core/workingmemory/EntitySnapshot.cpp index 6ce3103c378499124fb26d526db1ef3d936b9326..fb68d050a0ad19e1e2627e4cb5732a23a2ce4493 100644 --- a/source/RobotAPI/libraries/armem/core/workingmemory/EntitySnapshot.cpp +++ b/source/RobotAPI/libraries/armem/core/workingmemory/EntitySnapshot.cpp @@ -7,15 +7,6 @@ namespace armarx::armem::wm { - - /* - EntitySnapshot& EntitySnapshot::operator=(const EntitySnapshot& other) - { - other._copySelf(*this); - return *this; - } - */ - void EntitySnapshot::_copySelfWithoutData(EntitySnapshot& other) const { other.id() = _id; diff --git a/source/RobotAPI/libraries/armem/core/workingmemory/EntitySnapshot.h b/source/RobotAPI/libraries/armem/core/workingmemory/EntitySnapshot.h index 5b4b80c0b8f97078c27beae30e2100510e4da449..ee0c78c5d201ed2e9fb1fe5c333efc728a9dccfc 100644 --- a/source/RobotAPI/libraries/armem/core/workingmemory/EntitySnapshot.h +++ b/source/RobotAPI/libraries/armem/core/workingmemory/EntitySnapshot.h @@ -21,12 +21,7 @@ namespace armarx::armem::wm public: using Base::EntitySnapshotBase; - virtual ~EntitySnapshot() override = default; - - /* - /// Copy the instances from `other` to this. - EntitySnapshot& operator=(const EntitySnapshot& other); - */ + using Base::operator=; protected: diff --git a/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp b/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp index 8d8fbed9f2d79cc578da72a19a1cf0db31db8e63..880f0833eff39c6d07464a534299c18a8fd38e3d 100644 --- a/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp +++ b/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp @@ -293,6 +293,18 @@ struct CustomChecks<armem::d_ltm::EntityInstance> BOOST_CHECK_EQUAL(moved.path, nullptr); } }; +template <> +struct CustomChecks<armem::d_ltm::EntitySnapshot> +{ + static void checkEqual(const armem::d_ltm::EntitySnapshot& lhs, const armem::d_ltm::EntitySnapshot& rhs) + { + BOOST_CHECK_EQUAL(lhs.path, rhs.path); + } + static void checkMoved(const armem::d_ltm::EntitySnapshot& moved) + { + BOOST_CHECK_EQUAL(moved.path, nullptr); + } +}; struct CopyMoveCtorsOpsTestBase