diff --git a/include/caosdb/entity.h b/include/caosdb/entity.h index 89bb320ae635566635306973e9f0c7be02b5ac52..a0583afe0657fb2822f2321e031ccba2cff234f7 100644 --- a/include/caosdb/entity.h +++ b/include/caosdb/entity.h @@ -651,14 +651,13 @@ public: * Move constructor. */ explicit inline Entity(Entity &&original) - : wrapped(std::move(original.wrapped)), value(Value(original.value.wrapped)), - data_type(DataType(original.data_type.wrapped)) { - // TODO(tf) move other things as well + : wrapped(std::move(original.wrapped)), value(Value(std::move(original.value.wrapped))), + data_type(DataType(std::move(original.data_type.wrapped))) { this->properties.wrapped = std::move(original.properties.wrapped); this->parents.wrapped = std::move(original.parents.wrapped); - this->errors.wrapped = original.errors.wrapped; - this->warnings.wrapped = original.warnings.wrapped; - this->infos.wrapped = original.infos.wrapped; + this->errors.wrapped = std::move(original.errors.wrapped); + this->warnings.wrapped = std::move(original.warnings.wrapped); + this->infos.wrapped = std::move(original.infos.wrapped); }; /** @@ -670,11 +669,29 @@ public: this->value.wrapped = std::move(other.value.wrapped); this->properties.wrapped = std::move(other.properties.wrapped); this->parents.wrapped = std::move(other.parents.wrapped); - file_descriptor = std::move(other.file_descriptor); - // TODO(tf) add move to messages - errors.wrapped->Swap(other.errors.wrapped); - warnings.wrapped->Swap(other.warnings.wrapped); - infos.wrapped->Swap(other.infos.wrapped); + this->file_descriptor = std::move(other.file_descriptor); + this->errors.wrapped = std::move(other.errors.wrapped); + this->warnings.wrapped = std::move(other.warnings.wrapped); + this->infos.wrapped = std::move(other.infos.wrapped); + return *this; + } + + /** + * Copy assignment operator. + */ + auto operator=(const Entity &other) -> Entity & { + this->wrapped->CopyFrom(*other.wrapped); + this->data_type.wrapped->CopyFrom(*other.data_type.wrapped); + this->value.wrapped->CopyFrom(*other.value.wrapped); + this->properties.wrapped->CopyFrom(*other.properties.wrapped); + this->parents.wrapped->CopyFrom(*other.parents.wrapped); + this->file_descriptor.local_path = boost::filesystem::path(other.file_descriptor.local_path); + this->file_descriptor.file_transmission_id->CopyFrom( + *other.file_descriptor.file_transmission_id); + this->file_descriptor.wrapped->CopyFrom(*other.file_descriptor.wrapped); + this->errors.wrapped->CopyFrom(*other.errors.wrapped); + this->warnings.wrapped->CopyFrom(*other.warnings.wrapped); + this->infos.wrapped->CopyFrom(*other.infos.wrapped); return *this; }