From 705e09d0792216d30fca2fb8d33d8c09ec358d27 Mon Sep 17 00:00:00 2001
From: florian <f.spreckelsen@inidscale.com>
Date: Tue, 3 Aug 2021 09:59:46 +0200
Subject: [PATCH] DRAFT: Disable messages for properties and parents for now

---
 include/caosdb/entity.h | 77 ++++++++++++++++++++++-------------------
 src/caosdb/entity.cpp   |  8 +++--
 2 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/include/caosdb/entity.h b/include/caosdb/entity.h
index 8920efe..a64940e 100644
--- a/include/caosdb/entity.h
+++ b/include/caosdb/entity.h
@@ -54,8 +54,10 @@ public:
   }
 
   friend class Entity;
-  friend class Parent;
-  friend class Property;
+  // TODO(fspreck) Re-enable once we have decided how messages are
+  // appended to parents and properties
+  // friend class Parent;
+  // friend class Property;
   friend class Messages;
 
 private:
@@ -76,8 +78,9 @@ public:
   }
 
   friend class Entity;
-  friend class Parent;
-  friend class Property;
+  // TODO(fspreck) Same here.
+  // friend class Parent;
+  // friend class Property;
 
 private:
   inline Messages() : wrapped(nullptr){};
@@ -138,32 +141,32 @@ public:
     return out;
   }
 
-  // TODO(fspreck) These need implementations. See Entity::GetErrors for
-  // inspiration.
-  /**
-   * Return the error messages of this parent.
-   */
-  [[nodiscard]] inline auto GetErrors() const -> const Messages & {
-    return errors;
-  }
-  [[nodiscard]] inline auto HasErrors() const -> bool {
-    return this->errors.wrapped->size() > 0;
-  }
-  /**
-   * Return the warning messages of this parent.
-   */
-  [[nodiscard]] inline auto GetWarnings() const -> const Messages & {
-    return warnings;
-  }
-  [[nodiscard]] inline auto HasWarnings() const -> bool {
-    return this->warnings.wrapped->size() > 0;
-  }
-  /**
-   * Return the info messages of this parent.
-   */
-  [[nodiscard]] inline auto GetInfos() const -> const Messages & {
-    return infos;
-  }
+  // TODO(fspreck) Finish the following implementations once we have
+  // decided how to attach messages to parents.
+  // /**
+  //  * Return the error messages of this parent.
+  //  */
+  // [[nodiscard]] inline auto GetErrors() const -> const Messages & {
+  //   return errors;
+  // }
+  // [[nodiscard]] inline auto HasErrors() const -> bool {
+  //   return this->errors.wrapped->size() > 0;
+  // }
+  // /**
+  //  * Return the warning messages of this parent.
+  //  */
+  // [[nodiscard]] inline auto GetWarnings() const -> const Messages & {
+  //   return warnings;
+  // }
+  // [[nodiscard]] inline auto HasWarnings() const -> bool {
+  //   return this->warnings.wrapped->size() > 0;
+  // }
+  // /**
+  //  * Return the info messages of this parent.
+  //  */
+  // [[nodiscard]] inline auto GetInfos() const -> const Messages & {
+  //   return infos;
+  // }
 
   friend class Entity;
   friend class Parents;
@@ -185,9 +188,9 @@ private:
    * Message which serves as storage backend.
    */
   mutable caosdb::entity::v1alpha1::Parent *wrapped;
-  Messages errors;
-  Messages warnings;
-  Messages infos;
+  // Messages errors;
+  // Messages warnings;
+  // Messages infos;
 };
 
 /**
@@ -252,9 +255,11 @@ public:
   [[nodiscard]] auto GetValue() const -> const std::string &;
   [[nodiscard]] auto GetUnit() const -> const std::string &;
   [[nodiscard]] auto GetDatatype() const -> const std::string &;
-  [[nodiscard]] auto GetErrors() const -> const Messages &;
-  [[nodiscard]] auto GetWarnings() const -> const Messages &;
-  [[nodiscard]] auto GetInfos() const -> const Messages &;
+  // TODO(fspreck) Implement these when we have decided how to attach
+  // messages to properties.
+  // [[nodiscard]] auto GetErrors() const -> const Messages &;
+  // [[nodiscard]] auto GetWarnings() const -> const Messages &;
+  // [[nodiscard]] auto GetInfos() const -> const Messages &;
 
   auto SetId(const std::string &id) -> void;
   auto SetName(const std::string &name) -> void;
diff --git a/src/caosdb/entity.cpp b/src/caosdb/entity.cpp
index 84105ed..0e56c68 100644
--- a/src/caosdb/entity.cpp
+++ b/src/caosdb/entity.cpp
@@ -29,9 +29,11 @@ using ProtoEntity = caosdb::entity::v1alpha1::Entity;
 using caosdb::utility::get_arena;
 
 Parent::Parent() : wrapped(Parent::CreateProtoParent()) {
-  errors.wrapped = this->wrapped->mutable_errors();
-  warnings.wrapped = this->wrapped->mutable_warnings();
-  infos.wrapped = this->wrapped->mutable_infos();
+  // TODO(fspreck) Re-enable once we have decided how to attach
+  // messages to parents.
+  // errors.wrapped = this->wrapped->mutable_errors();
+  // warnings.wrapped = this->wrapped->mutable_warnings();
+  // infos.wrapped = this->wrapped->mutable_infos();
 }
 
 auto Parent::CreateProtoParent() -> ProtoParent * {
-- 
GitLab