IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7699


Ignore:
Timestamp:
Jun 26, 2006, 5:42:01 PM (20 years ago)
Author:
jhoblitt
Message:

add psMetadataLookupTime()

Location:
trunk/psLib/src/types
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/types/psMetadata.c

    r7548 r7699  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.113 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2006-06-13 23:59:41 $
     14 *  @version $Revision: 1.114 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-06-27 03:42:01 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    10781078    }
    10791079    return value;
     1080}
     1081
     1082psTime *psMetadataLookupTime(bool *status,
     1083                             const psMetadata *md,
     1084                             const char *key)
     1085{
     1086    PS_ASSERT_PTR_NON_NULL(md,NULL);
     1087    PS_ASSERT_PTR_NON_NULL(md->list,NULL);
     1088
     1089    psMetadataItem *item = psMetadataLookup((psMetadata*)md, key);
     1090    if (!item) {
     1091        // The given key isn't in the metadata
     1092        if (status) {
     1093            *status = false;
     1094        } else {
     1095            psError(PS_ERR_IO, true, "Couldn't find %s in the metadata.\n", key);
     1096        }
     1097        return NULL;
     1098    }
     1099
     1100    if (item->type != PS_DATA_TIME) {
     1101        // The value at the key isn't metadata
     1102        if (status) {
     1103            *status = false;
     1104        } else {
     1105            psLogMsg(__func__, PS_LOG_WARN, "%s isn't of type PS_DATA_TIME, as expected.\n", key);
     1106        }
     1107        return NULL;
     1108    }
     1109
     1110    // We have the requested metadata
     1111    if (status) {
     1112        *status = true;
     1113    }
     1114
     1115    return item->data.V;
    10801116}
    10811117
  • trunk/psLib/src/types/psMetadata.h

    r7548 r7699  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.80 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2006-06-13 23:59:41 $
     13*  @version $Revision: 1.81 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2006-06-27 03:42:01 $
    1515*
    1616*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    10401040);
    10411041
     1042/** Find an item in the metadata collection based on key name and return it as a psTime pointer.
     1043 *
     1044 *  Items may be found in the metadata by providing a key. If the key is
     1045 *  non-unique, the value of the first item is returned. If the item is not found, zero is
     1046 *  returned.
     1047 *
     1048 *  @return psTime:           Value of metadata item.
     1049 */
     1050
     1051psTime *psMetadataLookupTime(
     1052    bool *status,                      ///< Status of lookup.
     1053    const psMetadata *md,              ///< Metadata collection to lookup metadata item.
     1054    const char *key                    ///< Name of metadata key.
     1055);
     1056
     1057
    10421058/** Prints metadata collection.
    10431059 *
Note: See TracChangeset for help on using the changeset viewer.