IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 6, 2004, 2:06:06 PM (22 years ago)
Author:
desonia
Message:

another attempt to get astyle to get it right.

File:
1 edited

Legend:

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

    r1228 r1407  
    11#if !defined(PS_LIST_H)
    2 #define PS_LIST_H
     2#    define PS_LIST_H
    33
    44/** @file psList.h
     
    1010 *  @ingroup LinkedList
    1111 *
    12  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-15 22:18:02 $
     12 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-07 00:06:06 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1616 */
    1717
    18 #include <pthread.h>                   // we need a mutex to make this stuff thread safe.
    19 #include <stdbool.h>                   // we use the bool type.
     18#    include <pthread.h>                   // we need a mutex to make this stuff thread safe.
     19#    include <stdbool.h>                   // we use the bool type.
    2020
    21 #include "psCompare.h"
    22 #include "psArray.h"
     21#    include "psCompare.h"
     22#    include "psArray.h"
    2323
    2424/** @addtogroup LinkedList
     
    3333 */
    3434enum {
    35     PS_LIST_HEAD = 0,                  ///< at head
    36     PS_LIST_TAIL = -1,                 ///< at tail
    37     PS_LIST_PREVIOUS = -2,             ///< previous element
    38     PS_LIST_CURRENT = -3,              ///< current element
    39     PS_LIST_NEXT = -4,                 ///< next element
    40     PS_LIST_UNKNOWN = -5               ///< unknown position (should be last in enum list)
     35    PS_LIST_HEAD = 0,           // /< at head
     36    PS_LIST_TAIL = -1,                     // /< at tail
     37    PS_LIST_PREVIOUS = -2,                 // /< previous element
     38    PS_LIST_CURRENT = -3,                  // /< current element
     39    PS_LIST_NEXT = -4,                     // /< next element
     40    PS_LIST_UNKNOWN = -5                   // /< unknown position (should be last in enum list)
    4141};
    4242
     
    4444typedef struct psListElem
    4545{
    46     struct psListElem *prev;            ///< previous link in list
    47     struct psListElem *next;            ///< next link in list
    48     void *data;                         ///< real data item
     46    struct psListElem *prev;    // /< previous link in list
     47    struct psListElem *next;    // /< next link in list
     48    void *data;                 // /< real data item
    4949}
    5050psListElem;
     
    5757typedef struct
    5858{
    59     unsigned int size;                  ///< number of elements on list
    60     psListElem* head;                   ///< first element on list (may be NULL)
    61     psListElem* tail;                   ///< last element on list (may be NULL)
    62     psListElem* iter;                   ///< iteration cursor
    63     unsigned int iterIndex;             ///< the numeric position of the iteration cursor in the list
    64     pthread_mutex_t lock;               ///< mutex to lock a node during changes
     59    unsigned int size;          // /< number of elements on list
     60    psListElem *head;           // /< first element on list (may be NULL)
     61    psListElem *tail;           // /< last element on list (may be NULL)
     62    psListElem *iter;           // /< iteration cursor
     63    unsigned int iterIndex;     // /< the numeric position of the iteration cursor in the list
     64    pthread_mutex_t lock;       // /< mutex to lock a node during changes
    6565}
    6666psList;
     
    7070 *  @return psList*     A new psList object.
    7171 */
    72 psList* psListAlloc(
    73     void *data
    74     ///< initial data item; may be NULL if no an empty psList is desired
    75 )
     72psList *psListAlloc(void *data
     73                    // /< initial data item; may be NULL if no an empty psList is desired
     74                   )
    7675;
    7776
     
    8180 *                      NULL, the return value will also be NULL.
    8281 */
    83 bool psListAdd(
    84     psList* restrict list,              ///< list to add to (if NULL, nothing is done)
    85     void* data,                         ///< data item to add.  If NULL, list is not modified.
    86     int where                           ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
    87 );
     82bool psListAdd(psList * restrict list,  // /< list to add to (if NULL, nothing is done)
     83               void *data,      // /< data item to add.  If NULL, list is not modified.
     84               int where        // /< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
     85              );
    8886
    8987/** Remove an item from a list.  If which parameter is PS_LIST_UNKNOWN,
     
    9189 *  @return bool        TRUE if element is successfully removed, otherwise FALSE.
    9290 */
    93 bool psListRemove(
    94     psList* restrict list,
    95     ///< list to remove element from
    96     void *data,
    97     ///< if which is PS_LIST_UNKNOWN, data item to find and remove, otherwise this is ignored.
    98     int which
    99     ///< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV, or numbered location.
    100 );
     91bool psListRemove(psList * restrict list,
     92                  // /< list to remove element from
     93                  void *data,
     94                  // /< if which is PS_LIST_UNKNOWN, data item to find and remove, otherwise this is ignored.
     95                  int which
     96                  // /< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV, or numbered location.
     97                 );
    10198
    10299/** Retrieve an item from a list.
     
    107104 *                      NULL is returned.
    108105 */
    109 void* psListGet(
    110     psList* restrict list,             ///< list to retrieve element from
    111     int which                          ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
    112 );
     106void *psListGet(psList * restrict list, // /< list to retrieve element from
     107                int which       // /< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
     108               );
    113109
    114110/** Set the iterator of the list to a given position.  If where is invalid the
     
    116112 *
    117113 */
    118 void psListSetIterator(
    119     psList* restrict list,             ///< list to retrieve element from
    120     int where                           ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
    121 );
     114void psListSetIterator(psList * restrict list,  // /< list to retrieve element from
     115                       int where        // /< index number, PS_LIST_HEAD, or PS_LIST_TAIL
     116                      );
    122117
    123118/** Get next element relative to the iterator.  This also moves the iterator to
     
    128123 *                      parameter was NULL.
    129124 */
    130 void* psListGetNext(
    131     psList* restrict list              ///< list to retrieve element from
    132 );
     125void *psListGetNext(psList * restrict list      // /< list to retrieve element from
     126                   );
    133127
    134128/** Get current element according to the psList's iterator cursor.  This does
     
    139133 *                      iterator is not valid or list parameter was NULL.
    140134 */
    141 void* psListGetCurrent(
    142     psList* restrict list              ///< list to retrieve element from
    143 );
     135void *psListGetCurrent(psList * restrict list   // /< list to retrieve element from
     136                      );
    144137
    145138/** Get previous element relative to list's iterator. This also moves the
     
    150143 *                      parameter was NULL.
    151144 */
    152 void* psListGetPrevious(
    153     psList* restrict list              ///< list to retrieve element from
    154 );
     145void *psListGetPrevious(psList * restrict list  // /< list to retrieve element from
     146                       );
    155147
    156148/** Convert a linked list to an array
     
    159151 *                      or NULL if the given dlist parameter is NULL.
    160152 */
    161 psArray* psListToArray(
    162     psList *dlist                      ///< List to convert
    163 );
     153psArray *psListToArray(psList * dlist   // /< List to convert
     154                      );
    164155
    165156/** Convert array to a doubly-linked list
     
    168159 *                      or NULL is the given arr parameter is NULL.
    169160 */
    170 psList* psArrayToList(
    171     psArray* arr                      ///< vector to convert
    172 );
     161psList *psArrayToList(psArray * arr     // /< vector to convert
     162                     );
    173163
    174 psList* psListSort(psList* list, psComparePtrFcn compare);
     164psList *psListSort(psList * list, psComparePtrFcn compare);
    175165
    176166/// @} End of DataGroup Functions
    177167
    178168#endif
    179 
Note: See TracChangeset for help on using the changeset viewer.