IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 21 years ago

Closed 21 years ago

Last modified 20 years ago

#562 closed defect (fixed)

psFitsOpen mode parameter definition

Reported by: robert.desonia@… Owned by: eugene
Priority: high Milestone:
Component: PSLib SDRS Version: unspecified
Severity: normal Keywords:
Cc:

Description

In the SDRS, the 'mode' parameter is defined to be either 'r', 'r+', 'rw', or 'w'. There are two distinct
problems with this:

  1. mode is a const char, not a const char*, i.e., a string. This makes multiple character values like 'r+'

or 'rw' impossible.

  1. CFITSIO supports only two options: read-only or read-write. The 'w' value, i.e. write-only, is not

possible.

Givent the limitations of CFITSIO, I suggest that the mode parameter be simplified to a boolean value to
indicate if the file is to be writable, e.g.:

psFits* psFitsOpen(const char* filename, bool writable);

-rdd

Change History (3)

comment:1 by robert.desonia@…, 21 years ago

Owner: changed from Paul Price to eugene

comment:2 by Paul Price, 21 years ago

Cc: price@… added
Status: newassigned

The intent was not only to prevent certain operations from being performed, but
also to specify the behaviour when the file exists:
"r": Opened read-only
"r+" or "rw": Opened read-write.
"w": Empty file created (perhaps like an open followed by a psFitsTruncate?)

I think this is a trinary choice, not binary so that we can't use a single
boolean. We could use two booleans, one to say if the file is writeable, and
one to say if we should open a new file for writing. Perhaps this is more in
keeping with the lack of a write-only ability.

Thoughts?

comment:3 by Paul Price, 21 years ago

Resolution: fixed
Status: assignedclosed

Gene prefers that we should mimic fopen().

I fixed the missing * in the prototype:

psFits *psFitsOpen(const char *filename, const char *mode);

Note: See TracTickets for help on using tickets.