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
Branches
Tags
1 merge request!12F consolidation
Pipeline #11834 failed
...@@ -40,6 +40,18 @@ using ProtoParent = caosdb::entity::v1alpha1::Parent; ...@@ -40,6 +40,18 @@ using ProtoParent = caosdb::entity::v1alpha1::Parent;
using ProtoProperty = caosdb::entity::v1alpha1::Property; using ProtoProperty = caosdb::entity::v1alpha1::Property;
using ProtoEntity = caosdb::entity::v1alpha1::Entity; using ProtoEntity = caosdb::entity::v1alpha1::Entity;
using ProtoMessage = caosdb::entity::v1alpha1::Message; 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. * Messages convey information about the state and result of transactions.
...@@ -374,7 +386,7 @@ public: ...@@ -374,7 +386,7 @@ public:
inline Entity(const Entity &original) : Entity(CreateProtoEntity()) { inline Entity(const Entity &original) : Entity(CreateProtoEntity()) {
this->wrapped->CopyFrom(*original.wrapped); this->wrapped->CopyFrom(*original.wrapped);
}; };
explicit Entity(IdResponse *idResponse); explicit Entity(IdResponse *id_response);
explicit inline Entity(ProtoEntity *wrapped) : wrapped(wrapped) { explicit inline Entity(ProtoEntity *wrapped) : wrapped(wrapped) {
errors.wrapped = this->wrapped->mutable_errors(); errors.wrapped = this->wrapped->mutable_errors();
warnings.wrapped = this->wrapped->mutable_warnings(); warnings.wrapped = this->wrapped->mutable_warnings();
...@@ -393,7 +405,7 @@ public: ...@@ -393,7 +405,7 @@ public:
return wrapped->version().id(); return wrapped->version().id();
}; };
[[nodiscard]] inline auto GetRole() const -> const std::string & { [[nodiscard]] inline auto GetRole() const -> Role & {
return wrapped->role(); return wrapped->role();
}; };
[[nodiscard]] inline auto GetName() const -> const std::string & { [[nodiscard]] inline auto GetName() const -> const std::string & {
...@@ -437,7 +449,7 @@ public: ...@@ -437,7 +449,7 @@ public:
return out; return out;
} }
auto SetRole(const std::string &role) -> void; auto SetRole(Role role) -> void;
auto SetName(const std::string &name) -> void; auto SetName(const std::string &name) -> void;
/** /**
* Set the description of this entity. * Set the description of this entity.
......
Subproject commit 36d7956b6eca506fb87096d8d50b6f4b820778b8 Subproject commit 4ce7460ff869422c419623c8d0cee0459ce6d6dc
...@@ -171,12 +171,13 @@ Entity::Entity() : wrapped(Entity::CreateProtoEntity()) { ...@@ -171,12 +171,13 @@ Entity::Entity() : wrapped(Entity::CreateProtoEntity()) {
infos.wrapped = this->wrapped->mutable_infos(); infos.wrapped = this->wrapped->mutable_infos();
} }
Entity::Entity(IdResponse *idResponse) : Entity() { Entity::Entity(IdResponse *id_response) : Entity() {
this->wrapped->set_id(idResponse->id()); this->wrapped->set_id(id_response->id());
this->wrapped->mutable_errors()->Swap(idResponse->mutable_entity_errors()); this->wrapped->mutable_version()->Swap(id_response->mutable_version());
this->wrapped->mutable_errors()->Swap(id_response->mutable_entity_errors());
this->wrapped->mutable_warnings()->Swap( this->wrapped->mutable_warnings()->Swap(
idResponse->mutable_entity_warnings()); id_response->mutable_entity_warnings());
this->wrapped->mutable_infos()->Swap(idResponse->mutable_entity_infos()); this->wrapped->mutable_infos()->Swap(id_response->mutable_entity_infos());
} }
auto Entity::SetId(const std::string &id) -> void { this->wrapped->set_id(id); } auto Entity::SetId(const std::string &id) -> void { this->wrapped->set_id(id); }
...@@ -189,7 +190,7 @@ auto Entity::CopyTo(ProtoEntity *target) -> void { ...@@ -189,7 +190,7 @@ auto Entity::CopyTo(ProtoEntity *target) -> void {
target->CopyFrom(*(this->wrapped)); target->CopyFrom(*(this->wrapped));
} }
auto Entity::SetRole(const std::string &role) -> void { auto Entity::SetRole(Role role) -> void {
this->wrapped->set_role(role); this->wrapped->set_role(role);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment