IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 28, 2005, 10:02:49 AM (21 years ago)
Author:
desonia
Message:

added support for reading vectors from binary tables.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/fits/tst_psFits.c

    r5164 r5168  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-09-28 02:38:01 $
     8*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2005-09-28 20:02:49 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    203203
    204204        psVector* vec = psVectorAlloc(5,PS_TYPE_S32);
    205         for (int x=0; x < 5; x++) {
    206             vec->data.S32[x] = x*2;
     205        for (int x=0; x < 4; x++) {
     206            vec->data.S32[x] = x*10+row;
    207207        }
    208208        psMetadataAdd(header,PS_LIST_TAIL, "MYVEC",
     
    899899        psBool boolItem = psMetadataLookupBool(NULL, rowData, "MYBOOL");
    900900        psString strItem = psMetadataLookupStr(NULL, rowData, "MYSTR");
     901        psVector* vecItem = psMetadataLookupPtr(NULL, rowData, "MYVEC");
    901902
    902903        if (intItem != row) {
     
    935936                    row, strItem, strValue);
    936937            return 24;
     938        }
     939
     940        if ( vecItem == NULL ) {
     941            psError(PS_ERR_UNKNOWN, true,
     942                    "Failed to retrieve psVector metadata item from file (row=%d).",
     943                    row);
     944            return 25;
     945        }
     946
     947        if ( vecItem->type.type != PS_DATA_S32 ||
     948                vecItem->data.S32[0] != row ||
     949                vecItem->data.S32[3] != row+30 ) {
     950            psError(PS_ERR_UNKNOWN, true,
     951                    "Retrieved psVector (row=%d) didn't match expected values [%d,%d,%d,%d] vs [%d,%d,%d,%d].",
     952                    row,vecItem->data.S32[0], vecItem->data.S32[1],
     953                    vecItem->data.S32[2], vecItem->data.S32[3],
     954                    row,row+10,row+20,row+30);
     955            return 26;
    937956        }
    938957    }
Note: See TracChangeset for help on using the changeset viewer.