diff options
author | Thomas White <taw@physics.org> | 2023-11-15 11:25:15 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2024-02-06 16:59:34 +0100 |
commit | 7513e4e2849a7a6c03bd5075ad579c2167c41ff5 (patch) | |
tree | 490a5abd5a82424d2ddee50c73f30caefc62af23 | |
parent | 769915be06260591e2bdf5a04849dac269a2d3af (diff) |
Setters for image struct
-rw-r--r-- | julia/CrystFEL/src/image.jl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/julia/CrystFEL/src/image.jl b/julia/CrystFEL/src/image.jl index 0ffb8474..868afdc4 100644 --- a/julia/CrystFEL/src/image.jl +++ b/julia/CrystFEL/src/image.jl @@ -63,6 +63,23 @@ function Base.getproperty(image::Image, name::Symbol) end +function Base.setproperty!(image::Image, name::Symbol, val) + if name === :internalptr + setfield!(image, :internalptr, val) + else + idata = unsafe_load(image.internalptr) + if name === :peaklist + if val isa PeakList + setproperty!(idata, name, val.internalptr) + unsafe_store!(image.internalptr, idata) + else + throw(ArgumentError("Must be a PeakList")) + end + end + end +end + + function Base.propertynames(image::Image; private=false) if private fieldnames(InternalImage) |