Skip to content
Snippets Groups Projects

F multi retrieve

Merged Timm Fitschen requested to merge f-multi-retrieve into dev
All threads resolved!
6 files
+ 185
160
Compare changes
  • Side-by-side
  • Inline
Files
6
+ 153
153
@@ -64,187 +64,187 @@ private:
};
/**
* Container for Messages.
*/
* Container for Messages.
*/
class Messages {
public:
[[nodiscard]] inline auto Size() const -> int { return wrapped->size(); }
[[nodiscard]] inline auto At(int index) const -> const Message {
return Message(&(wrapped->at(index)));
}
[[nodiscard]] inline auto Size() const -> int { return wrapped->size(); }
[[nodiscard]] inline auto At(int index) const -> const Message {
return Message(&(wrapped->at(index)));
}
friend class Entity;
friend class Entity;
private:
inline Messages() : wrapped(nullptr){};
inline Messages() : wrapped(nullptr){};
::google::protobuf::RepeatedPtrField<caosdb::entity::v1alpha1::Message>
*wrapped;
::google::protobuf::RepeatedPtrField<caosdb::entity::v1alpha1::Message>
*wrapped;
};
/**
* Parent of an Entity.
*
* This implementation uses protobuf messages as storage backends. In other
* words, this class wraps a protobuf message and provides getter and setter
* methods.
*/
* Parent of an Entity.
*
* This implementation uses protobuf messages as storage backends. In other
* words, this class wraps a protobuf message and provides getter and setter
* methods.
*/
class Parent {
public:
explicit inline Parent(caosdb::entity::v1alpha1::Parent *wrapped)
: wrapped(wrapped){};
Parent();
/**
* Return the id of the parent entity.
*/
[[nodiscard]] auto GetId() const -> const std::string &;
/**
* Return the name of the parent entity.
*/
[[nodiscard]] auto GetName() const -> const std::string &;
/**
* Return the description of the parent entity.
*/
[[nodiscard]] auto GetDescription() const -> const std::string &;
explicit inline Parent(caosdb::entity::v1alpha1::Parent *wrapped)
: wrapped(wrapped){};
Parent();
/**
* Return the id of the parent entity.
*/
[[nodiscard]] auto GetId() const -> const std::string &;
/**
* Return the name of the parent entity.
*/
[[nodiscard]] auto GetName() const -> const std::string &;
/**
* Return the description of the parent entity.
*/
[[nodiscard]] auto GetDescription() const -> const std::string &;
/**
* Set the id of the parent.
*/
auto SetId(const std::string &id) -> void;
/**
* Set the name of the parent.
*/
auto SetName(const std::string &name) -> void;
/**
* Set the id of the parent.
*/
auto SetId(const std::string &id) -> void;
/**
* Set the name of the parent.
*/
auto SetName(const std::string &name) -> void;
/**
* Return a json string representing this parent.
*
* 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;
}
/**
* Return a json string representing this parent.
*
* 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;
}
// TODO(fspreck) These need implementations. See Entity::GetErrors for
// inspiration.
/**
* Return the error messages of this parent.
*/
[[nodiscard]] inline auto GetErrors() const -> const Messages &;
/**
* Return the warning messages of this parent.
*/
[[nodiscard]] inline auto GetWarnings() const -> const Messages &;
/**
* Return the info messages of this parent.
*/
[[nodiscard]] inline auto GetInfos() const -> const Messages &;
// TODO(fspreck) These need implementations. See Entity::GetErrors for
// inspiration.
/**
* Return the error messages of this parent.
*/
[[nodiscard]] inline auto GetErrors() const -> const Messages &;
/**
* Return the warning messages of this parent.
*/
[[nodiscard]] inline auto GetWarnings() const -> const Messages &;
/**
* Return the info messages of this parent.
*/
[[nodiscard]] inline auto GetInfos() const -> const Messages &;
friend class Entity;
friend class Parents;
friend class Entity;
friend class Parents;
private:
/**
* Return an empty protobuf message pointer.
*
* This function is called by the default constructor of the
* caosdb::entity::Parent class and the protobuf message is used as the
* storage-backend for the new Parent instance.
*
* An 'Arena' takes care of the the memory management. Don't try to delete
* this.
*/
static auto CreateProtoParent() -> ProtoParent *;
/**
* Message which serves as storage backend.
*/
mutable caosdb::entity::v1alpha1::Parent *wrapped;
/**
* Return an empty protobuf message pointer.
*
* This function is called by the default constructor of the
* caosdb::entity::Parent class and the protobuf message is used as the
* storage-backend for the new Parent instance.
*
* An 'Arena' takes care of the the memory management. Don't try to delete
* this.
*/
static auto CreateProtoParent() -> ProtoParent *;
/**
* Message which serves as storage backend.
*/
mutable caosdb::entity::v1alpha1::Parent *wrapped;
};
/**
* Container for parents of entities.
*
* Should only be instantiated and write-accessed by the owning entity.
*/
class Parents {
public:
/**
* Return the current size of the parent container.
* Container for parents of entities.
*
* That is also the number of parents the owning entity currently has.
*/
[[nodiscard]] inline auto Size() const -> int { return wrapped->size(); }
/**
* Return the parent at the given index.
* Should only be instantiated and write-accessed by the owning entity.
*/
[[nodiscard]] inline auto At(int index) const -> const Parent {
return Parent(&(wrapped->at(index)));
}
class Parents {
public:
/**
* Return the current size of the parent container.
*
* That is also the number of parents the owning entity currently has.
*/
[[nodiscard]] inline auto Size() const -> int { return wrapped->size(); }
/**
* Return the parent at the given index.
*/
[[nodiscard]] inline auto At(int index) const -> const Parent {
return Parent(&(wrapped->at(index)));
}
friend class Entity;
friend class Entity;
private:
inline Parents(){};
explicit inline Parents(
inline Parents(){};
explicit inline Parents(
::google::protobuf::RepeatedPtrField<caosdb::entity::v1alpha1::Parent>
*wrapped)
: wrapped(wrapped){};
/**
* Append a parent.
*
* This increases the Size() by one.
*/
auto Append(const Parent &parent) -> void;
/**
* The collection of parent messages which serves as a backend for this
* class.
*/
::google::protobuf::RepeatedPtrField<caosdb::entity::v1alpha1::Parent>
*wrapped)
: wrapped(wrapped){};
*wrapped;
};
/**
* Append a parent.
* Property of an Entity.
*
* This increases the Size() by one.
*/
auto Append(const Parent &parent) -> void;
/**
* The collection of parent messages which serves as a backend for this
* class.
* This is a property which belongs to another entity. Don't confuse it with
* an Entity with the "Property" role.
*/
::google::protobuf::RepeatedPtrField<caosdb::entity::v1alpha1::Parent>
*wrapped;
};
/**
* Property of an Entity.
*
* This is a property which belongs to another entity. Don't confuse it with
* an Entity with the "Property" role.
*/
class Property {
public:
explicit inline Property(caosdb::entity::v1alpha1::Property *wrapped)
: wrapped(wrapped){};
// TODO(fspreck) All of these methods need implementations.
[[nodiscard]] auto GetId() const -> const std::string &;
[[nodiscard]] auto GetName() const -> const std::string &;
[[nodiscard]] auto GetDescription() const -> const std::string &;
[[nodiscard]] auto GetImportance() const -> const std::string &;
[[nodiscard]] auto GetValue() const -> const std::string &;
[[nodiscard]] auto GetUnit() const -> const std::string &;
[[nodiscard]] auto GetDatatype() const -> const std::string &;
[[nodiscard]] auto GetErrors() const -> const Messages &;
[[nodiscard]] auto GetWarnings() const -> const Messages &;
[[nodiscard]] auto GetInfos() const -> const Messages &;
auto SetId(const std::string &id) -> void;
auto SetName(const std::string &name) -> void;
auto SetImportance(const std::string &importance) -> void;
auto SetValue(const std::string &value) -> void;
auto SetUnit(const std::string &unit) -> void;
auto SetDatatype(const std::string &datatype) -> void;
friend class Entity;
friend class Properties;
explicit inline Property(caosdb::entity::v1alpha1::Property *wrapped)
: wrapped(wrapped){};
// TODO(fspreck) All of these methods need implementations.
[[nodiscard]] auto GetId() const -> const std::string &;
[[nodiscard]] auto GetName() const -> const std::string &;
[[nodiscard]] auto GetDescription() const -> const std::string &;
[[nodiscard]] auto GetImportance() const -> const std::string &;
[[nodiscard]] auto GetValue() const -> const std::string &;
[[nodiscard]] auto GetUnit() const -> const std::string &;
[[nodiscard]] auto GetDatatype() const -> const std::string &;
[[nodiscard]] auto GetErrors() const -> const Messages &;
[[nodiscard]] auto GetWarnings() const -> const Messages &;
[[nodiscard]] auto GetInfos() const -> const Messages &;
auto SetId(const std::string &id) -> void;
auto SetName(const std::string &name) -> void;
auto SetImportance(const std::string &importance) -> void;
auto SetValue(const std::string &value) -> void;
auto SetUnit(const std::string &unit) -> void;
auto SetDatatype(const std::string &datatype) -> void;
friend class Entity;
friend class Properties;
private:
caosdb::entity::v1alpha1::Property *wrapped;
caosdb::entity::v1alpha1::Property *wrapped;
};
/**
@@ -254,12 +254,12 @@ caosdb::entity::v1alpha1::Property *wrapped;
*/
class Properties {
public:
// TODO(fspreck) Implementations needed (basically everything). See Parents
// container for inspiration.
[[nodiscard]] auto At(int index) const -> const Property &;
auto Append(const Property &property) -> void;
// TODO(fspreck) Implementations needed (basically everything). See Parents
// container for inspiration.
[[nodiscard]] auto At(int index) const -> const Property &;
auto Append(const Property &property) -> void;
friend class Entity;
friend class Entity;
private:
inline Properties(){};
Loading