dive table and pointers
dirk at hohndel.org
Thu Dec 26 14:06:04 UTC 2013
you asked this on IRC while I was unavailable:
There are good reasons why you can't keep pointers to dives around and
why you can't simply claim that the position in the dive table
represents a specific dive:
Things move around.
If you download dives from a dive computer or import dives from a file
or webservice, dives could be merged - that creates a new merged dive
and the two original dives are discarded, so the pointer to a dive could
become invalid. Similarly, if you edit a dive and change its start time,
the order of the dives in the dive table can change and your "dive #n"
in the table might actually be a different dive.
Of course we could keep a meta structure that stays consistent across
all these operations. You'd get a 'key' that identifies a dive and that
key would always give you that dive until it no longer exists.
Would that make your life easier? I'll be happy to look into a way to
organize our data that way - but it will require some very careful work
to make sure that all of the manipulations of the dive table that we do
today continue to keep this in a consistent state.
More information about the subsurface