Changeset 1645
- Timestamp:
- Aug 27, 2004, 1:18:42 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/doc/pslib/psLibSDRS.tex (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/psLibSDRS.tex
r1639 r1645 1 %%% $Id: psLibSDRS.tex,v 1. 89 2004-08-27 21:38:46price Exp $1 %%% $Id: psLibSDRS.tex,v 1.90 2004-08-27 23:18:42 price Exp $ 2 2 \documentclass[panstarrs,spec]{panstarrs} 3 3 … … 1434 1434 1435 1435 \begin{verbatim} 1436 bool psListAdd(psList *list, void *data, int where);1436 bool psListAdd(psList *list, int location, void *data); 1437 1437 \end{verbatim} 1438 1438 Add an entry to the list with this function, which takes a pointer to 1439 1439 the list and returns a boolean giving the success or failure of the 1440 operation. The value of \code{ where} specifies if the specified data1441 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);1440 operation. The value of \code{location} specifies if the specified 1441 data 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}), 1443 to add after (\code{PS_LIST_NEXT}) or before (\code{PS_LIST_PREV}) the 1444 current element (specified by the iteration cursor), or an index that 1445 the new \code{data} should inhabit. 1446 1447 \begin{verbatim} 1448 void *psListGet(psList *list, int location); 1449 1449 \end{verbatim} 1450 1450 A 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 of1452 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 ofone of the data items.1456 1457 \begin{verbatim} 1458 bool psListRemove(psList *list, void *data, int which);1451 value of \code{location} may be the numerical index or it may be one 1452 of 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 1454 as negative integers, allowing \code{location} to also be the index of 1455 one of the data items. 1456 1457 \begin{verbatim} 1458 bool psListRemove(psList *list, int location, void *data); 1459 1459 \end{verbatim} 1460 1460 A 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 of1462 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 i tem is identified by matching the pointer value with \code{void1467 *data}. The function returns a value of \code{true} if the operation 1468 was successfull, and \code{false} otherwise.1461 value of \code{location} may be the numerical index or it may be one 1462 of 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}, 1464 all of which are defined as negative integers. If the value of 1465 \code{location} is \code{PS_LIST_UNKNOWN}, then the data item is 1466 identified by matching the pointer value with \code{void *data}. The 1467 function returns a value of \code{true} if the operation was 1468 successful, and \code{false} otherwise. 1469 1469 1470 1470 All data items placed onto lists (\code{psListAdd}) must have their … … 1485 1485 1486 1486 \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);1487 void psListSetIterator(psList *list, int iterator, int location); 1488 void *psListGetNext(psList *list, int iterator); 1489 void *psListGetPrevious(psList *list, int iterator); 1490 1490 \end{verbatim} 1491 1491 Iteration over all elements of the list using the iteration cursor 1492 1492 \code{iter} is provided by these functions. The first of these 1493 functions uses the value of \code{ where} to set the iteration cursor1494 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,1493 functions uses the value of \code{location} to set the iteration 1494 cursor for the given list to the beginning \code{PS_LIST_HEAD} or the 1495 end \code{PS_LIST_TAIL} for the iterator specified by \code{iterator}. 1496 The next two functions move the iteration cursor forward or backwards, 1497 1497 returning the data item from the resulting list entry, or returning 1498 1498 \code{NULL} at the end of the list. Explicit traversal of the list … … 3360 3360 \begin{verbatim} 3361 3361 psMetadataItem *psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...); 3362 psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment, va_list list); 3362 psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type, 3363 const char *comment, va_list list); 3363 3364 \end{verbatim} 3364 3365 … … 3378 3379 \code{psMetadataAdd} takes a pointer or value which is interpreted by 3379 3380 the function using variadic argument interpretation. Both functions 3380 take an parameter \code{ where} which specifies where in the list to3381 take an parameter \code{location} which specifies where in the list to 3381 3382 place the element, following the conventions for the \code{psList}. 3382 3383 Care should be taken not to leak memory when appending an item for … … 3385 3386 % 3386 3387 \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, ...);3388 bool psMetadataAddItem(psMetadata *md, psMetadataItem *item, int location); 3389 bool psMetadataAdd(psMetadata *md, int location, const char *name, int format, const char *comment, ...); 3389 3390 \end{verbatim} 3390 3391 3391 3392 Items may be removed from the metadata by specifying a key or a 3392 3393 location 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); 3394 value 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 3397 is removed from the metadata and \code{true} is returned; otherwise, 3398 \code{false} is returned. If the key is not unique, then \emph{all} 3399 items corresponding to the key are removed, and \code{true} is 3400 returned. 3401 % 3402 \begin{verbatim} 3403 bool psMetadataRemove(psMetadata *md, int location, const char *key); 3402 3404 \end{verbatim} 3403 3405 … … 3412 3414 \code{psList}. 3413 3415 \begin{verbatim} 3414 psMetadataItem *psMetadataGet(const psMetadata *md, int which);3416 psMetadataItem *psMetadataGet(const psMetadata *md, int location); 3415 3417 \end{verbatim} 3416 3418 3417 3419 The 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. The3424 value \code{which} specifies the iterator to be used. In setting the3425 iterator, the position of the iterator is defined by \code{ where},3420 \code{iterator}, to a location in the \code{psMetadata} list, and 3421 getting the previous or next item. \code{psMetadataGetNext} has the 3422 ability to match the beginning of a key, e.g., if the user only wants 3423 to iterate through \code{IPP.machines.sky} and doesn't want to bother 3424 with \code{IPP.machines.detector}. The iterator should iterate over 3425 every item of metadata --- even those that are non-unique. The value 3426 \code{iterator} specifies the iterator to be used. In setting the 3427 iterator, the position of the iterator is defined by \code{location}, 3426 3428 which follows the conventions of the \code{psList} iterators. 3427 3429 \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);3430 void psMetadataSetIterator(psMetadata *md, int iterator, int location); 3431 psMetadataItem *psMetadataGetNext(psMetadata *md, const char *match, int iterator); 3432 psMetadataItem *psMetadataGetPrevious(psMetadata *md, const char *match, int iterator); 3431 3433 \end{verbatim} 3432 3434
Note:
See TracChangeset
for help on using the changeset viewer.
