psMetadataConfig.h

Go to the documentation of this file.
00001 /** @file  psMetadataConfig.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  *  @author EAM, IfA
00008  *  @author PAP, IfA
00009  *  @author JH, IfA
00010  *  @author Ross Harman, MHPCC
00011  *  @author Robert DeSonia, MHPCC
00012  *
00013  *  @version $Revision: 1.26 $ $Name:  $
00014  *  @date $Date: 2007/01/23 22:47:23 $
00015  *
00016  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00017  */
00018 #ifndef PS_METADATACONFIG_H
00019 #define PS_METADATACONFIG_H
00020 
00021 #include "psMetadata.h"
00022 
00023 /// @addtogroup DataContainer Data Containers
00024 /// @{
00025 
00026 /** Print metadata item to file.
00027  *
00028  *  Metadata items may be printed to an open file descriptor based on a
00029  *  provided format. The format is a sprintf format statement with exactly
00030  *  one % formatting command. If the metadata item type is a numeric type,
00031  *  this formatting command must also be numeric, and the type conversion
00032  *  performed to the value to match the format type. If the metadata type is
00033  *  a string, the formatting command must also be for a string. If the
00034  *  metadata type is any other data type, printing is not allowed.
00035  *
00036  * @return psMetadataItem* :    Pointer metadata item.
00037  */
00038 bool psMetadataItemPrint(
00039     FILE * fd,                         ///< Pointer to file to write metadata item.
00040     const char *format,                ///< Format to print metadata item.
00041     const psMetadataItem* item         ///< Metadata item to print.
00042 );
00043 
00044 /** Read metadata configuration file.
00045  *
00046  *  Loads pre-defined settings by parsing a configuration file into a psMetadata structure.
00047  *
00048  *  @return psMetadata* : Resulting metadata from read.
00049  */
00050 psMetadata* psMetadataConfigRead(
00051     psMetadata* md,                    ///< Resulting metadata from read.
00052     unsigned int *nFail,               ///< Number of failed lines.
00053     const char *filename,              ///< Name of file to read.
00054     bool overwrite                     ///< Allow overwrite of duplicate specifications.
00055 );
00056 
00057 /** Parse metadata configuration string.
00058  *
00059  *  Loads pre-defined settings by parsing a string into a psMetadata structure.
00060  *
00061  *  @return psMetadata* : Resulting metadata from parse.
00062  */
00063 psMetadata* psMetadataConfigParse(
00064     psMetadata* md,                    ///< Resulting metadata from read.
00065     unsigned int *nFail,               ///< Number of failed lines.
00066     const char *str,                   ///< String to process.
00067     bool overwrite                     ///< Allow overwrite of duplicate specifications.
00068 );
00069 
00070 /** Converts a psMetadata structure (including any nested psMetadata) into a
00071  *  configuration file formatted string.
00072  *
00073  *  A NULL shall be returned on error.
00074  *  @return psString:       a Configuration File formatted string.
00075  */
00076 psString psMetadataConfigFormat(
00077     psMetadata *md                     ///< The metadata to convert
00078 );
00079 
00080 /** Converts a psMetadata structure (including any nested psMetadata) into a
00081  *  configuration file formatted string that is written out to filename.
00082  *
00083  *  @return bool:       True if successful, otherwise false.
00084  */
00085 bool psMetadataConfigWrite(
00086     psMetadata *md,                    ///< The metadata to convert
00087     const char *filename               ///< Name of file to write
00088 );
00089 
00090 /** Converts a psMetadata structure (including any nested psMetadata) into a
00091  *  configuration file formatted string that is written a file stream.
00092  *
00093  *  @return bool:       True if successful, otherwise false.
00094  */
00095 bool psMetadataConfigPrint(
00096     FILE *stream,                       ///< file stream to write to
00097     psMetadata *md                      ///< The metadata to convert
00098 );
00099 
00100 /// @}
00101 #endif // #ifndef PS_METADATAIO_H

Generated on Fri Feb 2 22:24:35 2007 for pslib by  doxygen 1.5.1