Skip to content
Snippets Groups Projects

ENH: Allow insertion and deletion of single entities

Merged Florian Spreckelsen requested to merge f-insert into dev
All threads resolved!
2 files
+ 116
1
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 57
1
@@ -36,6 +36,7 @@
namespace caosdb::entity {
using caosdb::entity::v1alpha1::IdResponse;
using ProtoParent = caosdb::entity::v1alpha1::Parent;
using ProtoProperty = caosdb::entity::v1alpha1::Property;
using ProtoEntity = caosdb::entity::v1alpha1::Entity;
/**
@@ -246,14 +247,35 @@ class Property {
public:
explicit inline Property(caosdb::entity::v1alpha1::Property *wrapped)
: wrapped(wrapped){};
Property();
// TODO(fspreck) All of these methods need implementations.
/**
* Return the id of this property
*/
[[nodiscard]] auto GetId() const -> const std::string &;
/**
* Return the name of this property
*/
[[nodiscard]] auto GetName() const -> const std::string &;
/**
* Return the description of this property
*/
[[nodiscard]] auto GetDescription() const -> const std::string &;
/**
* Return the importance of this property
*/
[[nodiscard]] auto GetImportance() const -> const std::string &;
/**
* Return the value of this property
*/
[[nodiscard]] auto GetValue() const -> const std::string &;
/**
* Return the unit of this property
*/
[[nodiscard]] auto GetUnit() const -> const std::string &;
/**
* Return the datatype of this property
*/
[[nodiscard]] auto GetDatatype() const -> const std::string &;
// TODO(fspreck) Implement these when we have decided how to attach
// messages to properties.
@@ -261,17 +283,51 @@ public:
// [[nodiscard]] auto GetWarnings() const -> const Messages &;
// [[nodiscard]] auto GetInfos() const -> const Messages &;
/**
* Set the id of this property.
*/
auto SetId(const std::string &id) -> void;
/**
* Set the name of this property.
*/
auto SetName(const std::string &name) -> void;
/**
* Set the importance of this property.
*/
auto SetImportance(const std::string &importance) -> void;
/**
* Set the value of this property.
*/
auto SetValue(const std::string &value) -> void;
/**
* Set the unit of this property.
*/
auto SetUnit(const std::string &unit) -> void;
/**
* Set the datatype of this property.
*/
auto SetDatatype(const std::string &datatype) -> void;
/**
* Return a json string representing this property.
*
* This is intended for debugging
*/
inline auto ToString() const -> const std::string {
google::protobuf::util::JsonOptions options;
std::string out;
google::protobuf::util::MessageToJsonString(*(this->wrapped), &out,
options);
return out;
}
friend class Entity;
friend class Properties;
private:
static auto CreateProtoProperty() -> ProtoProperty *;
caosdb::entity::v1alpha1::Property *wrapped;
};
Loading