Sorry for the suggestion about axis_group_ clearing. Now that I've read it
closely, I completely understand what I wrote.
The reason I don't clear out the map is cuz it's actually quite small: an
axis_group_ corresponds to a staff, lyrics, dynamics, etc.. It needs to be
there 100% of the time, so it's correct to not be cleared out until
finalize (it should be cleared out in finalize, however).
What this engraver does is associates axis groups to their contexts, gets
notified when a span bar is created, and creates SpanBarStub in all
contexts that a span bar traverses (skipping over holes if allow-span-bar
is set to false). Contexts need to be associated to vertical-axis-groups
so that vertical sorting can happen (otherwise we don't know which contexts
are higher or lower than other ones).
It seems that all that needs to be done is using some sorta SCM hash
instead of the map, using derived_mark on this hash.
With respect to get_root_vertical_alignment, it can be called on an
arbitrary element because the root vertical alignment of all of them will
be the same save during the first timestep, where nothing has a root
vertical alignment yet.
I hope this answers the "what" and the "how" (the latter of which you
didn't ask for but I figured it wasimportant to state). To sum up:
"you never clear out the map."
the map should not be cleared out until a finalize method.
"You take an _arbitrary_ element of the map (whatever happens to have the
first hash bucket), then call get_root_vertical_alignment on it and work on
This is because the root vertical alignment can come from any of these