Skip to content
Snippets Groups Projects

ENH: Allow insertion and deletion of single entities

Merged Florian Spreckelsen requested to merge f-insert into dev
2 files
+ 29
3
Compare changes
  • Side-by-side
  • Inline

Files

+ 20
3
@@ -328,7 +328,7 @@ public:
@@ -328,7 +328,7 @@ public:
private:
private:
static auto CreateProtoProperty() -> ProtoProperty *;
static auto CreateProtoProperty() -> ProtoProperty *;
caosdb::entity::v1alpha1::Property *wrapped;
mutable caosdb::entity::v1alpha1::Property *wrapped;
};
};
/**
/**
@@ -340,8 +340,18 @@ class Properties {
@@ -340,8 +340,18 @@ class Properties {
public:
public:
// TODO(fspreck) Implementations needed (basically everything). See Parents
// TODO(fspreck) Implementations needed (basically everything). See Parents
// container for inspiration.
// container for inspiration.
[[nodiscard]] auto At(int index) const -> const Property &;
/**
auto Append(const Property &property) -> void;
* Return the current size of the properties container.
 
*
 
* This is also the number of properties the owningn entity currently has.
 
*/
 
[[nodiscard]] inline auto Size() const -> int { return wrapped->size(); }
 
/**
 
* Return the property at the given index.
 
*/
 
[[nodiscard]] auto At(int index) const -> const Property {
 
return Property(&(wrapped->at(index)));
 
}
friend class Entity;
friend class Entity;
@@ -352,6 +362,13 @@ private:
@@ -352,6 +362,13 @@ private:
*wrapped)
*wrapped)
: wrapped(wrapped){};
: wrapped(wrapped){};
 
/**
 
* Append a property
 
*
 
* This increases the Size() by one.
 
*/
 
auto Append(const Property &property) -> void;
 
::google::protobuf::RepeatedPtrField<caosdb::entity::v1alpha1::Property>
::google::protobuf::RepeatedPtrField<caosdb::entity::v1alpha1::Property>
*wrapped;
*wrapped;
};
};
Loading