IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 9, 2004, 5:19:15 PM (22 years ago)
Author:
Paul Price
Message:

Doxygenation of Lupton stuff partially complete. Still need to hack some more to conform everything to coding standards.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/include/psDlist.h

    r181 r196  
    44 * Support for doubly linked lists
    55 */
     6
     7/** Doubly-linked list element */
    68typedef struct psDlistElem {
    7    struct psDlistElem *prev;            // previous link in list
    8    struct psDlistElem *next;            // next link in list
    9    void *data;                          // real data item
     9   struct psDlistElem *prev;            //!< previous link in list
     10   struct psDlistElem *next;            //!< next link in list
     11   void *data;                          //!< real data item
    1012} psDlistElem;
    1113
     14/** Doubly-linked list */
    1215typedef struct {
    13    int n;                               // number of elements on list
    14    psDlistElem *head;                   // first element on list (may be NULL)
    15    psDlistElem *tail;                   // last element on list (may be NULL)
    16    psDlistElem *iter;                   // iteration cursor
     16   int n;                               //!< number of elements on list
     17   psDlistElem *head;                   //!< first element on list (may be NULL)
     18   psDlistElem *tail;                   //!< last element on list (may be NULL)
     19   psDlistElem *iter;                   //!< iteration cursor
    1720} psDlist;
    1821
    19 enum {                                  // Special values of index into list
    20    PS_DLIST_HEAD = 0,                   // at head
    21    PS_DLIST_TAIL = -1,                  // at tail
    22    PS_DLIST_UNKNOWN = -2,               // unknown position
    23    PS_DLIST_PREV = -3,                  // previous element
    24    PS_DLIST_NEXT = -4                   // next element
     22/** Special values of index into list */
     23enum {
     24   PS_DLIST_HEAD = 0,                   //!< at head
     25   PS_DLIST_TAIL = -1,                  //!< at tail
     26   PS_DLIST_UNKNOWN = -2,               //!< unknown position
     27   PS_DLIST_PREV = -3,                  //!< previous element
     28   PS_DLIST_NEXT = -4                   //!< next element
    2529};
    2630
    2731/*****************************************************************************/
    28 /*
    29  * Constructors and Destructors
    30  */
    31 psDlist *psDlistAlloc(void *data);      // initial data item; may be NULL
     32/** Constructor */
     33psDlist *psDlistAlloc(void *data        //!< initial data item; may be NULL
     34    );
    3235
    33 void psDlistFree(psDlist *list,         // list to destroy
    34                 void (*elemFree)(void *)); // destructor for data on list
     36/** Destructor */
     37void psDlistFree(psDlist *list,         //!< list to destroy
     38                void (*elemFree)(void *) //!< destructor for data on list
     39    );
    3540
    3641/*
    3742 * List maintainence functions
    3843 */
    39 psDlist *psDlistAdd(psDlist *list,      // list to add to (may be NULL)
    40                     void *data,         // data item to add
    41                     int where);         // index, PS_DLIST_HEAD, or PS_DLIST_TAIL
    42 psDlist *psDlistAppend(psDlist *list,   // list to append to (may be NULL)
    43                        void *data);     // data item to add
    44 void *psDlistRemove(psDlist *list,      // list to remove element from
    45                     void *data,         // data item to remove
    46                     int which);         // index of item, or PS_DLIST_UNKNOWN,
    47                                         // or PS_DLIST_NEXT, or PS_DLIST_PREV
    48 void *psDlistGet(const psDlist *list,   // list to retrieve element from
    49                  int which);            // index of item, or PS_DLIST_NEXT,
    50                                         // or PS_DLIST_PREV
     44
     45/** Add to list */
     46psDlist *psDlistAdd(psDlist *list,      //!< list to add to (may be NULL)
     47                    void *data,         //!< data item to add
     48                    int where           //!< index, PS_DLIST_HEAD, or PS_DLIST_TAIL
     49    );
     50
     51/** Append to a list */
     52psDlist *psDlistAppend(psDlist *list,   //!< list to append to (may be NULL)
     53                       void *data       //!< data item to add
     54    );
     55
     56/** Remove from a list */
     57void *psDlistRemove(psDlist *list,      //!< list to remove element from
     58                    void *data,         //!< data item to remove
     59                    int which           //!< index of item, or PS_DLIST_UNKNOWN, or PS_DLIST_NEXT, or
     60                                        //!< PS_DLIST_PREV
     61    );
     62
     63/** Retrieve from a list */
     64void *psDlistGet(const psDlist *list,   //!< list to retrieve element from
     65                 int which              //!< index of item, or PS_DLIST_NEXT, or PS_DLIST_PREV
     66    );
     67
    5168/*
    5269 * convenience functions to use psDlistGet as an iterator
    5370 */
    54 void psDlistSetIterator(psDlist *list, int where, int which);
    55 void *psDlistGetNext(psDlist *list, int which);
    56 void *psDlistGetPrev(psDlist *list, int which);
    57 /*
    58  * Conversions to/from arrays
    59  */
    60 psVoidPtrArray *psDlistToArray(psDlist *dlist);
    61 psDlist *psArrayToDlist(psVoidPtrArray *arr);
     71
     72/** Set the iterator */
     73void psDlistSetIterator(psDlist *list,  //!< list to retrieve element from
     74                        int where,      //!< index, PS_DLIST_HEAD, or PS_DLIST_TAIL
     75                        int which       //!< index of item, or PS_DLIST_UNKNOWN, or PS_DLIST_NEXT, or
     76                                        //!< PS_DLIST_PREV
     77    );
     78
     79/** Get next element */
     80void *psDlistGetNext(psDlist *list,     //!< list to retrieve element from
     81                     int which          //!< index of item, or PS_DLIST_UNKNOWN, or PS_DLIST_NEXT, or
     82                                        //!< PS_DLIST_PREV
     83    );
     84
     85/** Get previous element */
     86void *psDlistGetPrev(psDlist *list,     //!< list to retrieve element from
     87                     int which          //!< index of item, or PS_DLIST_UNKNOWN, or PS_DLIST_NEXT, or
     88                                        //!< PS_DLIST_PREV
     89    );
     90
     91
     92/** Convert doubly-linked list to an array */
     93psVoidPtrArray *psDlistToArray(psDlist *dlist //!< List to convert
     94    );
     95
     96/** Convert array to a doubly-linked list */
     97psDlist *psArrayToDlist(psVoidPtrArray *arr //!< Array to convert
     98    );
     99
     100
    62101#endif
Note: See TracChangeset for help on using the changeset viewer.