Skip to content
Snippets Groups Projects
Commit b36d0b53 authored by Alexander Kreft's avatar Alexander Kreft
Browse files

ENH: Helper functions for entity-properties

parent 0b343f96
No related branches found
No related tags found
1 merge request!11F get value
Pipeline #13161 passed
Pipeline: CaosDB Julia Integration Tests

#13162

    ......@@ -863,13 +863,35 @@ function get_property_list_length(property::Ref{_Property})
    return length[]
    end
    """
    function get_property_list_length(entity::Ref{_Entity})
    Return the length of the list of the given `entity`
    """
    function get_property_list_length(entity::Ref{_Entity})
    length = Ref{Cint}(0)
    err_code = ccall(
    (:caosdb_entity_property_get_value_list_length, CaosDB.library_name),
    Cint,
    (Ref{_Entity}, Ref{Cint}),
    entity,
    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)
    out = Ref{Cint}(0)
    err_code = ccall(
    (:caosdb_entity_property_get_int_list_value_at, CaosDB.library_name),
    Cint,
    ......@@ -883,6 +905,26 @@ function get_int_list_value_at(property::Ref{_Property}, index::Cint)
    return out[]
    end
    """
    function get_int_list_value_at(entity::Ref{_Entity}, index::Cint)
    Return the value of the INTEGER list of the given `entity` at the position `index`.
    """
    function get_int_list_value_at(entity::Ref{_Entity}, index::Cint)
    out = Ref{Cint}(0)
    err_code = ccall(
    (:caosdb_entity_entity_get_int_list_value_at, CaosDB.library_name),
    Cint,
    (Ref{_Entity}, Ref{Cint}, Cint),
    entity,
    out,
    index - Cint(1),
    )
    CaosDB.Exceptions.evaluate_return_code(err_code)
    return out[]
    end
    """
    function get_double_list_value_at(property::Ref{_Property}, index::Cint)
    ......@@ -903,6 +945,26 @@ function get_double_list_value_at(property::Ref{_Property}, index::Cint)
    return out[]
    end
    """
    function get_double_list_value_at(entity::Ref{_Entity}, index::Cint)
    Return the value of the DOUBLE list of the given `entity` at the position `index`.
    """
    function get_double_list_value_at(entity::Ref{_Entity}, index::Cint)
    out = Ref{Cdouble}(0)
    err_code = ccall(
    (:caosdb_entity_entity_get_double_list_value_at, CaosDB.library_name),
    Cint,
    (Ref{_Entity}, Ref{Cdouble}, Cint),
    entity,
    out,
    index - Cint(1),
    )
    CaosDB.Exceptions.evaluate_return_code(err_code)
    return out[]
    end
    """
    function get_bool_list_value_at(property::Ref{_Property}, index::Cint)
    ......@@ -924,6 +986,27 @@ function get_bool_list_value_at(property::Ref{_Property}, index::Cint)
    return out
    end
    """
    function get_bool_list_value_at(entity::Ref{_Entity}, index::Cint)
    Return the value of the BOOLEAN list of the given `entity` at the position `index`.
    """
    function get_bool_list_value_at(entity::Ref{_Entity}, index::Cint)
    out = Ref{Cint}(0)
    err_code = ccall(
    (:caosdb_entity_entity_get_boolean_list_value_at, CaosDB.library_name),
    Cint,
    (Ref{_Entity}, Ref{Cint}, Cint),
    entity,
    out,
    index - Cint(1),
    )
    CaosDB.Exceptions.evaluate_return_code(err_code)
    out = convert(Bool, out[])
    return out
    end
    """
    function get_string_list_value_at(property::Ref{_Property}, index::Cint)
    ......@@ -945,6 +1028,27 @@ function get_string_list_value_at(property::Ref{_Property}, index::Cint)
    return out
    end
    """
    function get_string_list_value_at(entity::Ref{_Entity}, index::Cint)
    Return the value of the TEXT list of the given `entity` at the position `index`.
    """
    function get_string_list_value_at(entity::Ref{_Entity}, index::Cint)
    out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
    err_code = ccall(
    (:caosdb_entity_entity_get_string_list_value_at, CaosDB.library_name),
    Cint,
    (Ref{_Entity}, Ref{Ptr{UInt8}}, Cint),
    entity,
    out,
    index - Cint(1),
    )
    CaosDB.Exceptions.evaluate_return_code(err_code)
    out = unsafe_string(out[])
    return out
    end
    """
    function get_version_id(entity::Ref{_Entity})
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment