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

WIP: Value, DataType, Importance

parent 0f96286c
No related branches found
No related tags found
1 merge request!12F consolidation
Pipeline #11834 failed
......@@ -40,6 +40,18 @@ using ProtoParent = caosdb::entity::v1alpha1::Parent;
using ProtoProperty = caosdb::entity::v1alpha1::Property;
using ProtoEntity = caosdb::entity::v1alpha1::Entity;
using ProtoMessage = caosdb::entity::v1alpha1::Message;
using caosdb::entity::v1alpha1::EntityRole;
/**
* The entity role.
*/
enum Role {
NONE = EntityRole::ENTITY_ROLE_UNSPECIFIED, ///< Unset/None
RECORD_TYPE = EntityRole::ENTITY_ROLE_RECORD_TYPE, ///< RecordType
RECORD = EntityRole::ENTITY_ROLE_RECORD, ///< Record
PROPERTY = EntityRole::ENTITY_ROLE_PROPERTY, ///< Property
FILE = EntityRole::ENTITY_ROLE_FILE, ///< File
};
/**
* Messages convey information about the state and result of transactions.
......@@ -374,7 +386,7 @@ public:
inline Entity(const Entity &original) : Entity(CreateProtoEntity()) {
this->wrapped->CopyFrom(*original.wrapped);
};
explicit Entity(IdResponse *idResponse);
explicit Entity(IdResponse *id_response);
explicit inline Entity(ProtoEntity *wrapped) : wrapped(wrapped) {
errors.wrapped = this->wrapped->mutable_errors();
warnings.wrapped = this->wrapped->mutable_warnings();
......@@ -393,7 +405,7 @@ public:
return wrapped->version().id();
};
[[nodiscard]] inline auto GetRole() const -> const std::string & {
[[nodiscard]] inline auto GetRole() const -> Role & {
return wrapped->role();
};
[[nodiscard]] inline auto GetName() const -> const std::string & {
......@@ -437,7 +449,7 @@ public:
return out;
}
auto SetRole(const std::string &role) -> void;
auto SetRole(Role role) -> void;
auto SetName(const std::string &name) -> void;
/**
* Set the description of this entity.
......
Subproject commit 36d7956b6eca506fb87096d8d50b6f4b820778b8
Subproject commit 4ce7460ff869422c419623c8d0cee0459ce6d6dc
......@@ -171,12 +171,13 @@ Entity::Entity() : wrapped(Entity::CreateProtoEntity()) {
infos.wrapped = this->wrapped->mutable_infos();
}
Entity::Entity(IdResponse *idResponse) : Entity() {
this->wrapped->set_id(idResponse->id());
this->wrapped->mutable_errors()->Swap(idResponse->mutable_entity_errors());
Entity::Entity(IdResponse *id_response) : Entity() {
this->wrapped->set_id(id_response->id());
this->wrapped->mutable_version()->Swap(id_response->mutable_version());
this->wrapped->mutable_errors()->Swap(id_response->mutable_entity_errors());
this->wrapped->mutable_warnings()->Swap(
idResponse->mutable_entity_warnings());
this->wrapped->mutable_infos()->Swap(idResponse->mutable_entity_infos());
id_response->mutable_entity_warnings());
this->wrapped->mutable_infos()->Swap(id_response->mutable_entity_infos());
}
auto Entity::SetId(const std::string &id) -> void { this->wrapped->set_id(id); }
......@@ -189,7 +190,7 @@ auto Entity::CopyTo(ProtoEntity *target) -> void {
target->CopyFrom(*(this->wrapped));
}
auto Entity::SetRole(const std::string &role) -> void {
auto Entity::SetRole(Role role) -> void {
this->wrapped->set_role(role);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment