From 33b575931e3d15572a9525be4e553f1c9ec1cf1e Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Mon, 16 Aug 2021 16:58:23 +0200 Subject: [PATCH] WIP: consolidation --- include/caosdb/value.h | 7 ++++++- src/caosdb/entity.cpp | 7 ------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/caosdb/value.h b/include/caosdb/value.h index 63bb704..e42e526 100644 --- a/include/caosdb/value.h +++ b/include/caosdb/value.h @@ -23,7 +23,7 @@ #define CAOSDB_VALUE_H #include "caosdb/protobuf_helper.h" // for ProtoMessageWrapper #include "caosdb/entity/v1alpha1/main.pb.h" // for RepeatedPtrField, Message - +#include "caosdb/logging.h" #include <google/protobuf/util/json_util.h> // for MessageToJson... #include <memory> // for unique_ptr #include <string> // for string @@ -102,9 +102,13 @@ public: class Value : public ProtoMessageWrapper<ProtoValue> { public: + explicit inline Value(const Value &value){ + this->wrapped = value.wrapped; + } inline Value() : ProtoMessageWrapper<ProtoValue>() { // has NULL_VALUE now } + explicit inline Value(ProtoValue *wrapped) : ProtoMessageWrapper<ProtoValue>(wrapped) {} explicit inline Value(const std::string &value) : ProtoMessageWrapper<ProtoValue>() { this->wrapped->mutable_scalar_value()->set_string_value(value); @@ -214,6 +218,7 @@ public: inline auto ToString() const noexcept -> const std::string { CAOSDB_DEBUG_MESSAGE_STRING(*wrapped, out) + CAOSDB_LOG_DEBUG("caosdb::entity") << "HERE 1 [" << wrapped << "] " << out; return out; } diff --git a/src/caosdb/entity.cpp b/src/caosdb/entity.cpp index fc74cb5..b000e75 100644 --- a/src/caosdb/entity.cpp +++ b/src/caosdb/entity.cpp @@ -197,14 +197,7 @@ auto Entity::SetVersionId(const std::string &id) -> void { } auto Entity::CopyTo(ProtoEntity *target) -> void { - CAOSDB_DEBUG_MESSAGE_STRING(*(this->wrapped), out); - CAOSDB_LOG_DEBUG(logger_name) << "COPY ENTITY: " << out; - CAOSDB_DEBUG_MESSAGE_STRING(*target, out_2); - CAOSDB_LOG_DEBUG(logger_name) << "COPY ENTITY TO: " << out_2; - target->Clear(); target->CopyFrom(*(this->wrapped)); - CAOSDB_DEBUG_MESSAGE_STRING(*target, out_3); - CAOSDB_LOG_DEBUG(logger_name) << "COPY ENTITY FINAL: " << out_3; } auto Entity::SetRole(Role role) -> void { -- GitLab