Skip to content
Snippets Groups Projects
Commit e365f6e6 authored by florian's avatar florian
Browse files

DRAFT: Introduce datatype and value structs

parent 689dac08
No related branches found
No related tags found
1 merge request!13ENH: Use new value and datatype structs
Pipeline #13818 failed
......@@ -195,6 +195,66 @@ mutable struct _Message
end
end
"""
Struct containing a pointer to the wrapped cpp DataType object. Meant for
internal use only; use `CaosDB.Entity.create_<type>_datatype` to create a
valid _DataType object or use the `set/get_datatype` functions.
"""
mutable struct _DatatType
wrapped_datatype::Ptr{Cvoid}
_deletable::Bool
function _DatatType(managed_by_julia::Bool = false)
datatype = new()
datatype._deletable = false
if managed_by_julia
function f(t)
ccall(
(:caosdb_entity_delete_datatype, CaosDB.library_name),
Cint,
(Ref{_DatatType},),
Ref{_DataType}(t),
)
end
finalizer(f, datatype)
end
return datatype
end
end
"""
Struct containing a pointer to the wrapped cpp AbstractValue object. Meant for
internal use only; use `CaosDB.Entity.create_value` to create a _Value object or
use the `set/get_value` functions`.
"""
mutable struct _Value
wrapped_value::Ptr{Cvoid}
_deletable::Bool
function _Value(managed_by_julia::Bool = false)
value = new()
value._deletable = false
if managed_by_julia
function f(t)
ccall(
(:caosdb_entity_delete_value, CaosDB.library_name),
Cint,
(Ref{_Value},),
Ref{_Value}(t),
)
end
finalizer(f, value)
end
return value
end
end
"""
function create_entity(name::AbstractString = "")
......
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