From 0b315b5ee22d0b89016827fd70d390d717e23cc7 Mon Sep 17 00:00:00 2001
From: Rainer Kartmann <rainer.kartmann@kit.edu>
Date: Fri, 30 Apr 2021 13:11:40 +0200
Subject: [PATCH] Fix Entity ctors and ops

---
 .../libraries/armem/core/base/EntityBase.h       | 16 ++++------------
 .../libraries/armem/core/diskmemory/Entity.cpp   | 13 -------------
 .../libraries/armem/core/diskmemory/Entity.h     |  3 +--
 .../armem/core/longtermmemory/Entity.cpp         |  6 ------
 .../libraries/armem/core/longtermmemory/Entity.h |  3 +--
 .../armem/core/workingmemory/Entity.cpp          |  9 ---------
 .../libraries/armem/core/workingmemory/Entity.h  |  8 ++++++--
 7 files changed, 12 insertions(+), 46 deletions(-)

diff --git a/source/RobotAPI/libraries/armem/core/base/EntityBase.h b/source/RobotAPI/libraries/armem/core/base/EntityBase.h
index 90cd503a1..6d2a3a8de 100644
--- a/source/RobotAPI/libraries/armem/core/base/EntityBase.h
+++ b/source/RobotAPI/libraries/armem/core/base/EntityBase.h
@@ -67,19 +67,11 @@ namespace armarx::armem::base
         {
         }
 
-        /*
-        EntityBase(const EntityBase& other) :
-            Base(other)
-        {
-        }
-
 
-        EntityBase& operator=(const EntityBase& other)
-        {
-            other._copySelf(*this);
-            return *this;
-        }
-        */
+        EntityBase(const EntityBase& other) = default;
+        EntityBase(EntityBase&& other) = default;
+        EntityBase& operator=(const EntityBase& other) = default;
+        EntityBase& operator=(EntityBase&& other) = default;
 
 
         virtual bool equalsDeep(const EntityBase& other) const
diff --git a/source/RobotAPI/libraries/armem/core/diskmemory/Entity.cpp b/source/RobotAPI/libraries/armem/core/diskmemory/Entity.cpp
index bf14fe646..a616914ed 100644
--- a/source/RobotAPI/libraries/armem/core/diskmemory/Entity.cpp
+++ b/source/RobotAPI/libraries/armem/core/diskmemory/Entity.cpp
@@ -2,19 +2,6 @@
 
 namespace armarx::armem::d_ltm
 {
-
-    Entity::Entity(const Entity& other) :
-        Base(other),
-        path(other.path)
-    {
-    }
-
-    Entity& Entity::operator=(const Entity& other)
-    {
-        other._copySelf(*this);
-        return *this;
-    }
-
     std::filesystem::path Entity::_fullPath() const
     {
         if (path)
diff --git a/source/RobotAPI/libraries/armem/core/diskmemory/Entity.h b/source/RobotAPI/libraries/armem/core/diskmemory/Entity.h
index 9174ffb73..350222755 100644
--- a/source/RobotAPI/libraries/armem/core/diskmemory/Entity.h
+++ b/source/RobotAPI/libraries/armem/core/diskmemory/Entity.h
@@ -38,9 +38,8 @@ namespace armarx::armem::d_ltm
     public:
 
         using Base::EntityBase;
+        using Base::operator=;
 
-        Entity(const Entity& other);
-        Entity& operator=(const Entity& other);
 
         // Conversion
         wm::Entity convert(const aron::typenavigator::NavigatorPtr& expectedStructure) const;
diff --git a/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.cpp b/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.cpp
index 92eb8e29b..15e232c01 100644
--- a/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.cpp
+++ b/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.cpp
@@ -3,12 +3,6 @@
 namespace armarx::armem::ltm
 {
 
-    Entity& Entity::operator=(const Entity& other)
-    {
-        other._copySelf(*this);
-        return *this;
-    }
-
     wm::Entity Entity::convert() const
     {
         wm::Entity m;
diff --git a/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.h b/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.h
index 7bce33fe1..ecdf297c1 100644
--- a/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.h
+++ b/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.h
@@ -36,9 +36,8 @@ namespace armarx::armem::ltm
     public:
 
         using Base::EntityBase;
+        using Base::operator=;
 
-        /// Copy the history from `other` to this.
-        Entity& operator=(const Entity& other);
 
         // Conversion
         wm::Entity convert() const;
diff --git a/source/RobotAPI/libraries/armem/core/workingmemory/Entity.cpp b/source/RobotAPI/libraries/armem/core/workingmemory/Entity.cpp
index 6d129eaa2..022864c19 100644
--- a/source/RobotAPI/libraries/armem/core/workingmemory/Entity.cpp
+++ b/source/RobotAPI/libraries/armem/core/workingmemory/Entity.cpp
@@ -2,15 +2,6 @@
 
 namespace armarx::armem::wm
 {
-
-    /*
-        Entity& Entity::operator=(const Entity& other)
-        {
-            other._copySelf(*this);
-            return *this;
-        }
-    */
-
     void Entity::_copySelfWithoutData(Entity& other) const
     {
         other.id() = _id;
diff --git a/source/RobotAPI/libraries/armem/core/workingmemory/Entity.h b/source/RobotAPI/libraries/armem/core/workingmemory/Entity.h
index a0c14ed9c..6a3128672 100644
--- a/source/RobotAPI/libraries/armem/core/workingmemory/Entity.h
+++ b/source/RobotAPI/libraries/armem/core/workingmemory/Entity.h
@@ -36,9 +36,13 @@ namespace armarx::armem::wm
     public:
 
         using Base::EntityBase;
-        virtual ~Entity() override = default;
 
-        //Entity& operator=(const Entity& other);
+        Entity(const Entity& other) = default;
+        Entity(Entity&& other) = default;
+        Entity& operator=(const Entity& other) = default;
+        Entity& operator=(Entity&& other) = default;
+
+        virtual ~Entity() override = default;
 
 
     protected:
-- 
GitLab