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.81 $ $Name: rel12 $
00014 *  @date $Date: 2006/06/27 03:42:01 $
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 #define PS_DATA_IS_PRIMITIVE(TYPE) \
00035 (TYPE == PS_DATA_S8 || \
00036  TYPE == PS_DATA_S16 || \
00037  TYPE == PS_DATA_S32 || \
00038  TYPE == PS_DATA_S64 || \
00039  TYPE == PS_DATA_U8 || \
00040  TYPE == PS_DATA_U16 || \
00041  TYPE == PS_DATA_U32 || \
00042  TYPE == PS_DATA_U64 || \
00043  TYPE == PS_DATA_F32 || \
00044  TYPE == PS_DATA_F64 || \
00045  TYPE == PS_DATA_BOOL)
00046 
00047 #define PS_DATA_PRIMITIVE_TYPE(DATATYPE) ( \
00048         (DATATYPE==PS_DATA_S8 || DATATYPE==PS_DATA_S16 || \
00049          DATATYPE==PS_DATA_S32 || DATATYPE==PS_DATA_S64 || DATATYPE==PS_DATA_U8 || \
00050          DATATYPE==PS_DATA_U16 || DATATYPE==PS_DATA_U32 || DATATYPE==PS_DATA_U64 || \
00051          DATATYPE==PS_DATA_F32 || DATATYPE==PS_DATA_F64 || DATATYPE==PS_DATA_BOOL) ? DATATYPE : 0)
00052 
00053 
00054 /** Option flags for psMetadata functions
00055  *
00056  *  Enumeration for the modification of the behaviour in psMetadataAddItem.
00057  *
00058  *  @see psMetadataAddItem
00059  */
00060 typedef enum {
00061     PS_META_DEFAULT = 0,               ///< default behaviour (duplicate entry is an error)
00062     PS_META_REPLACE = 0x1000000,       ///< allow entry to be replaced
00063     PS_META_NO_REPLACE = 0x2000000,    ///< duplicate entry is silently skipped
00064     PS_META_DUPLICATE_OK = 0x4000000,  ///< allow duplicate entries
00065     PS_META_NULL = 0x8000000           ///< psMetadataItem.data is a NULL value
00066 } psMetadataFlags;
00067 
00068 #define PS_METADATA_FLAGS_MASK 0xFF000000
00069 #define PS_METADATA_TYPE_MASK 0x00FFFFFF
00070 
00071 /** Metadata data structure.
00072  *
00073  *  Struct for holding metadata items. Metadata items are held in two
00074  *  containers. The first employs a doubly-linked list to preserve the order
00075  *  of the metadata. The second container employs a hash table which
00076  *  allows fast lookup when given a metadata keyword.
00077  */
00078 typedef struct
00079 {
00080     psList*  list;                     ///< Metadata in linked-list
00081     psHash*  hash;                     ///< Metadata in a hash table
00082     void *lock;                        ///< Optional lock for thread safety
00083 }
00084 psMetadata;
00085 
00086 /** Metadata iterator
00087  *
00088  *  Iterator for metadata.
00089  */
00090 typedef struct
00091 {
00092     psListIterator* iter;              ///< iterator for the psMetadata's psList
00093     regex_t* regex;                    ///< the subsetting regular expression
00094 }
00095 psMetadataIterator;
00096 
00097 /** Metadata item data structure.
00098  *
00099  * Struct for maintaining metadata items of varying types. It also contains
00100  * information about the item name, flags, comments, and other items with the same name.
00101  */
00102 typedef struct
00103 {
00104     const psS32 id;                    ///< Unique ID for metadata item.
00105     psString name;                     ///< Name of metadata item.
00106     psDataType type;                   ///< Type of metadata item.
00107     union {
00108         psBool B;                      ///< boolean data
00109         psS8 S8;                       ///< Signed 8-bit integer data.
00110         psS16 S16;                     ///< Signed 16-bit integer data.
00111         psS32 S32;                     ///< Signed 32-bit integer data.
00112         psS64 S64;                     ///< Signed 64-bit integer data.
00113         psU8 U8;                       ///< Unsigned 8-bit integer data.
00114         psU16 U16;                     ///< Unsigned 16-bit integer data.
00115         psU32 U32;                     ///< Unsigned 32-bit integer data.
00116         psU64 U64;                     ///< Unsigned 64-bit integer data.
00117         psF32 F32;                     ///< Single-precision float data.
00118         psF64 F64;                     ///< Double-precision float data.
00119         psList *list;                  ///< List data.
00120         psMetadata *md;                ///< Metadata data.
00121         psPtr V;                       ///< Pointer to other type of data.
00122     } data;                            ///< Union for data types.
00123     psString comment;                  ///< Optional comment ("", not NULL).
00124 }
00125 psMetadataItem;
00126 
00127 /** Create a metadata item.
00128  *
00129  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00130  *  struct. The name argument specifies the name to use for this item, and
00131  *  may include sprintf formatting codes. The format entry specifies both
00132  *  the metadata type and optional flags and is created by bit-wise or of the
00133  *  appropriate type and flag. The comment argument is a fixed string used to
00134  *  comment the metadata item. The arguments to the name formatting codes and
00135  *  the metadata itself are passed as arguments following the comment string.
00136  *  The data must be a pointer for any of the elements stored in data.void.
00137  *  The argument list must be interpreted appropriately by the va_list
00138  *  operators in the function specified size and type.
00139  *
00140  * @return psMetadataItem* : Pointer metadata item.
00141  */
00142 psMetadataItem* psMetadataItemAlloc(
00143     const char *name,                  ///< Name of metadata item.
00144     psDataType type,                   ///< Type of metadata item.
00145     const char *comment,               ///< Comment for metadata item.
00146     ...                                ///< Arguments for name formatting and metadata item data.
00147 )
00148 ;
00149 
00150 /** Checks the type of a particular pointer.
00151  *
00152  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
00153  *
00154  *  @return bool:       True if the pointer matches a psMetadataItem structure, false otherwise.
00155  */
00156 bool psMemCheckMetadataItem(
00157     psPtr ptr                          ///< the pointer whose type to check
00158 );
00159 
00160 
00161 /** Create a metadata item with specified string data.
00162  *
00163  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00164  *  struct.
00165  *
00166  * @return psMetadataItem* : Pointer metadata item.
00167  */
00168 psMetadataItem* psMetadataItemAllocStr(
00169     const char* name,                  ///< Name of metadata item.
00170     const char* comment,               ///< Comment for metadata item.
00171     const char* value                  ///< the value of the metadata item.
00172 );
00173 
00174 /** Create a metadata item with specified psF32 data.
00175  *
00176  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00177  *  struct.
00178  *
00179  * @return psMetadataItem* : Pointer metadata item.
00180  */
00181 psMetadataItem* psMetadataItemAllocF32(
00182     const char* name,                  ///< Name of metadata item.
00183     const char* comment,               ///< Comment for metadata item.
00184     psF32 value                        ///< the value of the metadata item.
00185 );
00186 
00187 /** Create a metadata item with specified psF64 data.
00188  *
00189  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00190  *  struct.
00191  *
00192  * @return psMetadataItem* : Pointer metadata item.
00193  */
00194 psMetadataItem* psMetadataItemAllocF64(
00195     const char* name,                  ///< Name of metadata item.
00196     const char* comment,               ///< Comment for metadata item.
00197     psF64 value                        ///< the value of the metadata item.
00198 );
00199 
00200 /** Create a metadata item with specified psS8 data.
00201  *
00202  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00203  *  struct.
00204  *
00205  * @return psMetadataItem* : Pointer metadata item.
00206  */
00207 psMetadataItem* psMetadataItemAllocS8(
00208     const char* name,                  ///< Name of metadata item.
00209     const char* comment,               ///< Comment for metadata item.
00210     psS8 value                         ///< the value of the metadata item.
00211 );
00212 
00213 /** Create a metadata item with specified psS16 data.
00214  *
00215  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00216  *  struct.
00217  *
00218  * @return psMetadataItem* : Pointer metadata item.
00219  */
00220 psMetadataItem* psMetadataItemAllocS16(
00221     const char* name,                  ///< Name of metadata item.
00222     const char* comment,               ///< Comment for metadata item.
00223     psS16 value                        ///< the value of the metadata item.
00224 );
00225 
00226 /** Create a metadata item with specified psS32 data.
00227  *
00228  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00229  *  struct.
00230  *
00231  * @return psMetadataItem* : Pointer metadata item.
00232  */
00233 psMetadataItem* psMetadataItemAllocS32(
00234     const char* name,                  ///< Name of metadata item.
00235     const char* comment,               ///< Comment for metadata item.
00236     psS32 value                        ///< the value of the metadata item.
00237 );
00238 
00239 /** Create a metadata item with specified psS64 data.
00240  *
00241  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00242  *  struct.
00243  *
00244  * @return psMetadataItem* : Pointer metadata item.
00245  */
00246 psMetadataItem* psMetadataItemAllocS64(
00247     const char* name,                  ///< Name of metadata item.
00248     const char* comment,               ///< Comment for metadata item.
00249     psS64 value                        ///< the value of the metadata item.
00250 );
00251 
00252 /** Create a metadata item with specified psU8 data.
00253  *
00254  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00255  *  struct.
00256  *
00257  * @return psMetadataItem* : Pointer metadata item.
00258  */
00259 psMetadataItem* psMetadataItemAllocU8(
00260     const char* name,                  ///< Name of metadata item.
00261     const char* comment,               ///< Comment for metadata item.
00262     psU8 value                         ///< the value of the metadata item.
00263 );
00264 
00265 /** Create a metadata item with specified psU16 data.
00266  *
00267  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00268  *  struct.
00269  *
00270  * @return psMetadataItem* : Pointer metadata item.
00271  */
00272 psMetadataItem* psMetadataItemAllocU16(
00273     const char* name,                  ///< Name of metadata item.
00274     const char* comment,               ///< Comment for metadata item.
00275     psU16 value                        ///< the value of the metadata item.
00276 );
00277 
00278 /** Create a metadata item with specified psU32 data.
00279  *
00280  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00281  *  struct.
00282  *
00283  * @return psMetadataItem* : Pointer metadata item.
00284  */
00285 psMetadataItem* psMetadataItemAllocU32(
00286     const char* name,                  ///< Name of metadata item.
00287     const char* comment,               ///< Comment for metadata item.
00288     psU32 value                        ///< the value of the metadata item.
00289 );
00290 
00291 /** Create a metadata item with specified psU64 data.
00292  *
00293  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00294  *  struct.
00295  *
00296  * @return psMetadataItem* : Pointer metadata item.
00297  */
00298 psMetadataItem* psMetadataItemAllocU64(
00299     const char* name,                  ///< Name of metadata item.
00300     const char* comment,               ///< Comment for metadata item.
00301     psU64 value                        ///< the value of the metadata item.
00302 );
00303 
00304 /** Create a metadata item with specified psBool data.
00305  *
00306  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00307  *  struct.
00308  *
00309  * @return psMetadataItem* : Pointer metadata item.
00310  */
00311 psMetadataItem* psMetadataItemAllocBool(
00312     const char* name,                  ///< Name of metadata item.
00313     const char* comment,               ///< Comment for metadata item.
00314     bool value                         ///< the value of the metadata item.
00315 );
00316 
00317 /** Create a metadata item with specified psPtr data.
00318  *
00319  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00320  *  struct.
00321  *
00322  * @return psMetadataItem* : Pointer metadata item.
00323  */
00324 psMetadataItem* psMetadataItemAllocPtr(
00325     const char* name,                  ///< Name of metadata item.
00326     psDataType type,                   ///< Data type of metadata item.
00327     const char* comment,               ///< Comment for metadata item.
00328     psPtr value                        ///< the value of the metadata item.
00329 );
00330 
00331 #ifndef SWIG
00332 /** Create a metadata item with va_list.
00333  *
00334  *  Returns a fill psMetadataItem ready for insertion into the psMetadata
00335  *  struct. The name argument specifies the name to use for this item, and
00336  *  may include sprintf formatting codes. The format entry specifies both
00337  *  the metadata type and optional flags and is created by bit-wise or of the
00338  *  appropriate type and flag. The comment argument is a fixed string used to
00339  *  comment the metadata item. The arguments to the name formatting codes and
00340  *  the metadata itself are passed as arguments following the comment string.
00341  *  The data must be a pointer for any of the elements stored in data.void.
00342  *  The argument list must be interpreted appropriately by the va_list
00343  *  operators in the function specified size and type.
00344  *
00345  * @return psMetadataItem* : Pointer metadata item.
00346  */
00347 psMetadataItem* psMetadataItemAllocV(
00348     const char *name,                  ///< Name of metadata item.
00349     psDataType type,                   ///< Type of metadata item.
00350     const char *comment,               ///< Comment for metadata item.
00351     va_list list                       ///< Arguments for name formatting and metadata item data.
00352 );
00353 #endif // #ifndef SWIG
00354 
00355 /** Create a metadata collection.
00356  *
00357  *  Returns an empty metadata container with fully allocated internal metadata
00358  *  containers.
00359  *
00360  *  @return psMetadata* : Pointer metadata.
00361  */
00362 psMetadata* psMetadataAlloc(void);
00363 
00364 
00365 /** Checks the type of a particular pointer.
00366  *
00367  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
00368  *
00369  *  @return bool:       True if the pointer matches a psMetadata structure, false otherwise.
00370  */
00371 bool psMemCheckMetadata(
00372     psPtr ptr                          ///< the pointer whose type to check
00373 );
00374 
00375 /** Creates a new copy of a psMetadataItem.
00376  *
00377  * @return psMetadataItem*: the copy of the psMetadataItem
00378  */
00379 psMetadataItem *psMetadataItemCopy(
00380     const psMetadataItem *in           ///< metadata item to be copied
00381 );
00382 
00383 /** Create a copy of an existing psMetadata collection.
00384  *
00385  *  Creates a new copy of all the psMetadataItems in the psMetadata collection, in, and
00386  *  returns them in out, or creates a new container if out is NULL.
00387  *
00388  *  @return psMetadata*:        the copy of the psMetadata container.
00389  */
00390 psMetadata *psMetadataCopy(
00391     psMetadata *out,                   ///< output Metadata container for copying.
00392     const psMetadata *in               ///< Metadata collection to be copied.
00393 );
00394 
00395 /** Copy a metadata item from one psMetadata to another.
00396  *
00397  *  Creates a copy of a psMetadataItem from in and appends it to out.  If out is NULL,
00398  *  a new container is created.
00399  *
00400  *  @return bool:       True if successful, otherwise false.
00401  */
00402 bool psMetadataItemTransfer(
00403     psMetadata *out,                   ///< output Metadata container for copying.
00404     const psMetadata *in,              ///< Metadata collection from which to copy.
00405     const char *key                    ///< key to identify the metadata item for copying.
00406 );
00407 
00408 /** Add existing metadata item to metadata collection.
00409  *
00410  *  Add a metadata item that has already been created to the metadata
00411  *  collection.
00412  *
00413  *  @return bool: True for success, false for failure.
00414  */
00415 bool psMetadataAddItem(
00416     psMetadata*  md,                   ///< Metadata collection to insert metadata item.
00417     const psMetadataItem* item,        ///< Metadata item to be added.
00418     int location,                      ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00419     psS32 flags                        ///< Options flag mask, see psMetadataFlags enum
00420 );
00421 
00422 /** Create and add a metadata item to metadata collection.
00423  *
00424  * Creates a new metadata item add to the metadata collection.
00425  *
00426  * @return bool: True for success, false for failure.
00427  */
00428 bool psMetadataAdd(
00429     psMetadata* md,                    ///< Metadata collection to insert metadata item.
00430     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00431     const char *name,                  ///< Name of metadata item.
00432     int format,                        ///< psDataType of metadata item & options (psMetadataFlags)
00433     const char *comment,               ///< Comment for metadata item.
00434     ...                                ///< Arguments for name formatting and metadata item data.
00435 );
00436 
00437 #ifndef SWIG
00438 /** Create and add a metadata item to metadata collection.
00439  *
00440  * Creates a new metadata item add to the metadata collection.
00441  *
00442  * @return bool: True for success, false for failure.
00443  */
00444 bool psMetadataAddV(
00445     psMetadata* md,                    ///< Metadata collection to insert metadata item.
00446     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00447     const char *name,                  ///< Name of metadata item.
00448     int format,                        ///< psDataType of metadata item & options (psMetadataFlags)
00449     const char *comment,               ///< Comment for metadata item.
00450     va_list list                       ///< Arguments for name formatting and metadata item data.
00451 );
00452 #endif // #ifndef SWIG
00453 
00454 /** Add a psBool value to metadata collection.
00455  *
00456  *  @return bool:  True for success, False for failure.
00457  */
00458 bool psMetadataAddBool(
00459     psMetadata* md,                    ///< Metadata collection to insert metadata item
00460     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00461     const char* name,                  ///< Name of metadata item
00462     int format,                        ///< psMetadataFlag options/flags
00463     const char* comment,               ///< Comment for metadata item
00464     bool value                         ///< Value for metadata item data
00465 );
00466 
00467 /** Add a psS8 value to metadata collection.
00468  *
00469  *  @return bool:  True for success, False for failure.
00470  */
00471 bool psMetadataAddS8(
00472     psMetadata* md,                    ///< Metadata collection to insert metadata item
00473     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00474     const char* name,                  ///< Name of metadata item
00475     int format,                        ///< psMetadataFlag options/flags
00476     const char* comment,               ///< Comment for metadata item
00477     psS8 value                         ///< Value for metadata item data
00478 );
00479 
00480 /** Add a psS16 value to metadata collection.
00481  *
00482  *  @return bool:  True for success, False for failure.
00483  */
00484 bool psMetadataAddS16(
00485     psMetadata* md,                    ///< Metadata collection to insert metadata item
00486     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00487     const char* name,                  ///< Name of metadata item
00488     int format,                        ///< psMetadataFlag options/flags
00489     const char* comment,               ///< Comment for metadata item
00490     psS16 value                        ///< Value for metadata item data
00491 );
00492 
00493 /** Add a psS32 value to metadata collection.
00494  *
00495  *  @return bool:  True for success, False for failure.
00496  */
00497 bool psMetadataAddS32(
00498     psMetadata* md,                    ///< Metadata collection to insert metadata item
00499     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00500     const char* name,                  ///< Name of metadata item
00501     int format,                        ///< psMetadataFlag options/flags
00502     const char* comment,               ///< Comment for metadata item
00503     psS32 value                        ///< Value for metadata item data
00504 );
00505 
00506 /** Add a psS64 value to metadata collection.
00507  *
00508  *  @return bool:  True for success, False for failure.
00509  */
00510 bool psMetadataAddS64(
00511     psMetadata* md,                    ///< Metadata collection to insert metadata item
00512     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00513     const char* name,                  ///< Name of metadata item
00514     int format,                        ///< psMetadataFlag options/flags
00515     const char* comment,               ///< Comment for metadata item
00516     psS64 value                        ///< Value for metadata item data
00517 );
00518 
00519 /** Add a psU8 value to metadata collection.
00520  *
00521  *  @return bool:  True for success, False for failure.
00522  */
00523 bool psMetadataAddU8(
00524     psMetadata* md,                    ///< Metadata collection to insert metadata item
00525     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00526     const char* name,                  ///< Name of metadata item
00527     int format,                        ///< psMetadataFlag options/flags
00528     const char* comment,               ///< Comment for metadata item
00529     psU8 value                         ///< Value for metadata item data
00530 );
00531 
00532 /** Add a psU16 value to metadata collection.
00533  *
00534  *  @return bool:  True for success, False for failure.
00535  */
00536 bool psMetadataAddU16(
00537     psMetadata* md,                    ///< Metadata collection to insert metadata item
00538     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00539     const char* name,                  ///< Name of metadata item
00540     int format,                        ///< psMetadataFlag options/flags
00541     const char* comment,               ///< Comment for metadata item
00542     psU16 value                        ///< Value for metadata item data
00543 );
00544 
00545 /** Add a psU32 value to metadata collection.
00546  *
00547  *  @return bool:  True for success, False for failure.
00548  */
00549 bool psMetadataAddU32(
00550     psMetadata* md,                    ///< Metadata collection to insert metadata item
00551     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00552     const char* name,                  ///< Name of metadata item
00553     int format,                        ///< psMetadataFlag options/flags
00554     const char* comment,               ///< Comment for metadata item
00555     psU32 value                        ///< Value for metadata item data
00556 );
00557 
00558 /** Add a psU64 value to metadata collection.
00559  *
00560  *  @return bool:  True for success, False for failure.
00561  */
00562 bool psMetadataAddU64(
00563     psMetadata* md,                    ///< Metadata collection to insert metadata item
00564     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00565     const char* name,                  ///< Name of metadata item
00566     int format,                        ///< psMetadataFlag options/flags
00567     const char* comment,               ///< Comment for metadata item
00568     psU64 value                        ///< Value for metadata item data
00569 );
00570 
00571 /** Add a psF32 value to metadata collection.
00572  *
00573  *  @return bool:  True for success, False for failure.
00574 */
00575 bool psMetadataAddF32(
00576     psMetadata* md,                    ///< Metadata collection to insert metadata item
00577     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00578     const char* name,                  ///< Name of metadata item
00579     int format,                        ///< psMetadataFlag options/flags
00580     const char* comment,               ///< Comment for metadata item
00581     psF32 value                        ///< Value for metadata item data
00582 );
00583 
00584 /** Add a psF64 value to metadata collection.
00585  *
00586  *  @return bool:  True for success, False for failure.
00587 */
00588 bool psMetadataAddF64(
00589     psMetadata* md,                    ///< Metadata collection to insert metadata item
00590     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00591     const char* name,                  ///< Name of metadata item
00592     int format,                        ///< psMetadataFlag options/flags
00593     const char* comment,               ///< Comment for metadata item
00594     psF64 value                        ///< Value for metadata item data
00595 );
00596 
00597 /** Add a psList to metadata collection.
00598  *
00599  *  @return psBool:  True for success, False for failure.
00600  */
00601 psBool psMetadataAddList(
00602     psMetadata* md,                    ///< Metadata collection to insert metadata item
00603     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00604     const char* name,                  ///< Name of metadata item
00605     int format,                        ///< psMetadataFlag options/flags
00606     const char* comment,               ///< Comment for metadata item
00607     psList* value                      ///< psList for metadata item data
00608 );
00609 
00610 /** Add a string to metadata collection.
00611  *
00612  *  @return bool:  True for success, False for failure.
00613  */
00614 bool psMetadataAddStr(
00615     psMetadata* md,                    ///< Metadata collection to insert metadata item
00616     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00617     const char* name,                  ///< Name of metadata item
00618     int format,                        ///< psMetadataFlag options/flags
00619     const char* comment,               ///< Comment for metadata item
00620     const char* value                  ///< String for metadata item data
00621 );
00622 
00623 /** Add a vector to metadata collection.
00624  *
00625  *  @return psBool:  True for success, False for failure.
00626  */
00627 psBool psMetadataAddVector(
00628     psMetadata* md,                    ///< Metadata collection to insert metadata item
00629     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00630     const char* name,                  ///< Name of metadata item
00631     int format,                        ///< psMetadataFlag options/flags
00632     const char* comment,               ///< Comment for metadata item
00633     psVector* value                    ///< Vector for metadata item data
00634 );
00635 
00636 /** Add a array to metadata collection.
00637  *
00638  *  @return psBool:  True for success, False for failure.
00639  */
00640 psBool psMetadataAddArray(
00641     psMetadata* md,                    ///< Metadata collection to insert metadata item
00642     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00643     const char* name,                  ///< Name of metadata item
00644     int format,                        ///< psMetadataFlag options/flags
00645     const char* comment,               ///< Comment for metadata item
00646     psArray* value                     ///< Vector for metadata item data
00647 );
00648 
00649 /** Add an Image to metadata collection.
00650  *
00651  *  @return psBool:  True for success, False for failure.
00652  */
00653 psBool psMetadataAddImage(
00654     psMetadata* md,                    ///< Metadata collection to insert metadata item
00655     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00656     const char* name,                  ///< Name of metadata item
00657     int format,                        ///< psMetadataFlag options/flags
00658     const char* comment,               ///< Comment for metadata item
00659     psImage* value                     ///< Image for metadata item data
00660 );
00661 
00662 /** Add a Time to metadata collection.
00663  *
00664  *  @return psBool:  True for success, False for failure.
00665  */
00666 psBool psMetadataAddTime(
00667     psMetadata* md,                    ///< Metadata collection to insert metadata item
00668     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00669     const char* name,                  ///< Name of metadata item
00670     int format,                        ///< psMetadataFlag options/flags
00671     const char* comment,               ///< Comment for metadata item
00672     psTime* value                      ///< Time for metadata item data
00673 );
00674 
00675 /** Add a Hash to metadata collection.
00676  *
00677  *  @return psBool:  True for success, False for failure.
00678  */
00679 psBool psMetadataAddHash(
00680     psMetadata* md,                    ///< Metadata collection to insert metadata item
00681     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00682     const char* name,                  ///< Name of metadata item
00683     int format,                        ///< psMetadataFlag options/flags
00684     const char* comment,               ///< Comment for metadata item
00685     psHash* value                      ///< Hash for metadata item data
00686 );
00687 
00688 /** Add a LookupTable to metadata collection.
00689  *
00690  *  @return psBool:  True for success, False for failure.
00691  */
00692 psBool psMetadataAddLookupTable(
00693     psMetadata* md,                    ///< Metadata collection to insert metadata item
00694     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00695     const char* name,                  ///< Name of metadata item
00696     int format,                        ///< psMetadataFlag options/flags
00697     const char* comment,               ///< Comment for metadata item
00698     psLookupTable* value               ///< LookupTable for metadata item data
00699 );
00700 
00701 /** Add an Unknown (psPtr) to metadata collection.
00702  *
00703  *  @return psBool:  True for success, False for failure.
00704  */
00705 psBool psMetadataAddUnknown(
00706     psMetadata* md,                    ///< Metadata collection to insert metadata item
00707     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00708     const char* name,                  ///< Name of metadata item
00709     int format,                        ///< psMetadataFlag options/flags
00710     const char* comment,               ///< Comment for metadata item
00711     psPtr value                        ///< Unknown for metadata item data
00712 );
00713 
00714 /** Add a psPtr to metadata collection.
00715  *
00716  *  @return bool:  True for success, False for failure.
00717  */
00718 bool psMetadataAddPtr(
00719     psMetadata* md,                    ///< Metadata collection to insert metadata item
00720     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00721     const char* name,                  ///< Name of metadata item
00722     psDataType type,                   ///< psDataType for metadata item
00723     const char* comment,               ///< Comment for metadata item
00724     psPtr value                        ///< Unknown for metadata item data
00725 );
00726 
00727 /** Add Metadata to metadata collection.
00728  *
00729  *  @return psBool:  True for success, False for failure.
00730  */
00731 psBool psMetadataAddMetadata(
00732     psMetadata* md,                    ///< Metadata collection to insert metadata item
00733     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00734     const char* name,                  ///< Name of metadata item
00735     int format,                        ///< psMetadataFlag options/flags
00736     const char* comment,               ///< Comment for metadata item
00737     psMetadata* value                  ///< Metadata for metadata item data
00738 );
00739 
00740 /** Remove an item from metadata collection.
00741  *
00742  *  Items may be removed from metadata by specifing a key or location. If the
00743  *  name is null, the where argument is used instead. If name is not null,
00744  *  where is set to PS_LIST_UNKNOWN. If the item is found, it is removed from
00745  *  the metadata and true is returned.  If the key is not unique, then all
00746  *  items corresponding to it are removed.
00747  *
00748  * @return bool: True for success, false for failure.
00749  */
00750 bool psMetadataRemove(
00751     psMetadata*  md,                   ///< Metadata collection to remove metadata item.
00752     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00753     const char * key                   ///< Name of metadata key.
00754 );
00755 
00756 /** Removes an item from metadata by key name.
00757  *
00758  *  @return bool:  True for success, false for failure.
00759  */
00760 bool psMetadataRemoveKey(
00761     psMetadata *md,                    ///< Metadata collection to remove metadata item.
00762     const char *key                    ///< Name of metadata key.
00763 );
00764 
00765 /** Removes an item from metadata by index number.
00766  *
00767  *  @return bool:  True for success, false for failure.
00768  */
00769 bool psMetadataRemoveIndex(
00770     psMetadata *md,                    ///< Metadata collection to remove metadata item.
00771     int location                       ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00772 );
00773 
00774 /** Find an item in the metadata collection based on key name.
00775  *
00776  *  Items may be found in the metadata by providing a key. If the key is
00777  *  non-unique, the first item is returned. If the item is not found, null is
00778  *  returned.
00779  *
00780  * @return psMetadataItem* : Pointer metadata item.
00781  */
00782 psMetadataItem* psMetadataLookup(
00783     const psMetadata * md,             ///< Metadata collection to lookup metadata item.
00784     const char * key                   ///< Name of metadata key.
00785 );
00786 
00787 /** Find an item in the metadata collection based on key name and return its double precision value.
00788  *
00789  *  Items may be found in the metadata by providing a key. If the key is
00790  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00791  *  returned.
00792  *
00793  * @return psF64 : Value of metadata item.
00794  */
00795 psF64 psMetadataLookupF64(
00796     bool *status,                      ///< Status of lookup.
00797     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00798     const char *key                    ///< Name of metadata key.
00799 );
00800 
00801 /** Find an item in the metadata collection based on key name and return its single precision value.
00802  *
00803  *  Items may be found in the metadata by providing a key. If the key is
00804  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00805  *  returned.
00806  *
00807  * @return psF32 : Value of metadata item.
00808  */
00809 psF32 psMetadataLookupF32(
00810     bool *status,                      ///< Status of lookup.
00811     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00812     const char *key                    ///< Name of metadata key.
00813 );
00814 
00815 /** Find an item in the metadata collection based on key name and return its integer value.
00816  *
00817  *  Items may be found in the metadata by providing a key. If the key is
00818  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00819  *  returned.
00820  *
00821  * @return psS8 : Value of metadata item.
00822  */
00823 psS8 psMetadataLookupS8(
00824     bool *status,                      ///< Status of lookup.
00825     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00826     const char *key                    ///< Name of metadata key.
00827 );
00828 
00829 /** Find an item in the metadata collection based on key name and return its integer value.
00830  *
00831  *  Items may be found in the metadata by providing a key. If the key is
00832  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00833  *  returned.
00834  *
00835  * @return psS16 : Value of metadata item.
00836  */
00837 psS16 psMetadataLookupS16(
00838     bool *status,                      ///< Status of lookup.
00839     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00840     const char *key                    ///< Name of metadata key.
00841 );
00842 
00843 /** Find an item in the metadata collection based on key name and return its integer value.
00844  *
00845  *  Items may be found in the metadata by providing a key. If the key is
00846  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00847  *  returned.
00848  *
00849  * @return psS32 : Value of metadata item.
00850  */
00851 psS32 psMetadataLookupS32(
00852     bool *status,                      ///< Status of lookup.
00853     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00854     const char *key                    ///< Name of metadata key.
00855 );
00856 
00857 /** Find an item in the metadata collection based on key name and return its integer value.
00858  *
00859  *  Items may be found in the metadata by providing a key. If the key is
00860  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00861  *  returned.
00862  *
00863  * @return psS64 : Value of metadata item.
00864  */
00865 psS64 psMetadataLookupS64(
00866     bool *status,                      ///< Status of lookup.
00867     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00868     const char *key                    ///< Name of metadata key.
00869 );
00870 
00871 /** Find an item in the metadata collection based on key name and return its integer value.
00872  *
00873  *  Items may be found in the metadata by providing a key. If the key is
00874  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00875  *  returned.
00876  *
00877  * @return psU8 : Value of metadata item.
00878  */
00879 psU8 psMetadataLookupU8(
00880     bool *status,                      ///< Status of lookup.
00881     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00882     const char *key                    ///< Name of metadata key.
00883 );
00884 
00885 /** Find an item in the metadata collection based on key name and return its integer value.
00886  *
00887  *  Items may be found in the metadata by providing a key. If the key is
00888  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00889  *  returned.
00890  *
00891  * @return psU16 : Value of metadata item.
00892  */
00893 psU16 psMetadataLookupU16(
00894     bool *status,                      ///< Status of lookup.
00895     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00896     const char *key                    ///< Name of metadata key.
00897 );
00898 
00899 /** Find an item in the metadata collection based on key name and return its integer value.
00900  *
00901  *  Items may be found in the metadata by providing a key. If the key is
00902  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00903  *  returned.
00904  *
00905  * @return psU32 : Value of metadata item.
00906  */
00907 psU32 psMetadataLookupU32(
00908     bool *status,                      ///< Status of lookup.
00909     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00910     const char *key                    ///< Name of metadata key.
00911 );
00912 
00913 /** Find an item in the metadata collection based on key name and return its integer value.
00914  *
00915  *  Items may be found in the metadata by providing a key. If the key is
00916  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00917  *  returned.
00918  *
00919  * @return psU64 : Value of metadata item.
00920  */
00921 psU64 psMetadataLookupU64(
00922     bool *status,                      ///< Status of lookup.
00923     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00924     const char *key                    ///< Name of metadata key.
00925 );
00926 
00927 /** Find an item in the metadata collection based on key name and return its boolean value.
00928  *
00929  *  Items may be found in the metadata by providing a key. If the key is
00930  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00931  *  returned.
00932  *
00933  * @return bool : Value of metadata item.
00934  */
00935 bool psMetadataLookupBool(
00936     bool *status,                      ///< Status of lookup.
00937     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
00938     const char *key                    ///< Name of metadata key.
00939 );
00940 
00941 /** Find an item in the metadata collection based on key name and return its integer value.
00942  *
00943  *  Items may be found in the metadata by providing a key. If the key is
00944  *  non-unique, the value of the first item is returned. If the item is not found, zero is
00945  *  returned.
00946  *
00947  * @return void* : Value of metadata item.
00948  */
00949 psPtr psMetadataLookupPtr(
00950     bool *status,                      ///< Status of lookup.
00951     const psMetadata* md,              ///< Metadata collection to lookup metadata item.
00952     const char *key                    ///< Name of metadata key.
00953 );
00954 
00955 /** Find an item in the metadata collection based on list index.
00956  *
00957  *  Items may be found in the metadata by their entry position in the list
00958  *  container.
00959  *
00960  *  @return psMetadataItem* : Pointer metadata item.
00961  */
00962 psMetadataItem* psMetadataGet(
00963     const psMetadata* md,              ///< Metadata collection to retrieve metadata item.
00964     int location                       ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00965 );
00966 
00967 /** Creates a psMetadataIterator to iterate over the specified psMetadata.
00968  *
00969  *  Supports the subsetting of the metadata via keyword using regular
00970  *  expression.  If no regular expression is specified, iteration
00971  *  over the entire psMetadata is performed.
00972  *
00973  *  @return psMetadataIterator*        a new psMetadataIterator, of NULL if error occurred
00974  */
00975 psMetadataIterator* psMetadataIteratorAlloc(
00976     psMetadata* md,                    ///< the psMetadata to iterate with
00977     long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
00978     const char* regex
00979     ///< A regular expression for subsetting the psMetadata.  If NULL, no
00980     ///< subsetting is performed.
00981 );
00982 
00983 /** Set the iterator of the psMetadat to a given position.  If location is
00984  *  invalid the iterator position is not changed.
00985  *
00986  *  @return bool        TRUE if iterator successfully set, otherwise FALSE.
00987 */
00988 bool psMetadataIteratorSet(
00989     psMetadataIterator* iterator,      ///< psMetadata iterator
00990     long location                      ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
00991 );
00992 
00993 /** Position the specified iterator to the next matching item in psMetadata,
00994  *  given the regular expression of the iterator
00995  *
00996  *  @return psPtr       the psMetadataItem at the original iterator position
00997  *                      or NULL if the iterator went past the end of the list.
00998  */
00999 psMetadataItem* psMetadataGetAndIncrement(
01000     psMetadataIterator* iterator       ///< iterator to move
01001 );
01002 
01003 /** Position the specified iterator to the previous matching item in psMetadata,
01004  *  given the regular expression of the iterator
01005  *
01006  *  @return psPtr       the psMetadataItem at the original iterator position
01007  *                      or NULL if the iterator went past the beginning of the
01008  *                      list.
01009  */
01010 psMetadataItem* psMetadataGetAndDecrement(
01011     psMetadataIterator* iterator       ///< iterator to move
01012 );
01013 
01014 /** Find an item in the metadata collection based on key name and return its metadata value.
01015  *
01016  *  Items may be found in the metadata by providing a key. If the key is
01017  *  non-unique, the value of the first item is returned. If the item is not found, zero is
01018  *  returned.
01019  *
01020  *  @return psMetadata*:        Value of metadata item.
01021  */
01022 psMetadata *psMetadataLookupMD(
01023     bool *status,                      ///< Status of lookup.
01024     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
01025     const char *key                    ///< Name of metadata key.
01026 );
01027 
01028 /** Find an item in the metadata collection based on key name and return its string value.
01029  *
01030  *  Items may be found in the metadata by providing a key. If the key is
01031  *  non-unique, the value of the first item is returned. If the item is not found, zero is
01032  *  returned.
01033  *
01034  *  @return psString:           Value of metadata item.
01035  */
01036 psString psMetadataLookupStr(
01037     bool *status,                      ///< Status of lookup.
01038     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
01039     const char *key                    ///< Name of metadata key.
01040 );
01041 
01042 /** Find an item in the metadata collection based on key name and return it as a psTime pointer.
01043  *
01044  *  Items may be found in the metadata by providing a key. If the key is
01045  *  non-unique, the value of the first item is returned. If the item is not found, zero is
01046  *  returned.
01047  *
01048  *  @return psTime:           Value of metadata item.
01049  */
01050 
01051 psTime *psMetadataLookupTime(
01052     bool *status,                      ///< Status of lookup.
01053     const psMetadata *md,              ///< Metadata collection to lookup metadata item.
01054     const char *key                    ///< Name of metadata key.
01055 );
01056 
01057 
01058 /** Prints metadata collection.
01059  *
01060  *  Metadata contents are printed to a valid file descriptor if one exists.  Otherwise,
01061  *  fd should be NULL and the contents are printed to the screen (stdout).
01062  *
01063  *  @return bool:           True if successful, otherwise false.
01064 */
01065 bool psMetadataPrint(
01066     FILE *fd,                          ///< File Descriptor or NULL
01067     const psMetadata *md,               ///< Metadata collection to print.
01068     int level                          ///< the level of metadata items.
01069 );
01070 
01071 
01072 psPolynomial2D *psPolynomial2DfromMD (psMetadata *folder);
01073 bool psPolynomial2DtoMD (psMetadata *md, psPolynomial2D *poly, char *format, ...);
01074 
01075 psPolynomial3D *psPolynomial3DfromMD (psMetadata *folder);
01076 bool psPolynomial3DtoMD (psMetadata *md, psPolynomial3D *poly, char *format, ...);
01077 
01078 psPolynomial4D *psPolynomial4DfromMD (psMetadata *folder);
01079 bool psPolynomial4DtoMD (psMetadata *md, psPolynomial4D *poly, char *format, ...);
01080 
01081 
01082 /// @}
01083 
01084 #endif // #ifndef PS_METADATA_H

Generated on Mon Jul 3 14:13:44 2006 for Pan-STARRS Foundation Library by  doxygen 1.4.4