IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 21 years ago

Closed 21 years ago

Last modified 21 years ago

#308 closed defect (fixed)

Variable argument functions not SWIGable.

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

Description

Functions like psMetadataAdd use variable argument lists (the '...' in the
prototype), but that C functionality is not supported by SWIG. This requires
creating SWIG-only functions to wrap these functions with the various types
supported, so I suggest that change is folded into psLib as well. For example
psMetadataAdd would be replaced by:

psMetadataAddBool(psMetadata* md, int location, const char* name, int format,
const char* comment, psBool data);
psMetadataAddS32(psMetadata* md, int location, const char* name, int format,
const char* comment, psS32 data);
psMetadataAddF32(psMetadata* md, int location, const char* name, int format,
const char* comment, psF32 data);
psMetadataAddF64(psMetadata* md, int location, const char* name, int format,
const char* comment, psF64 data);
psMetadataAddList(psMetadata* md, int location, const char* name, int format,
const char* comment, psList* data);
psMetadataAddMeta(psMetadata* md, int location, const char* name, int format,
const char* comment, psMetadata* data);
psMetadataAddStr(psMetadata* md, int location, const char* name, int format,
const char* comment, char* data);
psMetadataAddVector(psMetadata* md, int location, const char* name, int format,
const char* comment, psVector* data);
...
psMetadataAddOther(psMetadata* md, int location, const char* name, int format,
const char* comment, psPtr* data);


-rdd

Change History (8)

comment:1 by Paul Price, 21 years ago

Owner: changed from Paul Price to eugene

comment:2 by eugene, 21 years ago

Status: newassigned

Yes, we've known about this for a while, and this is the solution, more-or-less,
that we had assumed for the SWIG interfaces. However, as a C-API, we would like
to keep the existence of the varargs version as well. I would expect the
underlying code to already make a switch and pass arguments to functions like
those listed above.

I think you can simplify things further. The type is still being passed via
format, so all pointer type entries can be passed as a pointer and the behavior
interpretted in the called function on the basis of the type part of the format.

For the non-pointer types, C will promote F32 data to F64, so I think you only

need the F64 version. The same is true for ints, though you need a signed and
unsigned version (S64 and U64), I think.

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

So, should the functions required for SWIG be exposed in the C API as well?

comment:4 by eugene, 21 years ago

Resolution: fixed
Status: assignedclosed

yes, fold these back into the C API

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

Resolution: fixed
Status: closedreopened

I don't think that the format parameter is sufficient to determine the specific
typing information, as PS_META_PRIMATIVE can be psS32, psF32, psF64, etc.

The same problem exists for other functions like psMetadataItemAlloc as well.
The solution that Ross implemented was to add an additional parameter for the
primitive type (pType), but that seems not very palettable to me.

I suggest replacing the PS_META_PRIMITIVE psMetadataType enum with PS_META_S32,
PS_META_F32, etc., so that psMetadataType definitively specifies the type.

-rdd

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

Resolution: fixed
Status: reopenedclosed

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

I don't know if this should be added to the SDRS or not.

comment:8 by Paul Price, 21 years ago

psMetadata has been updated for the latest SDRS. Reopen this bug if the problem
is not resolved there.

Note: See TracTickets for help on using tickets.