00001 /** @file psMetadataIO.h 00002 * 00003 * @brief Contains metadata input/output functions. 00004 * 00005 * This file defines functions to read and write metadata to/from an external file. 00006 * 00007 * @ingroup Metadata 00008 * 00009 * @author Ross Harman, MHPCC 00010 * @author Robert DeSonia, MHPCC 00011 * 00012 * @version $Revision: 1.1.1.1 $ $Name: $ 00013 * @date $Date: 2005/06/15 21:08:12 $ 00014 * 00015 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 00016 */ 00017 #ifndef PS_METADATAIO_H 00018 #define PS_METADATAIO_H 00019 00020 /// @addtogroup Metadata 00021 /// @{ 00022 00023 typedef struct 00024 { 00025 psArray* nonUniqueKeyArray; 00026 psArray* typeArray; 00027 psArray* templateArray; 00028 psMetadata* metadata; 00029 char* name; 00030 } 00031 p_psParseLevelInfo; 00032 00033 p_psParseLevelInfo* p_psParseLevelInfoAlloc(void); 00034 00035 /** Print metadata item to file. 00036 * 00037 * Metadata items may be printed to an open file descriptor based on a 00038 * provided format. The format is a sprintf format statement with exactly 00039 * one % formatting command. If the metadata item type is a numeric type, 00040 * this formatting command must also be numeric, and the type conversion 00041 * performed to the value to match the format type. If the metadata type is 00042 * a string, the fromatting command must also be for a string. If the 00043 * metadata type is any other data type, printing is not allowed. 00044 * 00045 * @return psMetadataItem* : Pointer metadata item. 00046 */ 00047 bool psMetadataItemPrint( 00048 FILE * fd, ///< Pointer to file to write metadata item. 00049 const char *format, ///< Format to print metadata item. 00050 const psMetadataItem* metadataItem ///< Metadata item to print. 00051 ); 00052 00053 /** Read metadata header. 00054 * 00055 * Read a metadata header from file. If the file is not found, an error is 00056 * reported. 00057 * 00058 * @return psMetadata* : Pointer to resulting metadata. 00059 */ 00060 psMetadata* psMetadataReadHeader( 00061 psMetadata* output, ///< Resulting metadata from read. 00062 char *extName, ///< File name extension string. 00063 psS32 extNum, ///< File name extension number. Starts at 1. 00064 char *fileName ///< Name of file to read. 00065 ); 00066 00067 /** Read metadata configuration file. 00068 * 00069 * Loads pre-defined settings by parsing a configuration file into a psMetadata structure. 00070 * 00071 * @return psMetadata* : Resulting metadata from read. 00072 */ 00073 psMetadata* psMetadataConfigParse( 00074 psMetadata* md, ///< Resulting metadata from read. 00075 psU32 *nFail, ///< Number of failed lines. 00076 const char *fileName, ///< Name of file to read. 00077 psBool overwrite ///< Allow overwrite of duplicate specifications. 00078 ); 00079 00080 /** Read XML metadata configuration file. 00081 * 00082 * Loads pre-defined XML settings by parsing a configuration file into a psMetadata structure. 00083 * 00084 * @return psMetadata* : Resulting metadata from read. 00085 */ 00086 00087 psMetadata* psMetadataConfigParseXml( 00088 psMetadata* md, ///< Resulting metadata from read. 00089 psU32 *nFail, ///< Number of failed lines. 00090 const char *fileName, ///< Name of file to read. 00091 psBool overwrite ///< Allow overwrite of duplicate specifications. 00092 ); 00093 00094 /// @} 00095 00096 #endif // #ifndef PS_METADATAIO_H
1.4.1