next up previous 107
Next: Passing information between primitives
Up: Writing a Primitive
Previous: Log Files


Temporary and intermediate files

In many cases, it is necessary to make use of temporary files within a primitive, either for intermediate data steps that are not relevant for the frame, or as text files input to external tasks. Since these are not required once the primitive is finished a class is provided for dealing with temporary files (ORAC::TempFile).

This class will choose a filename and, optionally, open the file ready for read-write access (when this facility is used it is guaranteed that the file is unique and will not overwrite any existing file). The file, and any files of the same name but with a .sdf extension6, are removed when the variable goes out of scope.

The only files that should remain when a primitive completes should be those registered with the current frame or the current group. All others should be temporary and should be tidied up on leaving the primitive (which is automatic if ORAC::TempFile is used)7. This allows the final tidyup primitive to be responsible solely for removing unwanted intermediate frames that were the product of individual primitives (every time a the file name is updated in a frame object the previous value is stored for possible later removal by the tidy primitive).



next up previous 107
Next: Passing information between primitives
Up: Writing a Primitive
Previous: Log Files

ORAC-DR -- Programmer's Guide
Starlink User Note 233
Tim Jenness, Frossie Economou, Brad Cavanagh
Joint Astronomy Centre, Hilo, Hawaii
June 2004
E-mail:ussc@star.rl.ac.uk

Copyright © 2004 Particle Physics and Astronomy Research Council