diff options
Diffstat (limited to 'julia/CrystFEL/src/reflists.jl')
-rw-r--r-- | julia/CrystFEL/src/reflists.jl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/julia/CrystFEL/src/reflists.jl b/julia/CrystFEL/src/reflists.jl index 89967d6f..901162e8 100644 --- a/julia/CrystFEL/src/reflists.jl +++ b/julia/CrystFEL/src/reflists.jl @@ -108,6 +108,21 @@ function Base.getindex(reflist::RefList{T}, indices) where T end +function Base.get!(reflist::RefList{T}, indices) where T + + refl = @ccall libcrystfel.find_refl(reflist.internalptr::Ptr{InternalRefList}, + indices[1]::Cint, + indices[2]::Cint, + indices[3]::Cint)::Ptr{InternalReflection} + + if refl == C_NULL + return push!(reflist, indices) + else + return T(refl) + end +end + + function Base.push!(reflist::RefList{T}, indices) where T refl = @ccall libcrystfel.add_refl(reflist.internalptr::Ptr{InternalRefList}, |