diff --git a/source/RobotAPI/libraries/armem/core/base/MemoryBase.h b/source/RobotAPI/libraries/armem/core/base/MemoryBase.h index b97faceca4e1bf693ec265002e69f922dd83dda5..7bcef9350941e86ea5f3e290afcf70d1c42f1010 100644 --- a/source/RobotAPI/libraries/armem/core/base/MemoryBase.h +++ b/source/RobotAPI/libraries/armem/core/base/MemoryBase.h @@ -47,19 +47,10 @@ namespace armarx::armem::base { } - /* - MemoryBase(const MemoryBase& other) : - Base(other) - { - } - - - MemoryBase& operator=(const MemoryBase& other) - { - other._copySelf(*this); - return *this; - } - */ + MemoryBase(const MemoryBase& other) = default; + MemoryBase(MemoryBase&& other) = default; + MemoryBase& operator=(const MemoryBase& other) = default; + MemoryBase& operator=(MemoryBase&& other) = default; inline const std::string& name() const @@ -207,10 +198,5 @@ namespace armarx::armem::base { return this->name(); } - - - protected: - - }; } diff --git a/source/RobotAPI/libraries/armem/core/base/detail/EntityContainerBase.h b/source/RobotAPI/libraries/armem/core/base/detail/EntityContainerBase.h index 4aafc3df39f1ae964d7188eab3e694ab457f8f1a..9e5c869c333196c4ae9f1d32a803458ef34d27b4 100644 --- a/source/RobotAPI/libraries/armem/core/base/detail/EntityContainerBase.h +++ b/source/RobotAPI/libraries/armem/core/base/detail/EntityContainerBase.h @@ -36,14 +36,7 @@ namespace armarx::armem::base::detail public: using Base::MemoryContainerBase; - - /* - EntityContainerBase& operator=(const EntityContainerBase& other) - { - other._copySelf(*this); - return *this; - } - */ + using Base::operator=; /** diff --git a/source/RobotAPI/libraries/armem/core/diskmemory/Memory.cpp b/source/RobotAPI/libraries/armem/core/diskmemory/Memory.cpp index f7461b4cf9633e6b722fa97fda6aa5debee632d0..874d189d6a22a79c9e015d800c292f9af075cfea 100644 --- a/source/RobotAPI/libraries/armem/core/diskmemory/Memory.cpp +++ b/source/RobotAPI/libraries/armem/core/diskmemory/Memory.cpp @@ -8,18 +8,6 @@ namespace armarx::armem::d_ltm { - Memory::Memory(const Memory& other) : - Base(other), - path(other.path) - { - } - - Memory& Memory::operator=(const Memory& other) - { - other._copySelf(*this); - return *this; - } - std::filesystem::path Memory::_fullPath() const { if (path) diff --git a/source/RobotAPI/libraries/armem/core/diskmemory/Memory.h b/source/RobotAPI/libraries/armem/core/diskmemory/Memory.h index f1a9d446dcf982c9bb9e44d08a7ea9d8e3bfcc5e..7f7872f7a638cc31122f09b00a95755ede4d9606 100644 --- a/source/RobotAPI/libraries/armem/core/diskmemory/Memory.h +++ b/source/RobotAPI/libraries/armem/core/diskmemory/Memory.h @@ -22,9 +22,8 @@ namespace armarx::armem::d_ltm public: using Base::MemoryBase; + using Base::operator=; - Memory(const Memory& other); - Memory& operator=(const Memory& other); // Conversion wm::Memory convert() const; diff --git a/source/RobotAPI/libraries/armem/core/longtermmemory/Memory.cpp b/source/RobotAPI/libraries/armem/core/longtermmemory/Memory.cpp index cf012cc37baac05ccaba6f62ecb1212af98eaae6..ac204816011ee0b760fa65a9fecea330edcadf97 100644 --- a/source/RobotAPI/libraries/armem/core/longtermmemory/Memory.cpp +++ b/source/RobotAPI/libraries/armem/core/longtermmemory/Memory.cpp @@ -9,12 +9,6 @@ namespace armarx::armem::ltm { - Memory& Memory::operator=(const Memory& other) - { - other._copySelf(*this); - return *this; - } - wm::Memory Memory::convert() const { wm::Memory m; diff --git a/source/RobotAPI/libraries/armem/core/longtermmemory/Memory.h b/source/RobotAPI/libraries/armem/core/longtermmemory/Memory.h index dcf6b7e559862533818f4cadd7fdb263b41f0e88..a381972a8c6670f10f286b5ecee82757c1be87d1 100644 --- a/source/RobotAPI/libraries/armem/core/longtermmemory/Memory.h +++ b/source/RobotAPI/libraries/armem/core/longtermmemory/Memory.h @@ -20,8 +20,7 @@ namespace armarx::armem::ltm public: using Base::MemoryBase; - - Memory& operator=(const Memory& other); + using Base::operator=; // Conversion diff --git a/source/RobotAPI/libraries/armem/core/workingmemory/Memory.cpp b/source/RobotAPI/libraries/armem/core/workingmemory/Memory.cpp index 85aa8c394b0b641bd354ea1108aef8681e2c2724..b7af1a6456687b1741710d46fa157b9091295db7 100644 --- a/source/RobotAPI/libraries/armem/core/workingmemory/Memory.cpp +++ b/source/RobotAPI/libraries/armem/core/workingmemory/Memory.cpp @@ -3,9 +3,6 @@ namespace armarx::armem::wm { - - static Memory _memory("mymem"); - void Memory::_copySelfWithoutData(Memory& other) const { other.id() = _id; diff --git a/source/RobotAPI/libraries/armem/core/workingmemory/Memory.h b/source/RobotAPI/libraries/armem/core/workingmemory/Memory.h index 463695b4431764b8447029c2c18b7a7035887bf8..e8b7cb35349837820c3dd47f2d584ef6b9760461 100644 --- a/source/RobotAPI/libraries/armem/core/workingmemory/Memory.h +++ b/source/RobotAPI/libraries/armem/core/workingmemory/Memory.h @@ -21,7 +21,11 @@ namespace armarx::armem::wm public: using Base::MemoryBase; - virtual ~Memory() override = default; + + Memory(const Memory& other) = default; + Memory(Memory&& other) = default; + Memory& operator=(const Memory& other) = default; + Memory& operator=(Memory&& other) = default; protected: diff --git a/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp b/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp index 880f0833eff39c6d07464a534299c18a8fd38e3d..b7fffdbff9dc0641f67b6fb83b2fb97849a7f61b 100644 --- a/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp +++ b/source/RobotAPI/libraries/armem/test/ArMemMemoryTest.cpp @@ -268,6 +268,19 @@ struct CustomChecks (void) moved; } }; + + +template <class T> +void checkEqual_d_ltm(const T& lhs, const T& rhs) +{ + BOOST_CHECK_EQUAL(lhs.path, rhs.path); +} +template <class T> +void checkMoved_d_ltm(const T& moved) +{ + BOOST_CHECK_EQUAL(moved.path, nullptr); +} + template <> struct CustomChecks<armem::wm::EntityInstance> { @@ -286,11 +299,11 @@ struct CustomChecks<armem::d_ltm::EntityInstance> { static void checkEqual(const armem::d_ltm::EntityInstance& lhs, const armem::d_ltm::EntityInstance& rhs) { - BOOST_CHECK_EQUAL(lhs.path, rhs.path); + checkEqual_d_ltm(lhs, rhs); } static void checkMoved(const armem::d_ltm::EntityInstance& moved) { - BOOST_CHECK_EQUAL(moved.path, nullptr); + checkMoved_d_ltm(moved); } }; template <> @@ -298,11 +311,59 @@ 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); + checkEqual_d_ltm(lhs, rhs); } static void checkMoved(const armem::d_ltm::EntitySnapshot& moved) { - BOOST_CHECK_EQUAL(moved.path, nullptr); + checkMoved_d_ltm(moved); + } +}; +template <> +struct CustomChecks<armem::d_ltm::Entity> +{ + static void checkEqual(const armem::d_ltm::Entity& lhs, const armem::d_ltm::Entity& rhs) + { + checkEqual_d_ltm(lhs, rhs); + } + static void checkMoved(const armem::d_ltm::Entity& moved) + { + checkMoved_d_ltm(moved); + } +}; +template <> +struct CustomChecks<armem::d_ltm::ProviderSegment> +{ + static void checkEqual(const armem::d_ltm::ProviderSegment& lhs, const armem::d_ltm::ProviderSegment& rhs) + { + checkEqual_d_ltm(lhs, rhs); + } + static void checkMoved(const armem::d_ltm::ProviderSegment& moved) + { + checkMoved_d_ltm(moved); + } +}; +template <> +struct CustomChecks<armem::d_ltm::CoreSegment> +{ + static void checkEqual(const armem::d_ltm::CoreSegment& lhs, const armem::d_ltm::CoreSegment& rhs) + { + checkEqual_d_ltm(lhs, rhs); + } + static void checkMoved(const armem::d_ltm::CoreSegment& moved) + { + checkMoved_d_ltm(moved); + } +}; +template <> +struct CustomChecks<armem::d_ltm::Memory> +{ + static void checkEqual(const armem::d_ltm::Memory& lhs, const armem::d_ltm::Memory& rhs) + { + checkEqual_d_ltm(lhs, rhs); + } + static void checkMoved(const armem::d_ltm::Memory& moved) + { + checkMoved_d_ltm(moved); } };