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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-cpplib
Commits
96f244e9
Verified
Commit
96f244e9
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
WIP: add SetValue(int)
parent
78c17d04
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!22
Return to int64 for integer values
Pipeline
#12862
passed
3 years ago
Stage: info
Stage: setup
Stage: test
Stage: deploy
Pipeline: caosdb-cppinttest
#12863
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/caosdb/entity.h
+4
-0
4 additions, 0 deletions
include/caosdb/entity.h
include/caosdb/value.h
+1
-0
1 addition, 0 deletions
include/caosdb/value.h
src/caosdb/entity.cpp
+12
-0
12 additions, 0 deletions
src/caosdb/entity.cpp
test/test_value.cpp
+2
-2
2 additions, 2 deletions
test/test_value.cpp
with
19 additions
and
2 deletions
include/caosdb/entity.h
+
4
−
0
View file @
96f244e9
...
...
@@ -517,9 +517,11 @@ public:
auto
SetValue
(
const
std
::
vector
<
std
::
string
>
&
values
)
->
StatusCode
;
auto
SetValue
(
const
std
::
vector
<
char
*>
&
values
)
->
StatusCode
;
auto
SetValue
(
const
std
::
vector
<
int64_t
>
&
values
)
->
StatusCode
;
auto
SetValue
(
const
std
::
vector
<
int
>
&
values
)
->
StatusCode
;
auto
SetValue
(
const
std
::
vector
<
double
>
&
values
)
->
StatusCode
;
auto
SetValue
(
const
std
::
vector
<
bool
>
&
values
)
->
StatusCode
;
auto
SetValue
(
const
int64_t
value
)
->
StatusCode
;
auto
SetValue
(
const
int
value
)
->
StatusCode
;
auto
SetValue
(
const
bool
value
)
->
StatusCode
;
/**
...
...
@@ -671,9 +673,11 @@ public:
auto
SetValue
(
const
std
::
vector
<
std
::
string
>
&
values
)
->
StatusCode
;
auto
SetValue
(
const
std
::
vector
<
char
*>
&
values
)
->
StatusCode
;
auto
SetValue
(
const
std
::
vector
<
int64_t
>
&
values
)
->
StatusCode
;
auto
SetValue
(
const
std
::
vector
<
int
>
&
values
)
->
StatusCode
;
auto
SetValue
(
const
std
::
vector
<
double
>
&
values
)
->
StatusCode
;
auto
SetValue
(
const
std
::
vector
<
bool
>
&
values
)
->
StatusCode
;
auto
SetValue
(
const
int64_t
value
)
->
StatusCode
;
auto
SetValue
(
const
int
value
)
->
StatusCode
;
auto
SetValue
(
const
bool
value
)
->
StatusCode
;
auto
SetUnit
(
const
std
::
string
&
unit
)
->
void
;
...
...
This diff is collapsed.
Click to expand it.
include/caosdb/value.h
+
1
−
0
View file @
96f244e9
...
...
@@ -110,6 +110,7 @@ public:
explicit
inline
Value
(
int64_t
value
)
:
ProtoMessageWrapper
<
ProtoValue
>
()
{
this
->
wrapped
->
mutable_scalar_value
()
->
set_integer_value
(
value
);
}
explicit
inline
Value
(
int
value
)
:
Value
(
static_cast
<
int64_t
>
(
value
))
{}
explicit
inline
Value
(
bool
value
)
:
ProtoMessageWrapper
<
ProtoValue
>
()
{
this
->
wrapped
->
mutable_scalar_value
()
->
set_boolean_value
(
value
);
}
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/entity.cpp
+
12
−
0
View file @
96f244e9
...
...
@@ -128,6 +128,10 @@ auto Property::SetValue(const std::vector<int64_t> &values) -> StatusCode {
return
SetValue
(
Value
(
values
));
}
auto
Property
::
SetValue
(
const
std
::
vector
<
int
>
&
values
)
->
StatusCode
{
return
SetValue
(
Value
(
values
));
}
auto
Property
::
SetValue
(
const
std
::
vector
<
double
>
&
values
)
->
StatusCode
{
return
SetValue
(
Value
(
values
));
}
...
...
@@ -138,6 +142,8 @@ auto Property::SetValue(const std::vector<bool> &values) -> StatusCode {
auto
Property
::
SetValue
(
const
int64_t
value
)
->
StatusCode
{
return
SetValue
(
Value
(
value
));
}
auto
Property
::
SetValue
(
const
int
value
)
->
StatusCode
{
return
SetValue
(
Value
(
value
));
}
auto
Property
::
SetValue
(
const
bool
value
)
->
StatusCode
{
return
SetValue
(
Value
(
value
));
}
auto
Property
::
SetUnit
(
const
std
::
string
&
unit
)
->
void
{
this
->
wrapped
->
set_unit
(
unit
);
}
...
...
@@ -226,6 +232,10 @@ auto Entity::SetValue(const std::vector<int64_t> &values) -> StatusCode {
return
SetValue
(
Value
(
values
));
}
auto
Entity
::
SetValue
(
const
std
::
vector
<
int
>
&
values
)
->
StatusCode
{
return
SetValue
(
Value
(
values
));
}
auto
Entity
::
SetValue
(
const
std
::
vector
<
double
>
&
values
)
->
StatusCode
{
return
SetValue
(
Value
(
values
));
}
...
...
@@ -236,6 +246,8 @@ auto Entity::SetValue(const std::vector<bool> &values) -> StatusCode {
auto
Entity
::
SetValue
(
const
int64_t
value
)
->
StatusCode
{
return
SetValue
(
Value
(
value
));
}
auto
Entity
::
SetValue
(
const
int
value
)
->
StatusCode
{
return
SetValue
(
Value
(
value
));
}
auto
Entity
::
SetValue
(
const
bool
value
)
->
StatusCode
{
return
SetValue
(
Value
(
value
));
}
auto
Entity
::
SetUnit
(
const
std
::
string
&
unit
)
->
void
{
this
->
wrapped
->
set_unit
(
unit
);
}
...
...
This diff is collapsed.
Click to expand it.
test/test_value.cpp
+
2
−
2
View file @
96f244e9
...
...
@@ -68,7 +68,7 @@ TEST(test_value, test_string) {
// Test inequality
Value
string1
(
"1"
);
Value
int1
(
static_cast
<
int64_t
>
(
1
)
);
Value
int1
(
1
);
EXPECT_FALSE
(
string1
==
int1
);
}
...
...
@@ -93,7 +93,7 @@ TEST(test_value, test_double) {
}
TEST
(
test_value
,
test_integer
)
{
Value
value
(
static_cast
<
int64_t
>
(
1337
)
)
;
Value
value
(
1337
);
EXPECT_FALSE
(
value
.
IsNull
());
EXPECT_FALSE
(
value
.
IsString
());
EXPECT_FALSE
(
value
.
IsDouble
());
...
...
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