Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-julialib
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-julialib
Commits
0b343f96
Commit
0b343f96
authored
3 years ago
by
Alexander Kreft
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: Missing docstring and cleanup
parent
b286c129
No related branches found
No related tags found
1 merge request
!11
F get value
Pipeline
#13159
passed
3 years ago
Stage: info
Stage: code-style
Stage: setup
Stage: test
Stage: deploy
Pipeline: CaosDB Julia Integration Tests
#13160
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Entity.jl
+39
-33
39 additions, 33 deletions
src/Entity.jl
with
39 additions
and
33 deletions
src/Entity.jl
+
39
−
33
View file @
0b343f96
...
...
@@ -750,22 +750,6 @@ function get_value(entity::Ref{_Entity})
return
unsafe_string
(
out
[])
end
function
get_property_list_length
(
property
::
Ref
{
_Property
})
length
=
Ref
{
Cint
}(
0
)
err_code
=
ccall
(
(
:
caosdb_entity_property_get_value_list_length
,
CaosDB
.
library_name
),
Cint
,
(
Ref
{
_Property
},
Ref
{
Cint
}),
property
,
length
,
)
CaosDB
.
Exceptions
.
evaluate_return_code
(
err_code
)
return
length
[]
end
"""
function get_value(property::Ref{_Property})
...
...
@@ -774,7 +758,7 @@ Return the value of the given `property`
function
get_value
(
property
::
Ref
{
_Property
})
_caosdb_dtypes
=
(
"INTEGER"
,
"DOUBLE"
,
"BOOLEAN"
,
"TEXT"
)
prop_datatype
=
get_datatype
(
property
)
is_list
=
prop_datatype
[
3
]
if
prop_datatype
[
1
]
in
_caosdb_dtypes
...
...
@@ -788,7 +772,7 @@ function get_value(property::Ref{_Property})
property
,
out
,
)
out
=
out
[]
elseif
prop_datatype
[
1
]
==
"DOUBLE"
out
=
Ref
{
Cdouble
}(
0
)
...
...
@@ -825,31 +809,31 @@ function get_value(property::Ref{_Property})
list_length
=
get_property_list_length
(
property
)
if
prop_datatype
[
1
]
==
"INTEGER"
out
=
Vector
{
Cint
}()
for
i
::
Cint
in
1
:
list_length
for
i
::
Cint
=
1
:
list_length
temp
=
get_int_list_value_at
(
property
,
i
)
append!
(
out
,
temp
)
end
elseif
prop_datatype
[
1
]
==
"DOUBLE"
out
=
Vector
{
Cdouble
}()
for
i
::
Cint
in
1
:
list_length
for
i
::
Cint
=
1
:
list_length
temp
=
get_double_list_value_at
(
property
,
i
)
append!
(
out
,
temp
)
end
elseif
prop_datatype
[
1
]
==
"BOOLEAN"
out
=
Vector
{
Bool
}()
for
i
::
Cint
in
1
:
list_length
for
i
::
Cint
=
1
:
list_length
temp
=
get_bool_list_value_at
(
property
,
i
)
append!
(
out
,
temp
)
end
elseif
prop_datatype
[
1
]
==
"TEXT"
out
=
Vector
{
String
}()
for
i
::
Cint
in
1
:
list_length
for
i
::
Cint
=
1
:
list_length
temp
=
get_string_list_value_at
(
property
,
i
)
append!
(
out
,
[
temp
])
end
end
end
if
@isdefined
err_code
if
@isdefined
err_code
CaosDB
.
Exceptions
.
evaluate_return_code
(
err_code
)
end
end
...
...
@@ -857,22 +841,44 @@ function get_value(property::Ref{_Property})
return
out
end
"""
function get_property_list_length(property::Ref{_Property})
Return the length of the list of the given `property`
"""
function
get_property_list_length
(
property
::
Ref
{
_Property
})
length
=
Ref
{
Cint
}(
0
)
err_code
=
ccall
(
(
:
caosdb_entity_property_get_value_list_length
,
CaosDB
.
library_name
),
Cint
,
(
Ref
{
_Property
},
Ref
{
Cint
}),
property
,
length
,
)
CaosDB
.
Exceptions
.
evaluate_return_code
(
err_code
)
return
length
[]
end
"""
function get_int_list_value_at(property::Ref{_Property}, index::Cint)
Return the value of the INTEGER list of the given `property` at the position `index`.
"""
function
get_int_list_value_at
(
property
::
Ref
{
_Property
},
index
::
Cint
)
err_code
=
ccall
(
(
:
caosdb_entity_property_get_int_list_value_at
,
CaosDB
.
library_name
),
Cint
,
(
Ref
{
_Property
},
Ref
{
Cint
},
Cint
),
property
,
out
,
index
-
Cint
(
1
),
)
index
-
Cint
(
1
),
)
CaosDB
.
Exceptions
.
evaluate_return_code
(
err_code
)
return
out
[]
end
...
...
@@ -890,8 +896,8 @@ function get_double_list_value_at(property::Ref{_Property}, index::Cint)
(
Ref
{
_Property
},
Ref
{
Cdouble
},
Cint
),
property
,
out
,
index
-
Cint
(
1
),
)
index
-
Cint
(
1
),
)
CaosDB
.
Exceptions
.
evaluate_return_code
(
err_code
)
return
out
[]
...
...
@@ -910,8 +916,8 @@ function get_bool_list_value_at(property::Ref{_Property}, index::Cint)
(
Ref
{
_Property
},
Ref
{
Cint
},
Cint
),
property
,
out
,
index
-
Cint
(
1
),
)
index
-
Cint
(
1
),
)
CaosDB
.
Exceptions
.
evaluate_return_code
(
err_code
)
out
=
convert
(
Bool
,
out
[])
...
...
@@ -931,8 +937,8 @@ function get_string_list_value_at(property::Ref{_Property}, index::Cint)
(
Ref
{
_Property
},
Ref
{
Ptr
{
UInt8
}},
Cint
),
property
,
out
,
index
-
Cint
(
1
),
)
index
-
Cint
(
1
),
)
CaosDB
.
Exceptions
.
evaluate_return_code
(
err_code
)
out
=
unsafe_string
(
out
[])
...
...
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