Next: Initialisation Options
Up: ACCESSING ARRAY COMPONENTS
Previous: Writing and Modifying Array Component Values
The mapping mode argument of NDF_MAP is used to
indicate how the transfer of mapped values should be handled when an array
component is accessed.
The three basic mapping modes `READ', `UPDATE' and `WRITE' each has a
separate use, and the following describes how they operate in detail:
- `READ' -
- When an array component is mapped for `READ'
access, its pre-existing values are read into memory and made available to
the calling routine (if the component's state is undefined, then an error
will result since there will be no values to read).
When the component is unmapped, the mapped values are discarded.
If any have been modified they do not result in a permanent change to the
data structure (in fact the values should not be modified, because the
region of memory used may sometimes be write-protected and this will result
in a run-time error).
- `UPDATE' -
- When an array component is mapped for `UPDATE' access,
its pre-existing values are read into memory exactly as for `READ' access (an
error will similarly be produced if the component is in an undefined state).
When the component is unmapped, any modifications made to the mapped values
are written back to the NDF, which is therefore permanently modified.
- `WRITE' -
- When an array component is mapped for `WRITE'
access, an array is created to receive new values, but no pre-existing
values are read in.
Since the mapped array is un-initialised it may contain garbage at this
point.
All elements of the array must therefore be assigned values by the
application before the component is unmapped, at which point these values
will be written to the data structure to become permanent.
`WRITE' access will succeed even if the component is initially in an
undefined state, and the component's state will become defined once the
unmapping operation has completed successfully.
Next: Initialisation Options
Up: ACCESSING ARRAY COMPONENTS
Previous: Writing and Modifying Array Component Values
Starlink User Note 33
R.F. Warren-Smith
11th January 2000
E-mail:rfws@star.rl.ac.uk
Copyright © 2000 Council for the Central Laboratory of the Research Councils