Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cpplib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-cpplib
Commits
febbf560
Commit
febbf560
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
DRAFT: Fill Properties class
parent
d5367643
No related branches found
No related tags found
1 merge request
!4
ENH: Allow insertion and deletion of single entities
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/caosdb/entity.h
+20
-3
20 additions, 3 deletions
include/caosdb/entity.h
src/caosdb/entity.cpp
+9
-0
9 additions, 0 deletions
src/caosdb/entity.cpp
with
29 additions
and
3 deletions
include/caosdb/entity.h
+
20
−
3
View file @
febbf560
...
@@ -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
;
};
};
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/entity.cpp
+
9
−
0
View file @
febbf560
...
@@ -124,6 +124,15 @@ auto Property::SetDatatype(const std::string &datatype) -> void {
...
@@ -124,6 +124,15 @@ auto Property::SetDatatype(const std::string &datatype) -> void {
this
->
wrapped
->
set_datatype
(
datatype
);
this
->
wrapped
->
set_datatype
(
datatype
);
}
}
auto
Properties
::
Append
(
const
Property
&
property
)
->
void
{
auto
*
destination
=
this
->
wrapped
->
Add
();
destination
->
Swap
(
property
.
wrapped
);
property
.
wrapped
->
Clear
();
property
.
wrapped
=
destination
;
}
[[
nodiscard
]]
auto
Entity
::
GetParents
()
const
->
const
Parents
&
{
[[
nodiscard
]]
auto
Entity
::
GetParents
()
const
->
const
Parents
&
{
return
parents
;
return
parents
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment