IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 27, 2004, 1:18:42 PM (22 years ago)
Author:
Paul Price
Message:

Fixed order of psList arguments to match those for psMetadata.
Replaced horrible "which" and "where" arguments with "iterator" and
"location", which are more descriptive.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/psLibSDRS.tex

    r1639 r1645  
    1 %%% $Id: psLibSDRS.tex,v 1.89 2004-08-27 21:38:46 price Exp $
     1%%% $Id: psLibSDRS.tex,v 1.90 2004-08-27 23:18:42 price Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    14341434
    14351435\begin{verbatim}
    1436 bool psListAdd(psList *list, void *data, int where);
     1436bool psListAdd(psList *list, int location, void *data);
    14371437\end{verbatim}
    14381438Add an entry to the list with this function, which takes a pointer to
    14391439the list and returns a boolean giving the success or failure of the
    1440 operation. The value of \code{where} specifies if the specified data
    1441 item should be placed on the front of the list (\code{PS_LIST_HEAD}),
    1442 at the end of the list (\code{PS_LIST_TAIL}), to add after
    1443 (\code{PS_LIST_NEXT}) or before (\code{PS_LIST_PREV}) the current
    1444 element (specified by the iteration cursor), or an index that the new
    1445 \code{data} should inhabit.
    1446 
    1447 \begin{verbatim}
    1448 void *psListGet(psList *list, int which);
     1440operation. The value of \code{location} specifies if the specified
     1441data item should be placed on the front of the list
     1442(\code{PS_LIST_HEAD}), at the end of the list (\code{PS_LIST_TAIL}),
     1443to add after (\code{PS_LIST_NEXT}) or before (\code{PS_LIST_PREV}) the
     1444current element (specified by the iteration cursor), or an index that
     1445the new \code{data} should inhabit.
     1446
     1447\begin{verbatim}
     1448void *psListGet(psList *list, int location);
    14491449\end{verbatim}
    14501450A data item may be retrieved from the list with this function.  The
    1451 value of \code{which} may be the numerical index or it may be one of
    1452 the special values: \code{PS_LIST_HEAD}, \code{PS_LIST_TAIL},
    1453 \code{PS_LIST_PREV}, and \code{PS_LIST_NEXT}, all of which are
    1454 defined as negative integers, allowing \code{where} to also be the
    1455 index of one of the data items.
    1456 
    1457 \begin{verbatim}
    1458 bool psListRemove(psList *list, void *data, int which);
     1451value of \code{location} may be the numerical index or it may be one
     1452of the special values: \code{PS_LIST_HEAD}, \code{PS_LIST_TAIL},
     1453\code{PS_LIST_PREV}, and \code{PS_LIST_NEXT}, all of which are defined
     1454as negative integers, allowing \code{location} to also be the index of
     1455one of the data items.
     1456
     1457\begin{verbatim}
     1458bool psListRemove(psList *list, int location, void *data);
    14591459\end{verbatim}
    14601460A data item may be removed from the list with this function.  The
    1461 value of \code{which} may be the numerical index or it may be one of
    1462 the special values: \code{PS_LIST_HEAD}, \code{PS_LIST_TAIL},
    1463 \code{PS_LIST_PREV}, \code{PS_LIST_UNKNOWN}, and
    1464 \code{PS_LIST_NEXT}, all of which are defined as negative integers.
    1465 If the value of \code{which} is \code{PS_LIST_UNKNOWN}, then the data
    1466 item is identified by matching the pointer value with \code{void
    1467 *data}.  The function returns a value of \code{true} if the operation
    1468 was successfull, and \code{false} otherwise.
     1461value of \code{location} may be the numerical index or it may be one
     1462of the special values: \code{PS_LIST_HEAD}, \code{PS_LIST_TAIL},
     1463\code{PS_LIST_PREV}, \code{PS_LIST_UNKNOWN}, and \code{PS_LIST_NEXT},
     1464all of which are defined as negative integers.  If the value of
     1465\code{location} is \code{PS_LIST_UNKNOWN}, then the data item is
     1466identified by matching the pointer value with \code{void *data}.  The
     1467function returns a value of \code{true} if the operation was
     1468successful, and \code{false} otherwise.
    14691469
    14701470All data items placed onto lists (\code{psListAdd}) must have their
     
    14851485
    14861486\begin{verbatim}
    1487 void psListSetIterator(psList *list, int where, int which);
    1488 void *psListGetNext(psList *list, int which);
    1489 void *psListGetPrevious(psList *list, int which);
     1487void psListSetIterator(psList *list, int iterator, int location);
     1488void *psListGetNext(psList *list, int iterator);
     1489void *psListGetPrevious(psList *list, int iterator);
    14901490\end{verbatim}
    14911491Iteration over all elements of the list using the iteration cursor
    14921492\code{iter} is provided by these functions.  The first of these
    1493 functions uses the value of \code{where} to set the iteration cursor
    1494 for the given list to the beginning \code{PS_LIST_HEAD} or the end
    1495 \code{PS_LIST_TAIL} for the iterator specified by \code{which}.  The
    1496 next two functions move the iteration cursor forward or backwards,
     1493functions uses the value of \code{location} to set the iteration
     1494cursor for the given list to the beginning \code{PS_LIST_HEAD} or the
     1495end \code{PS_LIST_TAIL} for the iterator specified by \code{iterator}.
     1496The next two functions move the iteration cursor forward or backwards,
    14971497returning the data item from the resulting list entry, or returning
    14981498\code{NULL} at the end of the list.  Explicit traversal of the list
     
    33603360\begin{verbatim}
    33613361psMetadataItem *psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...);
    3362 psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment, va_list list);
     3362psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type,
     3363                                     const char *comment, va_list list);
    33633364\end{verbatim}
    33643365
     
    33783379\code{psMetadataAdd} takes a pointer or value which is interpreted by
    33793380the function using variadic argument interpretation.  Both functions
    3380 take an parameter \code{where} which specifies where in the list to
     3381take an parameter \code{location} which specifies where in the list to
    33813382place the element, following the conventions for the \code{psList}.
    33823383Care should be taken not to leak memory when appending an item for
     
    33853386%
    33863387\begin{verbatim}
    3387 bool psMetadataAddItem(psMetadata *md, int where, psMetadataItem *item);
    3388 bool psMetadataAdd(psMetadata *md, int where, const char *name, int format, const char *comment, ...);
     3388bool psMetadataAddItem(psMetadata *md, psMetadataItem *item, int location);
     3389bool psMetadataAdd(psMetadata *md, int location, const char *name, int format, const char *comment, ...);
    33893390\end{verbatim}
    33903391
    33913392Items may be removed from the metadata by specifying a key or a
    33923393location in the list.  If the value of \code{name} is \code{NULL}, the
    3393 value of \code{where} is used.  If the value of \code{name} is not
    3394 \code{NULL}, then \code{where} must be set to \code{PS_LIST_UNKNOWN}.
    3395 If the key matches a metadata item, the item is removed from the
    3396 metadata and \code{true} is returned; otherwise, \code{false} is
    3397 returned.  If the key is not unique, then \emph{all} items
    3398 corresponding to the key are removed, and \code{true} is returned.
    3399 %
    3400 \begin{verbatim}
    3401 bool psMetadataRemove(psMetadata *md, int where, const char *key);
     3394value of \code{location} is used.  If the value of \code{name} is not
     3395\code{NULL}, then \code{location} must be set to
     3396\code{PS_LIST_UNKNOWN}.  If the key matches a metadata item, the item
     3397is removed from the metadata and \code{true} is returned; otherwise,
     3398\code{false} is returned.  If the key is not unique, then \emph{all}
     3399items corresponding to the key are removed, and \code{true} is
     3400returned.
     3401%
     3402\begin{verbatim}
     3403bool psMetadataRemove(psMetadata *md, int location, const char *key);
    34023404\end{verbatim}
    34033405
     
    34123414\code{psList}.
    34133415\begin{verbatim}
    3414 psMetadataItem *psMetadataGet(const psMetadata *md, int which);
     3416psMetadataItem *psMetadataGet(const psMetadata *md, int location);
    34153417\end{verbatim}
    34163418
    34173419The metadata may be iterated over by (re-)setting a particular
    3418 iterator, \code{which}, to a location in the \code{psMetadata} list,
    3419 and getting the previous or next item.  \code{psMetadataGetNext} has
    3420 the ability to match the beginning of a key, e.g., if the user only
    3421 wants to iterate through \code{IPP.machines.sky} and doesn't want to
    3422 bother with \code{IPP.machines.detector}.  The iterator should iterate
    3423 over every item of metadata --- even those that are non-unique.  The
    3424 value \code{which} specifies the iterator to be used.  In setting the
    3425 iterator, the position of the iterator is defined by \code{where},
     3420\code{iterator}, to a location in the \code{psMetadata} list, and
     3421getting the previous or next item.  \code{psMetadataGetNext} has the
     3422ability to match the beginning of a key, e.g., if the user only wants
     3423to iterate through \code{IPP.machines.sky} and doesn't want to bother
     3424with \code{IPP.machines.detector}.  The iterator should iterate over
     3425every item of metadata --- even those that are non-unique.  The value
     3426\code{iterator} specifies the iterator to be used.  In setting the
     3427iterator, the position of the iterator is defined by \code{location},
    34263428which follows the conventions of the \code{psList} iterators.
    34273429\begin{verbatim}
    3428 void psMetadataSetIterator(psMetadata *md, int which, int where);
    3429 psMetadataItem *psMetadataGetNext(psMetadata *md, const char *match, int which);
    3430 psMetadataItem *psMetadataGetPrevious(psMetadata *md, const char *match, int which);
     3430void psMetadataSetIterator(psMetadata *md, int iterator, int location);
     3431psMetadataItem *psMetadataGetNext(psMetadata *md, const char *match, int iterator);
     3432psMetadataItem *psMetadataGetPrevious(psMetadata *md, const char *match, int iterator);
    34313433\end{verbatim}
    34323434
Note: See TracChangeset for help on using the changeset viewer.