IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 28, 2004, 1:26:49 PM (22 years ago)
Author:
desonia
Message:

changed function prototypes to match changes in the SDRS.

Location:
trunk/psLib/src/collections
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psArray.c

    r1807 r1920  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-14 20:01:52 $
     11 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-09-28 23:26:48 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2121/******************************************************************************/
    2222#include<stdlib.h>                         // for qsort, etc.
     23#include<string.h>
    2324
    2425#include "psMemory.h"
     
    5859}
    5960
    60 psArray* psArrayRealloc(unsigned int nalloc, psArray* restrict in)
     61psArray* psArrayRealloc(psArray* restrict in, unsigned int nalloc)
    6162{
    6263    if (in == NULL) {
     
    8889}
    8990
     91bool psArrayRemove(psArray* psArr,
     92                   psPTR data)
     93{
     94    bool success = false;
     95
     96    if (psArr == NULL) {
     97        return success;
     98    }
     99
     100    int n = psArr->n;
     101    psPTR* psArrData = psArr->data;
     102    for (int i = n-1; i<0; i--) {
     103        if (psArrData[i] == data) {
     104            memmove(psArrData[i],psArrData[i+1],(n-i-1)*sizeof(psPTR));
     105            n--;
     106            success = true;
     107        }
     108    }
     109    psArr->n = n; // reset the array size to indicate the removed item(s)
     110
     111    return success;
     112}
     113
    90114void psArrayElementFree(psArray* restrict psArr)
    91115{
  • trunk/psLib/src/collections/psArray.h

    r1471 r1920  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-11 19:47:31 $
     14 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-09-28 23:26:48 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020#ifndef PS_ARRAY_H
    2121#define PS_ARRAY_H
     22
     23#include<stdbool.h>
    2224
    2325#include "psType.h"
     
    6769 */
    6870psArray* psArrayRealloc(
    69     unsigned int nalloc,               ///< Total number of elements to make available.
    70     psArray* restrict psArr            ///< array to reallocate.
     71    psArray* restrict psArr,           ///< array to reallocate.
     72    unsigned int nalloc                ///< Total number of elements to make available.
     73);
     74
     75/** Remove an element from the array
     76 *
     77 *  Finds and removes the specified data pointer from the list. 
     78 *
     79 * @return bool:  TRUE if the specified data pointer was found and removed,
     80 *                otherwise FALSE.
     81 *
     82 */
     83bool psArrayRemove(
     84    psArray* psArr,                    ///< array to operate on
     85    psPTR data                         ///< the data pointer to remove from psArray
    7186);
    7287
  • trunk/psLib/src/collections/psVector.c

    r1897 r1920  
    1010*  @author Robert DeSonia, MHPCC
    1111*
    12 *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-09-25 02:06:12 $
     12*  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-09-28 23:26:48 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6464}
    6565
    66 psVector* psVectorRealloc(unsigned int nalloc, psVector* restrict in)
     66psVector* psVectorRealloc(psVector* restrict in, unsigned int nalloc)
    6767{
    6868    int elementSize = 0;
  • trunk/psLib/src/collections/psVector.h

    r1897 r1920  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-25 02:06:12 $
     14 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-09-28 23:26:48 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8383 */
    8484psVector* psVectorRealloc(
    85     unsigned int nalloc,               ///< Total number of elements to make available.
    86     psVector* restrict psVec           ///< Vector to reallocate.
     85    psVector* restrict psVec,          ///< Vector to reallocate.
     86    unsigned int nalloc                ///< Total number of elements to make available.
    8787);
    8888
Note: See TracChangeset for help on using the changeset viewer.