IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 12, 2004, 12:15:39 PM (22 years ago)
Author:
desonia
Message:

Added addition doxygen comments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psList.h

    r974 r1017  
    1010 *  @ingroup LinkedList
    1111 *
    12  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-06-10 01:58:06 $
     12 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-06-12 22:15:39 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242typedef struct psListElem
    4343{
    44     struct psListElem *prev;           ///< previous link in list
    45     struct psListElem *next;           ///< next link in list
     44    struct psListElem *prev;            ///< previous link in list
     45    struct psListElem *next;            ///< next link in list
    4646    void *data;                         ///< real data item
    4747}
    4848psListElem;
    4949
    50 /** Doubly-linked list */
     50/** The psList Linked list structure.  User should not allocate this struct
     51 *  directly; rather the psListAlloc should be used.
     52 *
     53 *  @see psListAlloc, psListFree
     54 */
    5155typedef struct
    5256{
    5357    unsigned int size;                  ///< number of elements on list
    54     psListElem* head;                  ///< first element on list (may be NULL)
    55     psListElem* tail;                  ///< last element on list (may be NULL)
    56     psListElem* iter;                  ///< iteration cursor
     58    psListElem* head;                   ///< first element on list (may be NULL)
     59    psListElem* tail;                   ///< last element on list (may be NULL)
     60    psListElem* iter;                   ///< iteration cursor
    5761    unsigned int iterIndex;             ///< the numeric position of the iteration cursor in the list
    5862    pthread_mutex_t lock;               ///< mutex to lock a node during changes
     
    6064psList;
    6165
    62 /** Constructor */
    63 psList *psListAlloc(
    64     void *data                          ///< initial data item; may be NULL
     66/** Creates a psList linked list object.
     67 *
     68 *  @return psList*     A new psList object.
     69 */
     70psList* psListAlloc(
     71    void *data
     72    ///< initial data item; may be NULL if no an empty psList is desired
    6573)
    6674;
    6775
    6876#include "psMemory.h"
    69 /** Destructor */
     77/** Destroys a psList linked list object.  This also frees the elements of the
     78 *  list using the psFreeFcn given, if any.  If no psFreeFcn is specified,
     79 *  the elements are just dereferenced via psMemDecrRefCounter(...).
     80 *
     81 */
    7082void psListFree(
    71     psList* restrict list,             ///< list to destroy
     83    psList* restrict list,              ///< list to destroy
    7284    psFreeFcn elemFree                  ///< destructor for data on list
    7385);
    7486
    75 /** Add to list */
     87/** Adds an element to a psList at position given.
     88 *
     89 *  @return psList*     The psList with added data item.  If list parameter is
     90 *                      NULL, the return value will also be NULL.
     91 */
    7692psList* psListAdd(
    77     psList* restrict list,             ///< list to add to (may be NULL)
    78     void* data,                         ///< data item to add
    79     int where                           ///< index, PS_LIST_HEAD, or PS_LIST_TAIL
     93    psList* restrict list,              ///< list to add to (if NULL, nothing is done)
     94    void* data,                         ///< data item to add.  If NULL, list is not modified.
     95    int where                           ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
    8096);
    8197
    82 /** Append to a list */
     98/** Appends an item to a psList.
     99 *
     100 *  @return psList*     The psList with added data item.  If list parameter is
     101 *                      NULL, the return value will also be NULL.
     102 */
    83103psList* psListAppend(
    84     psList* restrict list,             ///< list to append to (may be NULL)
    85     void *data                          ///< data item to add
     104    psList* restrict list,              ///< list to append to (if NULL, nothing is done)
     105    void *data                          ///< data item to add. If NULL, list is not modified.
    86106);
    87107
    88 /** Remove from a list */
     108/** Remove an item from a list.  If which parameter is PS_LIST_UNKNOWN,
     109 *
     110 *  @return void*       The data item that was removed.  If NULL, no item was
     111 *                      removed.
     112 */
    89113void* psListRemove(
    90     psList* restrict list,             ///< list to remove element from
    91     void *data,                         ///< data item to remove
    92     int which                           ///< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV
     114    psList* restrict list,
     115    ///< list to remove element from
     116    void *data,
     117    ///< if which is PS_LIST_UNKNOWN, data item to find and remove, otherwise this is ignored.
     118    int which
     119    ///< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV, or numbered location.
    93120);
    94121
    95 /** Retrieve from a list */
     122/** Retrieve an item from a list.
     123 *
     124 *  @return void*       the item corresponding to the which parameter.  If
     125 *                      which is invalid (e.g., a numbered index greater
     126 *                      than the list size or if the list is empty), a
     127 *                      NULL is returned.
     128 */
    96129void* psListGet(
    97130    psList* restrict list,             ///< list to retrieve element from
    98     int which                           ///< index of item, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
     131    int which                          ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
    99132);
    100133
    101 /** Set the iterator */
     134/** Set the iterator of the list to a given position.  If where is invalid the
     135 *  iterator position is not changed.
     136 *
     137 */
    102138void psListSetIterator(
    103139    psList* restrict list,             ///< list to retrieve element from
    104     int where                           ///< index, PS_LIST_HEAD, or PS_LIST_TAIL
     140    int where                           ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
    105141);
    106142
    107 /** Get next element relative to iter */
     143/** Get next element relative to the iterator.  This also moves the iterator to
     144 *  the next list position.
     145 *
     146 *  @return void*       the data item next on the list or NULL if the iterator
     147 *                      is already pointing to the last element or the list
     148 *                      parameter was NULL.
     149 */
    108150void* psListGetNext(
    109151    psList* restrict list              ///< list to retrieve element from
    110152);
    111153
    112 /** Get current element at iter */
     154/** Get current element according to the psList's iterator cursor.  This does
     155 *  not move the iterator location.
     156 *
     157 *  @return void*       the data item cooresponding to current iterator
     158 *                      cursor position of the list, or NULL if either the
     159 *                      iterator is not valid or list parameter was NULL.
     160 */
    113161void* psListGetCurrent(
    114162    psList* restrict list              ///< list to retrieve element from
    115163);
    116164
    117 /** Get prev element relative to iter */
     165/** Get previous element relative to list's iterator. This also moves the
     166 *  iterator to the previous list position.
     167 *
     168 *  @return void*       the data item previous on the list or NULL if the iterator
     169 *                      is already pointing to the first element or the list
     170 *                      parameter was NULL.
     171 */
    118172void* psListGetPrevious(
    119173    psList* restrict list              ///< list to retrieve element from
    120174);
    121175
    122 /** Convert doubly-linked list to an array */
     176/** Convert a linked list to an array
     177 *
     178 *  @return psVector*   A new psVector populated with elements from the list,
     179 *                      or NULL if the given dlist parameter is NULL.
     180 */
    123181psVector* psListToVector(
    124182    psList *dlist                      ///< List to convert
    125183);
    126184
    127 /** Convert array to a doubly-linked list */
     185/** Convert array to a doubly-linked list
     186 *
     187 *  @return psList*     A new psList populated with elements formt the psVector,
     188 *                      or NULL is the given arr parameter is NULL.
     189 */
    128190psList* psVectorToList(
    129     psVector* arr                       ///< vector to convert
     191    psVector* arr                      ///< vector to convert
    130192);
    131193
Note: See TracChangeset for help on using the changeset viewer.