diff --git a/src/Entity.jl b/src/Entity.jl index 9c23a8ee1794bbd5710b829b8f29d6b7124bfb3c..5b04ac2c4295f483ae82311463fa544d1babe783 100644 --- a/src/Entity.jl +++ b/src/Entity.jl @@ -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 = "")