Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

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  *  @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/09/14 20:42:48 $
00014  *
00015  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00016  */
00017 #ifndef PS_METADATACONFIG_H
00018 #define PS_METADATACONFIG_H
00019 
00020 /// @addtogroup Metadata
00021 /// @{
00022 
00023 /** A metadata data structure used in parsing arrays.
00024  *
00025  *  Contains array information and the metadata storage location.
00026 */
00027 typedef struct
00028 {
00029     psArray*    nonUniqueKeyArray;     ///< non-unique key names
00030     psArray*    typeArray;             ///< array of user defined types
00031     psArray*    templateArray;         ///< array of user type templates
00032     psMetadata* metadata;              ///< metadata container
00033     char*       name;                  ///< name of key
00034 }
00035 p_psParseLevelInfo;
00036 
00037 /** Allocates a p_psParseLevelInfo structure
00038  *
00039  *  @return p_psParseLevelInfo* :   new p_psParseLevelInfo struct
00040  */
00041 p_psParseLevelInfo* p_psParseLevelInfoAlloc(void);
00042 
00043 /** Print metadata item to file.
00044  *
00045  *  Metadata items may be printed to an open file descriptor based on a
00046  *  provided format. The format is a sprintf format statement with exactly
00047  *  one % formatting command. If the metadata item type is a numeric type,
00048  *  this formatting command must also be numeric, and the type conversion
00049  *  performed to the value to match the format type. If the metadata type is
00050  *  a string, the fromatting command must also be for a string. If the
00051  *  metadata type is any other data type, printing is not allowed.
00052  *
00053  * @return psMetadataItem* : Pointer metadata item.
00054  */
00055 bool psMetadataItemPrint(
00056     FILE * fd,                         ///< Pointer to file to write metadata item.
00057     const char *format,                ///< Format to print metadata item.
00058     const psMetadataItem* item         ///< Metadata item to print.
00059 );
00060 
00061 /** Read metadata header.
00062  *
00063  *  Read a metadata header from file. If the file is not found, an error is
00064  *  reported.
00065  *
00066  *  @return psMetadata* : Pointer to resulting metadata.
00067  */
00068 psMetadata* psMetadataReadHeader(
00069     psMetadata* output,                ///< Resulting metadata from read.
00070     char *extName,                     ///< File name extension string.
00071     psS32 extNum,                      ///< File name extension number. Starts at 1.
00072     char *fileName                     ///< Name of file to read.
00073 );
00074 
00075 /** Read metadata configuration file.
00076  *
00077  *  Loads pre-defined settings by parsing a configuration file into a psMetadata structure.
00078  *
00079  *  @return psMetadata* : Resulting metadata from read.
00080  */
00081 psMetadata* psMetadataConfigParse(
00082     psMetadata* md,                    ///< Resulting metadata from read.
00083     unsigned int *nFail,               ///< Number of failed lines.
00084     const char *filename,              ///< Name of file to read.
00085     bool overwrite                     ///< Allow overwrite of duplicate specifications.
00086 );
00087 
00088 /** Converts a psMetadata structure (including any nested psMetadata) into a
00089  *  configuration file formatted string.
00090  *
00091  *  A NULL shall be returned on error.
00092  *  @return psString:       a Configuration File formatted string.
00093  */
00094 psString psMetadataConfigFormat(
00095     psMetadata *md                     ///< The metadata to convert
00096 );
00097 
00098 /** Converts a psMetadata structure (including any nested psMetadata) into a
00099  *  configuration file formatted string that is written out to filename.
00100  *
00101  *  @return bool:       True if successful, otherwise false.
00102  */
00103 bool psMetadataConfigWrite(
00104     psMetadata *md,                    ///< The metadata to convert
00105     const char *filename               ///< Name of file to write
00106 );
00107 
00108 /// @}
00109 
00110 #endif // #ifndef PS_METADATAIO_H

Generated on Wed Sep 14 10:42:48 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.2