IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 21 years ago

Closed 21 years ago

Last modified 21 years ago

#315 closed defect (fixed)

psMetadataIteratorSet

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

Description

Iterating using regex seems a bit awkward, as there is no good way to set the
iterator at the first match of regex. If you use psMetadataIteratorSet(md,0),
you can set the iterator to the first on the list, but you need to know if that
matches the regular expression, and if not, call psMetadataGetAndIncrement to
search for the first matching occurrance.

I think that psMetadataIteratorSet should take a regex parameter just like
psMetadataGetAndIncrement. PS_LIST_HEAD would position to the first matching
regex, PS_LIST_TAIL would position to the last matching regex, and n>0 would
position to the (n-1)th matching occurrance.

In other words, regex would be used to virtually subset the list and one could
consider oneself iterating over that subset.

psMetadataIteratorSet(psListIterator* iter, int location, const char* regex);

-rdd

Change History (5)

comment:1 by Paul Price, 21 years ago

Owner: changed from Paul Price to eugene

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

I was pondering this last-night and concluded that maybe the best thing would be
to make a psMetadataIterator struct like this:

typedef struct {

psListIterator iter;
const char* regex;

} psMetadataIterator;

and then have a allocator like this:

psMetadataIterator(psMetadata* md, const char* regex, int location);

and then drop the regex from the other psMetadataIterator functions, i.e.,
psMetadataGetAndIncrement, etc.

If there was a desire to have a mutable iterator, one could add that in if
psMetadataIterator had its own set of functions as opposed to using
psListIterator functions.

-rdd

comment:3 by eugene, 21 years ago

Resolution: fixed
Status: newclosed

I like this; it seems like a reasonable improvement over the original API
let's go with this model.

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

Resolution: fixed
Status: closedreopened

The latest SDRS does not match what I thought we agreed upon here, namely regex
is not an input of psMetadataIteratorAlloc but is still in
psMetadataGetAndIncrement/Decrement.

Rel5 has what I thought was agreed upon here; please review that and tell me if
that looks to be what was expected.

-rdd

comment:5 by eugene, 21 years ago

Resolution: fixed
Status: reopenedclosed

the rel5 implementation is what we agreed to. I've fixed the working version of
the SDRS and will include this fix in the next update.

Note: See TracTickets for help on using tickets.