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

psMetadata.h

Go to the documentation of this file.
00001 /** @file  psMetadata.h
00002 *
00003 *  @brief Contains metadata struuctures, enumerations and functions prototypes
00004 *
00005 *  This file defines metadata item, metadata type, metadata flags, metadata containers, and function
00006 *  prototypes necessary creating psLib metadata APIs
00007 *
00008 *  @ingroup Metadata
00009 *
00010 *  @author Robert DeSonia, MHPCC
00011 *  @author Ross Harman, MHPCC
00012 *
00013 *  @version $Revision: 1.1.1.1 $ $Name:  $
00014 *  @date $Date: 2005/09/14 20:42:48 $
00015 *
00016 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00017 */
00018 #ifndef PS_METADATA_H
00019 #define PS_METADATA_H
00020 
00021 #include <stdarg.h>
00022 #include <stdio.h>
00023 #include <sys/types.h>
00024 #include <regex.h>
00025 
00026 #include "psHash.h"
00027 #include "psList.h"
00028 #include "psTime.h"
00029 #include "psLookupTable.h"
00030 
00031 /// @addtogroup Metadata
00032 /// @{
00033 
00034 /** Metadata item type.
00035  *
00036  * Enumeration for maintaining metadata item types.
00037  */
00038 typedef enum {
00039     PS_META_S32 = PS_TYPE_S32,         ///< psS32 primitive data.
00040     PS_META_F32 = PS_TYPE_F32,         ///< psF32 primitive data.
00041     PS_META_F64 = PS_TYPE_F64,         ///< psF64 primitive data.
00042     PS_META_BOOL = PS_TYPE_BOOL,       ///< psBool primitive data.
00043     PS_META_LIST = 0x10000,            ///< List data (Stored as item.data.list).
00044     PS_META_STR,                       ///< String data (Stored as item.data.V).
00045     PS_META_VEC,                       ///< Vector data (Stored as item.data.V).
00046     PS_META_IMG,                       ///< Image data (Stored as item.data.V).
00047     PS_META_HASH,                      ///< Hash data (Stored as item.data.V).
00048     PS_META_LOOKUPTABLE,               ///< Lookup table data (Stored as item.data.V).
00049     PS_META_JPEG,                      ///< JPEG data (Stored as item.data.V).
00050     PS_META_PNG,                       ///< PNG data (Stored as item.data.V).
00051     PS_META_ASTROM,                    ///< Astrometric coefficients (Stored as item.data.V).
00052     PS_META_UNKNOWN,                   ///< Other data (Stored as item.data.V).
00053     PS_META_MULTI,                     ///< Used internally, do not create an metadata item of this type.
00054     PS_META_META = PS_DATA_METADATA,   ///< Metadata data (Stored as item.data.md).
00055     PS_META_ARRAY,                     ///< Array data (Stored as item.data.V).
00056     PS_META_TIME                       ///< psTime data (Stored as item.data.V).
00057 } psMetadataType;
00058 #define PS_META_IS_PRIMITIVE(TYPE) \
00059 (TYPE == PS_META_S32 || \
00060  TYPE == PS_META_F32 || \
00061  TYPE == PS_META_F64 || \
00062  TYPE == PS_META_BOOL)
00063 
00064 #define PS_META_PRIMITIVE_TYPE(METATYPE) ( \
00065         (METATYPE==PS_META_S32) ? PS_TYPE_S32 : \
00066         (METATYPE==PS_META_F32) ? PS_TYPE_F32 : \
00067         (METATYPE==PS_META_F64) ? PS_TYPE_F64 : \
00068         (METATYPE==PS_META_BOOL) ? PS_TYPE_BOOL : 0 )
00069 
00070 /** Option flags for psMetadata functions
00071  *
00072  *  Enumeration for the modification of the behaviour in psMetadataAddItem.
00073  *
00074  *  @see psMetadataAddItem
00075  */
00076 typedef enum {
00077     PS_META_DEFAULT = 0,               ///< default behaviour (duplicate entry is an error)
00078     PS_META_REPLACE = 0x1000000,       ///< allow entry to be replaced
00079     PS_META_DUPLICATE_OK = 0x2000000,  ///< allow duplicate entries
00080     PS_META_NULL = 0x4000000           ///< psMetadataItem.data is a NULL value
00081 } psMetadataFlags;
00082 
00083 #define PS_METADATA_FLAGS_MASK 0xFF000000
00084 #define PS_METADATA_TYPE_MASK 0x00FFFFFF
00085 
00086 /** Metadata data structure.
00087  *
00088  *  Struct for holding metadata items. Metadata items are held in two
00089  *  containers. The first employs a doubly-linked list to preserve the order
00090  *  of the metadata. The second container employs a hash table which
00091  *  allows fast lookup when given a metadata keyword.
00092  */
00093 typedef struct
00094 {
00095     psList*  list;                     ///< Metadata in linked-list
00096     psHash*  hash;                     ///< Metadata in a hash table
00097     void *lock;                        ///< Optional lock for thread safety
00098 }
00099 psMetadata;
00100 
00101 /** Metadata iterator
00102  *
00103  *  Iterator for metadata.
00104  */
00105 typedef struct
00106 {
00107     psListIterator* iter;              ///< iterator for the psMetadata's psList
00108     regex_t* regex;                    ///< the subsetting regular expression
00109 }
00110 psMetadataIterator;
00111 
00112 /** Metadata item data structure.
00113  *
00114  * Struct for maintaining metadata items of varying types. It also contains
00115  * information about the item name, flags, comments, and other items with the same name.
00116  */
00117 typedef struct
00118 {
00119     const psS32 id;                    ///< Unique ID for metadata item.
00120     psString name;                     ///< Name of metadata item.
00121     psDataType type;                   ///< Type of metadata item.
00122     union {
00123         psBool B;                      ///< boolean data
00124         psS32 S32;                     ///< Signed 32-bit integer data.
00125         psF32 F32;                     ///< Single-precision float data.
00126         psF64 F64;                     ///< Double-precision float data.
00127         psList *list;                  ///< List data.
00128         psMetadata *md;                ///< Metadata data.
00129         psPtr V;                       ///< Pointer to other type of data.
00130     } data;                            ///< Union for data types.
00131     psString comment;                  ///< Optional comment ("", not NULL).
00132 }
00133 psMetadataItem;
00134 
00135 /** Create a metadata item.
00136  *
00137  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00138  *  struct. The name argument specifies the name to use for this item, and
00139  *  may include sprintf formatting codes. The format entry specifies both
00140  *  the metadata type and optional flags and is created by bit-wise or of the
00141  *  appropriate type and flag. The comment argument is a fixed string used to
00142  *  comment the metadata item. The arguments to the name formatting codes and
00143  *  the metadata itself are passed as arguments following the comment string.
00144  *  The data must be a pointer for any of the elements stored in data.void.
00145  *  The argument list must be interpreted appropriately by the va_list
00146  *  operators in the function specified size and type.
00147  *
00148  * @return psMetadataItem* : Pointer metadata item.
00149  */
00150 psMetadataItem* psMetadataItemAlloc(
00151     const char *name,                  ///< Name of metadata item.
00152     psDataType type,                   ///< Type of metadata item.
00153     const char *comment,               ///< Comment for metadata item.
00154     ...                                ///< Arguments for name formatting and metadata item data.
00155 )
00156 ;
00157 
00158 
00159 /** Checks the type of a particular pointer.
00160  *
00161  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
00162  *
00163  *  @return bool:       True if the pointer matches a psMetadataItem structure, false otherwise.
00164  */
00165 bool psMemCheckMetadataItem(
00166     psPtr ptr                          ///< the pointer whose type to check
00167 );
00168 
00169 
00170 /** Create a metadata item with specified string data.
00171  *
00172  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00173  *  struct.
00174  *
00175  * @return psMetadataItem* : Pointer metadata item.
00176  */
00177 psMetadataItem* psMetadataItemAllocStr(
00178     const char* name,                  ///< Name of metadata item.
00179     const char* comment,               ///< Comment for metadata item.
00180     const char* value                  ///< the value of the metadata item.
00181 );
00182 
00183 /** Create a metadata item with specified psF32 data.
00184  *
00185  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00186  *  struct.
00187  *
00188  * @return psMetadataItem* : Pointer metadata item.
00189  */
00190 psMetadataItem* psMetadataItemAllocF32(
00191     const char* name,                  ///< Name of metadata item.
00192     const char* comment,               ///< Comment for metadata item.
00193     psF32 value                        ///< the value of the metadata item.
00194 );
00195 
00196 /** Create a metadata item with specified psF64 data.
00197  *
00198  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00199  *  struct.
00200  *
00201  * @return psMetadataItem* : Pointer metadata item.
00202  */
00203 psMetadataItem* psMetadataItemAllocF64(
00204     const char* name,                  ///< Name of metadata item.
00205     const char* comment,               ///< Comment for metadata item.
00206     psF64 value                        ///< the value of the metadata item.
00207 );
00208 
00209 /** Create a metadata item with specified psS32 data.
00210  *
00211  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00212  *  struct.
00213  *
00214  * @return psMetadataItem* : Pointer metadata item.
00215  */
00216 psMetadataItem* psMetadataItemAllocS32(
00217     const char* name,                  ///< Name of metadata item.
00218     const char* comment,               ///< Comment for metadata item.
00219     psS32 value                        ///< the value of the metadata item.
00220 );
00221 
00222 /** Create a metadata item with specified psBool data.
00223  *
00224  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00225  *  struct.
00226  *
00227  * @return psMetadataItem* : Pointer metadata item.
00228  */
00229 psMetadataItem* psMetadataItemAllocBool(
00230     const char* name,                  ///< Name of metadata item.
00231     const char* comment,               ///< Comment for metadata item.
00232     bool value                         ///< the value of the metadata item.
00233 );
00234 
00235 #ifndef SWIG
00236 /** Create a metadata item with va_list.
00237  *
00238  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00239  *  struct. The name argument specifies the name to use for this item, and
00240  *  may include sprintf formatting codes. The format entry specifies both
00241  *  the metadata type and optional flags and is created by bit-wise or of the
00242  *  appropriate type and flag. The comment argument is a fixed string used to
00243  *  comment the metadata item. The arguments to the name formatting codes and
00244  *  the metadata itself are passed as arguments following the comment string.
00245  *  The data must be a pointer for any of the elements stored in data.void.
00246  *  The argument list must be interpreted appropriately by the va_list
00247  *  operators in the function specified size and type.
00248  *
00249  * @return psMetadataItem* : Pointer metadata item.
00250  */
00251 psMetadataItem* psMetadataItemAllocV(
00252     const char *name,                  ///< Name of metadata item.
00253     psDataType type,                   ///< Type of metadata item.
00254     const char *comment,               ///< Comment for metadata item.
00255     va_list list                       ///< Arguments for name formatting and metadata item data.
00256 );
00257 #endif // #ifndef SWIG
00258 
00259 /** Create a metadata collection.
00260  *
00261  *  Returns an empty metadata container with fully allocated internal metadata
00262  *  containers.
00263  *
00264  *  @return psMetadata* : Pointer metadata.
00265  */
00266 psMetadata* psMetadataAlloc(void);
00267 
00268 
00269 /** Checks the type of a particular pointer.
00270  *
00271  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
00272  *
00273  *  @return bool:       True if the pointer matches a psMetadata structure, false otherwise.
00274  */
00275 bool psMemCheckMetadata(
00276     psPtr ptr                          ///< the pointer whose type to check
00277 );
00278 
00279 
00280 /** Add existing metadata item to metadata collection.
00281  *
00282  *  Add a metadata item that has already been created to the metadata
00283  *  collection.
00284  *
00285  *  @return bool: True for success, false for failure.
00286  */
00287 bool psMetadataAddItem(
00288     psMetadata*  md,                   ///< Metadata collection to insert metadat item.
00289     const psMetadataItem* item,        ///< Metadata item to be added.
00290     int location,                      ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00291     psS32 flags                        ///< Options flag mask, see psMetadataFlags enum
00292 );
00293 
00294 /** Create and add a metadata item to metadata collection.
00295  *
00296  * Creates a new metadata item add to the metadata collection.
00297  *
00298  * @return bool: True for success, false for failure.
00299  */
00300 bool psMetadataAdd(
00301     psMetadata* md,                    ///< Metadata collection to insert metadata item.
00302     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00303     const char *name,                  ///< Name of metadata item.
00304     int format,                        ///< Type of metadata item (psMetadataType) and options (psMetadataFlags)
00305     const char *comment,               ///< Comment for metadata item.
00306     ...                                ///< Arguments for name formatting and metadata item data.
00307 );
00308 
00309 #ifndef SWIG
00310 /** Create and add a metadata item to metadata collection.
00311  *
00312  * Creates a new metadata item add to the metadata collection.
00313  *
00314  * @return bool: True for success, false for failure.
00315  */
00316 bool psMetadataAddV(
00317     psMetadata* md,                    ///< Metadata collection to insert metadata item.
00318     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00319     const char *name,                  ///< Name of metadata item.
00320     int format,                        ///< Type of metadata item (psMetadataType) and options (psMetadataFlags)
00321     const char *comment,               ///< Comment for metadata item.
00322     va_list list                       ///< Arguments for name formatting and metadata item data.
00323 );
00324 #endif // #ifndef SWIG
00325 
00326 /** Add a psBool value to metadata collection.
00327  *
00328  *  @return bool:  True for success, False for failure.
00329  */
00330 bool psMetadataAddBool(
00331     psMetadata* md,                    ///< Metadata collection to insert metadata item
00332     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00333     const char* name,                  ///< Name of metadata item
00334     int format,                        ///< psMetadataFlag options/flags
00335     const char* comment,               ///< Comment for metadata item
00336     bool value                       ///< Value for metadata item data
00337 );
00338 
00339 /** Add a psS32 value to metadata collection.
00340  *
00341  *  @return bool:  True for success, False for failure.
00342  */
00343 bool psMetadataAddS32(
00344     psMetadata* md,                    ///< Metadata collection to insert metadata item
00345     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00346     const char* name,                  ///< Name of metadata item
00347     int format,                        ///< psMetadataFlag options/flags
00348     const char* comment,               ///< Comment for metadata item
00349     psS32 value                        ///< Value for metadata item data
00350 );
00351 
00352 /** Add a psF32 value to metadata collection.
00353  *
00354  *  @return bool:  True for success, False for failure.
00355 */
00356 bool psMetadataAddF32(
00357     psMetadata* md,                    ///< Metadata collection to insert metadata item
00358     long location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00359     const char* name,                  ///< Name of metadata item
00360     int format,                        ///< psMetadataFlag options/flags
00361     const char* comment,               ///< Comment for metadata item
00362     psF32 value                        ///< Value for metadata item data
00363 );
00364 
00365 /** Add a psF64 value to metadata collection.
00366  *
00367  *  @return bool:  True for success, False for failure.
00368 */
00369 bool psMetadataAddF64(
00370     psMetadata* md,                    ///< Metadata collection to insert metadata item
00371     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00372     const char* name,                  ///< Name of metadata item
00373     int format,                        ///< psMetadataFlag options/flags
00374     const char* comment,               ///< Comment for metadata item
00375     psF64 value                        ///< Value for metadata item data
00376 );
00377 
00378 /** Add a psList to metadata collection.
00379  *
00380  *  @return psBool:  True for success, False for failure.
00381  */
00382 psBool psMetadataAddList(
00383     psMetadata* md,                    ///< Metadata collection to insert metadata item
00384     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00385     const char* name,                  ///< Name of metadata item
00386     int format,                        ///< psMetadataFlag options/flags
00387     const char* comment,               ///< Comment for metadata item
00388     psList* value                      ///< psList for metadata item data
00389 );
00390 
00391 /** Add a string to metadata collection.
00392  *
00393  *  @return bool:  True for success, False for failure.
00394  */
00395 bool psMetadataAddStr(
00396     psMetadata* md,                    ///< Metadata collection to insert metadata item
00397     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00398     const char* name,                  ///< Name of metadata item
00399     int format,                        ///< psMetadataFlag options/flags
00400     const char* comment,               ///< Comment for metadata item
00401     const char* value                  ///< String for metadata item data
00402 );
00403 
00404 /** Add a vector to metadata collection.
00405  *
00406  *  @return psBool:  True for success, False for failure.
00407  */
00408 psBool psMetadataAddVector(
00409     psMetadata* md,                    ///< Metadata collection to insert metadata item
00410     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00411     const char* name,                  ///< Name of metadata item
00412     int format,                        ///< psMetadataFlag options/flags
00413     const char* comment,               ///< Comment for metadata item
00414     psVector* value                    ///< Vector for metadata item data
00415 );
00416 
00417 /** Add a array to metadata collection.
00418  *
00419  *  @return psBool:  True for success, False for failure.
00420  */
00421 psBool psMetadataAddArray(
00422     psMetadata* md,                    ///< Metadata collection to insert metadata item
00423     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00424     const char* name,                  ///< Name of metadata item
00425     int format,                        ///< psMetadataFlag options/flags
00426     const char* comment,               ///< Comment for metadata item
00427     psArray* value                     ///< Vector for metadata item data
00428 );
00429 
00430 /** Add an Image to metadata collection.
00431  *
00432  *  @return psBool:  True for success, False for failure.
00433  */
00434 psBool psMetadataAddImage(
00435     psMetadata* md,                    ///< Metadata collection to insert metadata item
00436     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00437     const char* name,                  ///< Name of metadata item
00438     int format,                        ///< psMetadataFlag options/flags
00439     const char* comment,               ///< Comment for metadata item
00440     psImage* value                     ///< Image for metadata item data
00441 );
00442 
00443 /** Add a Time to metadata collection.
00444  *
00445  *  @return psBool:  True for success, False for failure.
00446  */
00447 psBool psMetadataAddTime(
00448     psMetadata* md,                    ///< Metadata collection to insert metadata item
00449     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00450     const char* name,                  ///< Name of metadata item
00451     int format,                        ///< psMetadataFlag options/flags
00452     const char* comment,               ///< Comment for metadata item
00453     psTime* value                      ///< Time for metadata item data
00454 );
00455 
00456 /** Add a Hash to metadata collection.
00457  *
00458  *  @return psBool:  True for success, False for failure.
00459  */
00460 psBool psMetadataAddHash(
00461     psMetadata* md,                    ///< Metadata collection to insert metadata item
00462     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00463     const char* name,                  ///< Name of metadata item
00464     int format,                        ///< psMetadataFlag options/flags
00465     const char* comment,               ///< Comment for metadata item
00466     psHash* value                      ///< Hash for metadata item data
00467 );
00468 
00469 /** Add a LookupTable to metadata collection.
00470  *
00471  *  @return psBool:  True for success, False for failure.
00472  */
00473 psBool psMetadataAddLookupTable(
00474     psMetadata* md,                    ///< Metadata collection to insert metadata item
00475     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00476     const char* name,                  ///< Name of metadata item
00477     int format,                        ///< psMetadataFlag options/flags
00478     const char* comment,               ///< Comment for metadata item
00479     psLookupTable* value               ///< LookupTable for metadata item data
00480 );
00481 
00482 /** Add an Unknown (psPtr) to metadata collection.
00483  *
00484  *  @return psBool:  True for success, False for failure.
00485  */
00486 psBool psMetadataAddUnknown(
00487     psMetadata* md,                    ///< Metadata collection to insert metadata item
00488     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00489     const char* name,                  ///< Name of metadata item
00490     int format,                        ///< psMetadataFlag options/flags
00491     const char* comment,               ///< Comment for metadata item
00492     psPtr value                        ///< Unknown for metadata item data
00493 );
00494 
00495 /** Add Metadata to metadata collection.
00496  *
00497  *  @return psBool:  True for success, False for failure.
00498  */
00499 psBool psMetadataAddMetadata(
00500     psMetadata* md,                    ///< Metadata collection to insert metadata item
00501     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00502     const char* name,                  ///< Name of metadata item
00503     int format,                        ///< psMetadataFlag options/flags
00504     const char* comment,               ///< Comment for metadata item
00505     psMetadata* value                  ///< Metadata for metadata item data
00506 );
00507 
00508 /** Remove an item from metadata collection.
00509  *
00510  *  Items may be removed from metadata by specifing a key or location. If the
00511  *  name is null, the where argument is used instead. If name is not null,
00512  *  where is set to PS_LIST_UNKNOWN. If the item is found, it is removed from
00513  *  the metadata and true is returned.  If the key is not unique, then all
00514  *  items corresponding to it are removed.
00515  *
00516  * @return bool: True for success, false for failure.
00517  */
00518 bool psMetadataRemove(
00519     psMetadata*  md,                   ///< Metadata collection to remove metadata item.
00520     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00521     const char * key                   ///< Name of metadata key.
00522 );
00523 
00524 /** Find an item in the metadata collection based on key name.
00525  *
00526  *  Items may be found in the metadata by providing a key. If the key is
00527  *  non-unique, the first item is returned. If the item is not found, null is
00528  *  returned.
00529  *
00530  * @return psMetadataItem* : Pointer metadata item.
00531  */
00532 psMetadataItem* psMetadataLookup(
00533     const psMetadata * md,             ///< Metadata collection to lookup metadata item.
00534     const char * key                   ///< Name of metadata key.
00535 );
00536 
00537 /** Find an item in the metadata collection based on key name and return its double precision value.
00538  *
00539  *  Items may be found in the metadata by providing a key. If the key is
00540  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00541  *  returned.
00542  *
00543  * @return psF64 : Value of metadata item.
00544  */
00545 psF64 psMetadataLookupF64(
00546     bool *status,                      ///< Status of lookup.
00547     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00548     const char *key                    ///< Name of metadata key.
00549 );
00550 
00551 /** Find an item in the metadata collection based on key name and return its single precision value.
00552  *
00553  *  Items may be found in the metadata by providing a key. If the key is
00554  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00555  *  returned.
00556  *
00557  * @return psF32 : Value of metadata item.
00558  */
00559 psF32 psMetadataLookupF32(
00560     bool *status,                      ///< Status of lookup.
00561     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00562     const char *key                    ///< Name of metadata key.
00563 );
00564 
00565 /** Find an item in the metadata collection based on key name and return its integer value.
00566  *
00567  *  Items may be found in the metadata by providing a key. If the key is
00568  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00569  *  returned.
00570  *
00571  * @return psS32 : Value of metadata item.
00572  */
00573 psS32 psMetadataLookupS32(
00574     bool *status,                      ///< Status of lookup.
00575     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00576     const char *key                    ///< Name of metadata key.
00577 );
00578 
00579 /** Find an item in the metadata collection based on key name and return its boolean value.
00580  *
00581  *  Items may be found in the metadata by providing a key. If the key is
00582  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00583  *  returned.
00584  *
00585  * @return bool : Value of metadata item.
00586  */
00587 bool psMetadataLookupBool(
00588     bool *status,                      ///< Status of lookup.
00589     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00590     const char *key                    ///< Name of metadata key.
00591 );
00592 
00593 /** Find an item in the metadata collection based on key name and return its integer value.
00594  *
00595  *  Items may be found in the metadata by providing a key. If the key is
00596  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00597  *  returned.
00598  *
00599  * @return void* : Value of metadata item.
00600  */
00601 psPtr psMetadataLookupPtr(
00602     bool *status,                      ///< Status of lookup.
00603     const psMetadata* md,              ///< Metadata collection to lookup metadata item.
00604     const char *key                    ///< Name of metadata key.
00605 );
00606 
00607 /** Find an item in the metadata collection based on list index.
00608  *
00609  *  Items may be found in the metadata by their entry position in the list
00610  *  container.
00611  *
00612  *  @return psMetadataItem* : Pointer metadata item.
00613  */
00614 psMetadataItem* psMetadataGet(
00615     const psMetadata* md,              ///< Metadata collection to retrieve metadata item.
00616     int location                       ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00617 );
00618 
00619 /** Creates a psMetadataIterator to iterate over the specified psMetadata.
00620  *
00621  *  Supports the subsetting of the metadata via keyword using regular
00622  *  expression.  If no regular expression is specified, iteration
00623  *  over the entire psMetadata is performed.
00624  *
00625  *  @return psMetadataIterator*        a new psMetadataIterator, of NULL if error occurred
00626  */
00627 psMetadataIterator* psMetadataIteratorAlloc(
00628     psMetadata* md,                    ///< the psMetadata to iterate with
00629     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00630     const char* regex
00631     ///< A regular expression for subsetting the psMetadata.  If NULL, no
00632     ///< subsetting is performed.
00633 );
00634 
00635 /** Set the iterator of the psMetadat to a given position.  If location is
00636  *  invalid the iterator position is not changed.
00637  *
00638  *  @return bool        TRUE if iterator successfully set, otherwise FALSE.
00639 */
00640 bool psMetadataIteratorSet(
00641     psMetadataIterator* iterator,      ///< psMetadata iterator
00642     long location                      ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
00643 );
00644 
00645 /** Position the specified iterator to the next matching item in psMetadata,
00646  *  given the regular expression of the iterator
00647  *
00648  *  @return psPtr       the psMetadataItem at the original iterator position
00649  *                      or NULL if the iterator went past the end of the list.
00650  */
00651 psMetadataItem* psMetadataGetAndIncrement(
00652     psMetadataIterator* iterator       ///< iterator to move
00653 );
00654 
00655 /** Position the specified iterator to the previous matching item in psMetadata,
00656  *  given the regular expression of the iterator
00657  *
00658  *  @return psPtr       the psMetadataItem at the original iterator position
00659  *                      or NULL if the iterator went past the beginning of the
00660  *                      list.
00661  */
00662 psMetadataItem* psMetadataGetAndDecrement(
00663     psMetadataIterator* iterator       ///< iterator to move
00664 );
00665 
00666 /** Find an item in the metadata collection based on key name and return its metadata value.
00667  *
00668  *  Items may be found in the metadata by providing a key. If the key is
00669  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00670  *  returned.
00671  *
00672  *  @return psMetadata*:        Value of metadata item.
00673  */
00674 psMetadata *psMetadataLookupMD(
00675     bool *status,                      ///< Status of lookup.
00676     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00677     const char *key                    ///< Name of metadata key.
00678 );
00679 
00680 /** Find an item in the metadata collection based on key name and return its string value.
00681  *
00682  *  Items may be found in the metadata by providing a key. If the key is
00683  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00684  *  returned.
00685  *
00686  *  @return char*:           Value of metadata item.
00687  */
00688 char *psMetadataLookupString(
00689     bool *status,                      ///< Status of lookup.
00690     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00691     const char *key                    ///< Name of metadata key.
00692 );
00693 
00694 /** Print metadata collection to screen      */
00695 void psMetadataPrint(
00696     psMetadata *md,                    ///< Metadata collection to print.
00697     int level                          ///< the level of metadata items.
00698 );
00699 
00700 /// @}
00701 
00702 #endif // #ifndef PS_METADATA_H

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