Skip to content
Snippets Groups Projects
Verified Commit 9de7cf1d authored by Timm Fitschen's avatar Timm Fitschen
Browse files

EHN: copy assignment for entity

parent 54e91c79
Branches
Tags
1 merge request!27F move entity
...@@ -651,14 +651,13 @@ public: ...@@ -651,14 +651,13 @@ public:
* Move constructor. * Move constructor.
*/ */
explicit inline Entity(Entity &&original) explicit inline Entity(Entity &&original)
: wrapped(std::move(original.wrapped)), value(Value(original.value.wrapped)), : wrapped(std::move(original.wrapped)), value(Value(std::move(original.value.wrapped))),
data_type(DataType(original.data_type.wrapped)) { data_type(DataType(std::move(original.data_type.wrapped))) {
// TODO(tf) move other things as well
this->properties.wrapped = std::move(original.properties.wrapped); this->properties.wrapped = std::move(original.properties.wrapped);
this->parents.wrapped = std::move(original.parents.wrapped); this->parents.wrapped = std::move(original.parents.wrapped);
this->errors.wrapped = original.errors.wrapped; this->errors.wrapped = std::move(original.errors.wrapped);
this->warnings.wrapped = original.warnings.wrapped; this->warnings.wrapped = std::move(original.warnings.wrapped);
this->infos.wrapped = original.infos.wrapped; this->infos.wrapped = std::move(original.infos.wrapped);
}; };
/** /**
...@@ -670,11 +669,29 @@ public: ...@@ -670,11 +669,29 @@ public:
this->value.wrapped = std::move(other.value.wrapped); this->value.wrapped = std::move(other.value.wrapped);
this->properties.wrapped = std::move(other.properties.wrapped); this->properties.wrapped = std::move(other.properties.wrapped);
this->parents.wrapped = std::move(other.parents.wrapped); this->parents.wrapped = std::move(other.parents.wrapped);
file_descriptor = std::move(other.file_descriptor); this->file_descriptor = std::move(other.file_descriptor);
// TODO(tf) add move to messages this->errors.wrapped = std::move(other.errors.wrapped);
errors.wrapped->Swap(other.errors.wrapped); this->warnings.wrapped = std::move(other.warnings.wrapped);
warnings.wrapped->Swap(other.warnings.wrapped); this->infos.wrapped = std::move(other.infos.wrapped);
infos.wrapped->Swap(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; return *this;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment