Element Links in Array Mode¶
The basic implementation of element links is a column of LinkIndexType
(defined in the columnar mode) that contains the index in the target
container, or invalidLinkValue for invalid links. And if the link
column will only ever reference target in a single container then that
is about it.
The complication comes in once a link can point to one of several
containers. In that case the link will also need to encode the container
for each link. For that the uppermost byte of the link is used for a
container key. There are functions in the ColumnarMode definition that
handle the packing and unpacking of link values, so that this can be
easily changed without touching the accessor implementations.
To decode that container key one then also needs a separate key column that contains the key of each requested container in the order requested. That doesn't need to include all of the containers present in the input column, but all the containers not listed will be assigned a key not in the key column.
The key column is specific to the accessor that requested the link. Due to the way the key columns are requested there can currently only be one key column for each link column, and with that link columns need to list the exact same target containers. For individual tools that is usually not an issue, but it is a severe limitation for chaining tools in a sequence, and as such needs to be changed.
Since none of this corresponds directly to how links are stored in PHYSLITE, this requires some reformatting of the links after they've been read. Currently there is no central support for that, and in the PHYSLITE that is completely hand-coded. In the future there should likely be a single central implementation for that.
There is currently no support for output links, but that is not a fundamental issue. It's simply a feature that was never needed and could likely be added easily if ever needed.