Skip to content
Snippets Groups Projects
Verified Commit 69aeeda2 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Access children and start_time for FixedBlock

parent f6c2ca9c
No related branches found
No related tags found
No related merge requests found
module FixedBlocks
import ...BuildingBlocks: ContainerBlock
import ...BuildingBlocks: BuildingBlock, ContainerBlock
import ...Gradients: FixedGradient
import ...Pulses: FixedPulse
import ...Variables: duration, variables
......@@ -44,11 +44,30 @@ struct FixedBlock <: ContainerBlock
end
end
Base.getindex(fb::FixedBlock, index::Symbol) = fb[Val(index)]
Base.getindex(fb::FixedBlock, ::Val{:pulse}) = fb.pulse
Base.getindex(fb::FixedBlock, ::Val{:gradient}) = fb.gradient
duration(fb::FixedBlock) = fb.duration
variables(::Type{<:FixedBlock}) = []
fixed(wb::WaitBlock) = FixedBlock(value(duration(wb)))
start_time(fb::FixedBlock, index::Symbol) = start_time(fb, Val(index))
start_time(fb::FixedBlock, ::Val{:pulse}) = fb.pulse_delay
start_time(fb::FixedBlock, ::Val{:gradient}) = fb.gradient_delay
function get_children_blocks(fb::FixedBlock)
res = Tuple{Symbol, BuildingBlock}[]
if !isnothing(fb.pulse)
push!((:pulse, fb.pulse))
end
if !isnothing(fb. gradient)
push!((:gradient, fb.gradient))
end
return res
end
end
\ No newline at end of file
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