Changeset 2648
- Timestamp:
- Dec 7, 2004, 9:09:18 AM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 8 edited
-
astronomy/psAstronomyErrors.dat (modified) (1 diff)
-
astronomy/psAstronomyErrors.h (modified) (2 diffs)
-
astronomy/psMetadata.c (modified) (9 diffs)
-
astronomy/psMetadata.h (modified) (10 diffs)
-
collections/psMetadata.c (modified) (9 diffs)
-
collections/psMetadata.h (modified) (10 diffs)
-
types/psMetadata.c (modified) (9 diffs)
-
types/psMetadata.h (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astronomy/psAstronomyErrors.dat
r2607 r2648 36 36 # 37 37 psMetadata_METATYPE_INVALID Specified psMetadataType, %d, is not supported. 38 psMetadata_METATYPE_MISMATCH Specified psMetadataType, %d, is incorrect. Expected %d. 38 39 psMetadata_ADD_LIST_FAILED Failed to add metadata item, %s, to items list. 39 40 psMetadata_ADD_TABLE_FAILED Failed to add metadata item, %s, to items table. -
trunk/psLib/src/astronomy/psAstronomyErrors.h
r2607 r2648 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-12-0 3 23:14:13$9 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-12-07 19:09:18 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 56 56 #define PS_ERRORTEXT_psAstrometry_NONLINEAR_TRANSFORM "The %s transfrom is not linear. Only linear transforms are supported." 57 57 #define PS_ERRORTEXT_psMetadata_METATYPE_INVALID "Specified psMetadataType, %d, is not supported." 58 #define PS_ERRORTEXT_psMetadata_METATYPE_MISMATCH "Specified psMetadataType, %d, is incorrect. Expected %d." 58 59 #define PS_ERRORTEXT_psMetadata_ADD_LIST_FAILED "Failed to add metadata item, %s, to items list." 59 60 #define PS_ERRORTEXT_psMetadata_ADD_TABLE_FAILED "Failed to add metadata item, %s, to items table." -
trunk/psLib/src/astronomy/psMetadata.c
r2607 r2648 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 39$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-12-0 3 23:14:28$14 * @version $Revision: 1.40 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-12-07 19:09:05 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 218 218 } 219 219 220 psBool psMetadataAddItem(psMetadata * restrict md, psMetadataItem *restrictmetadataItem, psS32 location)220 psBool psMetadataAddItem(psMetadata *md, psMetadataItem *metadataItem, psS32 location) 221 221 { 222 222 char * key = NULL; … … 328 328 } 329 329 330 psBool psMetadataAdd(psMetadata * restrictmd, psS32 where, const char *name, psElemType pType,330 psBool psMetadataAdd(psMetadata *md, psS32 where, const char *name, psElemType pType, 331 331 psMetadataType type, const char *comment, ...) 332 332 { … … 349 349 } 350 350 351 psBool psMetadataRemove(psMetadata * restrict md, psS32 where, const char *restrictkey)351 psBool psMetadataRemove(psMetadata *md, psS32 where, const char *key) 352 352 { 353 353 psList* mdList = NULL; … … 421 421 } 422 422 423 psMetadataItem* psMetadataLookup(psMetadata * restrict md, const char *restrictkey)423 psMetadataItem* psMetadataLookup(psMetadata *md, const char *key) 424 424 { 425 425 psHash* mdTable = NULL; … … 432 432 433 433 mdTable = md->table; 434 435 434 entry = (psMetadataItem*)psHashLookup(mdTable, key); 436 if (entry == NULL) {437 return NULL;438 }439 435 440 436 return entry; 441 437 } 442 438 443 psMetadataItem* psMetadataGet(psMetadata* restrict md, psS32 where) 439 void* psMetadataLookupPtr(psMetadata *md, const char *key) 440 { 441 void *value = NULL; 442 psElemType pType; 443 psMetadataItem *metadataItem = NULL; 444 445 446 metadataItem = psMetadataLookup(md, key); 447 PS_PTR_CHECK_NULL(metadataItem,NULL); 448 pType = metadataItem->pType; 449 value = metadataItem->data.V; 450 if(pType != PS_TYPE_PTR) { 451 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psMetadata_METATYPE_MISMATCH, pType, 452 PS_TYPE_PTR); 453 } 454 455 return value; 456 } 457 458 psS32 psMetadataLookupS32(psMetadata *md, const char *key) 459 { 460 psS32 value = 0; 461 psElemType pType; 462 psMetadataItem *metadataItem = NULL; 463 464 465 metadataItem = psMetadataLookup(md, key); 466 PS_PTR_CHECK_NULL(metadataItem,0); 467 pType = metadataItem->pType; 468 value = metadataItem->data.S32; 469 if(pType != PS_TYPE_S32) { 470 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psMetadata_METATYPE_MISMATCH, pType, 471 PS_TYPE_S32); 472 } 473 474 return value; 475 } 476 477 psF64 psMetadataLookupF64(psMetadata *md, const char *key) 478 { 479 psF64 value = 0.0; 480 psElemType pType; 481 psMetadataItem *metadataItem = NULL; 482 483 484 metadataItem = psMetadataLookup(md, key); 485 PS_PTR_CHECK_NULL(metadataItem,0.0); 486 pType = metadataItem->pType; 487 value = metadataItem->data.F64; 488 if(pType != PS_TYPE_F64) { 489 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psMetadata_METATYPE_MISMATCH, pType, 490 PS_TYPE_F64); 491 } 492 493 return value; 494 } 495 496 psMetadataItem* psMetadataGet(psMetadata *md, psS32 where) 444 497 { 445 498 psMetadataItem* entry = NULL; … … 457 510 } 458 511 459 psBool psMetadataSetIterator(psMetadata * restrictmd, psS32 where)512 psBool psMetadataSetIterator(psMetadata *md, psS32 where) 460 513 { 461 514 PS_PTR_CHECK_NULL(md,NULL); … … 467 520 } 468 521 469 psMetadataItem* psMetadataGetNext(psMetadata * restrict md, const char *restrictmatch, psS32 which)522 psMetadataItem* psMetadataGetNext(psMetadata *md, const char *match, psS32 which) 470 523 { 471 524 psList* mdList = NULL; … … 497 550 } 498 551 499 psMetadataItem* psMetadataGetPrevious(psMetadata * restrict md, const char *restrictmatch, psS32 which)552 psMetadataItem* psMetadataGetPrevious(psMetadata *md, const char *match, psS32 which) 500 553 { 501 554 psList* mdList = NULL; -
trunk/psLib/src/astronomy/psMetadata.h
r2607 r2648 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 7$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-12-0 3 23:14:34$13 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-12-07 19:08:58 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 56 56 typedef struct psMetadata 57 57 { 58 psList* restrict list; ///< the metadata in linked-list59 psHash* restrict table; ///< the metadata in a hash table58 psList* list; ///< Metadata in linked-list 59 psHash* table; ///< Metadata in a hash table 60 60 } 61 61 psMetadata; … … 148 148 */ 149 149 psBool psMetadataAddItem( 150 psMetadata* restrict md,///< Metadata collection to insert metadat item.151 psMetadataItem* restrict item,///< Metadata item to be added.152 psS32 location ///< Location to be added.150 psMetadata* md, ///< Metadata collection to insert metadat item. 151 psMetadataItem* item, ///< Metadata item to be added. 152 psS32 location ///< Location to be added. 153 153 ); 154 154 … … 160 160 */ 161 161 psBool psMetadataAdd( 162 psMetadata* restrictmd, ///< Metadata collection to insert metadat item.163 psS32 where, ///< Location to be added.164 const char *name, ///< Name of metadata item.165 psElemType pType, ///< Primitive type.166 psMetadataType type, ///< Type of metadata item.167 const char *comment, ///< Comment for metadata item.168 ... ///< Arguments for name formatting and metadata item data.162 psMetadata* md, ///< Metadata collection to insert metadat item. 163 psS32 where, ///< Location to be added. 164 const char *name, ///< Name of metadata item. 165 psElemType pType, ///< Primitive type. 166 psMetadataType type, ///< Type of metadata item. 167 const char *comment, ///< Comment for metadata item. 168 ... ///< Arguments for name formatting and metadata item data. 169 169 ); 170 170 … … 180 180 */ 181 181 psBool psMetadataRemove( 182 psMetadata* restrict md, ///< Metadata collection to insert metadatitem.183 psS32 where, ///< Location to be removed.184 const char * restrictkey ///< Name of metadata key.182 psMetadata* md, ///< Metadata collection to remove metadata item. 183 psS32 where, ///< Location to be removed. 184 const char * key ///< Name of metadata key. 185 185 ); 186 186 … … 194 194 */ 195 195 psMetadataItem* psMetadataLookup( 196 psMetadata* restrict md, ///< Metadata collection to insert metadata item. 197 const char *restrict key ///< Name of metadata key. 196 psMetadata * md, ///< Metadata collection to lookup metadata item. 197 const char * key ///< Name of metadata key. 198 ); 199 200 /** Find an item in the metadata collection based on key name and return its double precision value. 201 * 202 * Items may be found in the metadata by providing a key. If the key is 203 * non-unique, the value of the first item is returned. If the item is not found, zero is 204 * returned. 205 * 206 * @return psF64 : Value of metadata item. 207 */ 208 psF64 psMetadataLookupF64( 209 psMetadata *md, ///< Metadata collection to lookup metadata item. 210 const char *key ///< Name of metadata key. 211 ); 212 213 /** Find an item in the metadata collection based on key name and return its integer value. 214 * 215 * Items may be found in the metadata by providing a key. If the key is 216 * non-unique, the value of the first item is returned. If the item is not found, zero is 217 * returned. 218 * 219 * @return psS32 : Value of metadata item. 220 */ 221 psS32 psMetadataLookupS32( 222 psMetadata *md, ///< Metadata collection to lookup metadata item. 223 const char *key ///< Name of metadata key. 224 ); 225 226 /** Find an item in the metadata collection based on key name and return its integer value. 227 * 228 * Items may be found in the metadata by providing a key. If the key is 229 * non-unique, the value of the first item is returned. If the item is not found, zero is 230 * returned. 231 * 232 * @return void* : Value of metadata item. 233 */ 234 void* psMetadataLookupPtr( 235 psMetadata* md, ///< Metadata collection to lookup metadata item. 236 const char *key ///< Name of metadata key. 198 237 ); 199 238 … … 206 245 */ 207 246 psMetadataItem* psMetadataGet( 208 psMetadata* restrictmd, ///< Metadata collection to insert metadat item.209 psS32 where ///< Location to be retrieved.247 psMetadata* md, ///< Metadata collection to insert metadat item. 248 psS32 where ///< Location to be retrieved. 210 249 ); 211 250 … … 218 257 */ 219 258 psBool psMetadataSetIterator( 220 psMetadata* restrictmd, ///< Metadata collection to iterate.221 psS32 where ///< Location of iterator.259 psMetadata* md, ///< Metadata collection to iterate. 260 psS32 where ///< Location of iterator. 222 261 ); 223 262 … … 229 268 */ 230 269 psMetadataItem* psMetadataGetNext( 231 psMetadata* restrictmd, ///< Metadata collection to iterate.232 const char * restrictmatch, ///< Beginning of key name.233 psS32 which ///< Iterator to be used.270 psMetadata* md, ///< Metadata collection to iterate. 271 const char * match, ///< Beginning of key name. 272 psS32 which ///< Iterator to be used. 234 273 ); 235 274 … … 241 280 */ 242 281 psMetadataItem* psMetadataGetPrevious( 243 psMetadata * restrict md,///< Metadata collection to iterate.244 const char * restrict match,///< Beginning of key name.245 psS32 which ///< Iterator to be used.282 psMetadata *md, ///< Metadata collection to iterate. 283 const char *match, ///< Beginning of key name. 284 psS32 which ///< Iterator to be used. 246 285 ); 247 286 -
trunk/psLib/src/collections/psMetadata.c
r2607 r2648 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 39$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-12-0 3 23:14:28$14 * @version $Revision: 1.40 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-12-07 19:09:05 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 218 218 } 219 219 220 psBool psMetadataAddItem(psMetadata * restrict md, psMetadataItem *restrictmetadataItem, psS32 location)220 psBool psMetadataAddItem(psMetadata *md, psMetadataItem *metadataItem, psS32 location) 221 221 { 222 222 char * key = NULL; … … 328 328 } 329 329 330 psBool psMetadataAdd(psMetadata * restrictmd, psS32 where, const char *name, psElemType pType,330 psBool psMetadataAdd(psMetadata *md, psS32 where, const char *name, psElemType pType, 331 331 psMetadataType type, const char *comment, ...) 332 332 { … … 349 349 } 350 350 351 psBool psMetadataRemove(psMetadata * restrict md, psS32 where, const char *restrictkey)351 psBool psMetadataRemove(psMetadata *md, psS32 where, const char *key) 352 352 { 353 353 psList* mdList = NULL; … … 421 421 } 422 422 423 psMetadataItem* psMetadataLookup(psMetadata * restrict md, const char *restrictkey)423 psMetadataItem* psMetadataLookup(psMetadata *md, const char *key) 424 424 { 425 425 psHash* mdTable = NULL; … … 432 432 433 433 mdTable = md->table; 434 435 434 entry = (psMetadataItem*)psHashLookup(mdTable, key); 436 if (entry == NULL) {437 return NULL;438 }439 435 440 436 return entry; 441 437 } 442 438 443 psMetadataItem* psMetadataGet(psMetadata* restrict md, psS32 where) 439 void* psMetadataLookupPtr(psMetadata *md, const char *key) 440 { 441 void *value = NULL; 442 psElemType pType; 443 psMetadataItem *metadataItem = NULL; 444 445 446 metadataItem = psMetadataLookup(md, key); 447 PS_PTR_CHECK_NULL(metadataItem,NULL); 448 pType = metadataItem->pType; 449 value = metadataItem->data.V; 450 if(pType != PS_TYPE_PTR) { 451 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psMetadata_METATYPE_MISMATCH, pType, 452 PS_TYPE_PTR); 453 } 454 455 return value; 456 } 457 458 psS32 psMetadataLookupS32(psMetadata *md, const char *key) 459 { 460 psS32 value = 0; 461 psElemType pType; 462 psMetadataItem *metadataItem = NULL; 463 464 465 metadataItem = psMetadataLookup(md, key); 466 PS_PTR_CHECK_NULL(metadataItem,0); 467 pType = metadataItem->pType; 468 value = metadataItem->data.S32; 469 if(pType != PS_TYPE_S32) { 470 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psMetadata_METATYPE_MISMATCH, pType, 471 PS_TYPE_S32); 472 } 473 474 return value; 475 } 476 477 psF64 psMetadataLookupF64(psMetadata *md, const char *key) 478 { 479 psF64 value = 0.0; 480 psElemType pType; 481 psMetadataItem *metadataItem = NULL; 482 483 484 metadataItem = psMetadataLookup(md, key); 485 PS_PTR_CHECK_NULL(metadataItem,0.0); 486 pType = metadataItem->pType; 487 value = metadataItem->data.F64; 488 if(pType != PS_TYPE_F64) { 489 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psMetadata_METATYPE_MISMATCH, pType, 490 PS_TYPE_F64); 491 } 492 493 return value; 494 } 495 496 psMetadataItem* psMetadataGet(psMetadata *md, psS32 where) 444 497 { 445 498 psMetadataItem* entry = NULL; … … 457 510 } 458 511 459 psBool psMetadataSetIterator(psMetadata * restrictmd, psS32 where)512 psBool psMetadataSetIterator(psMetadata *md, psS32 where) 460 513 { 461 514 PS_PTR_CHECK_NULL(md,NULL); … … 467 520 } 468 521 469 psMetadataItem* psMetadataGetNext(psMetadata * restrict md, const char *restrictmatch, psS32 which)522 psMetadataItem* psMetadataGetNext(psMetadata *md, const char *match, psS32 which) 470 523 { 471 524 psList* mdList = NULL; … … 497 550 } 498 551 499 psMetadataItem* psMetadataGetPrevious(psMetadata * restrict md, const char *restrictmatch, psS32 which)552 psMetadataItem* psMetadataGetPrevious(psMetadata *md, const char *match, psS32 which) 500 553 { 501 554 psList* mdList = NULL; -
trunk/psLib/src/collections/psMetadata.h
r2607 r2648 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 7$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-12-0 3 23:14:34$13 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-12-07 19:08:58 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 56 56 typedef struct psMetadata 57 57 { 58 psList* restrict list; ///< the metadata in linked-list59 psHash* restrict table; ///< the metadata in a hash table58 psList* list; ///< Metadata in linked-list 59 psHash* table; ///< Metadata in a hash table 60 60 } 61 61 psMetadata; … … 148 148 */ 149 149 psBool psMetadataAddItem( 150 psMetadata* restrict md,///< Metadata collection to insert metadat item.151 psMetadataItem* restrict item,///< Metadata item to be added.152 psS32 location ///< Location to be added.150 psMetadata* md, ///< Metadata collection to insert metadat item. 151 psMetadataItem* item, ///< Metadata item to be added. 152 psS32 location ///< Location to be added. 153 153 ); 154 154 … … 160 160 */ 161 161 psBool psMetadataAdd( 162 psMetadata* restrictmd, ///< Metadata collection to insert metadat item.163 psS32 where, ///< Location to be added.164 const char *name, ///< Name of metadata item.165 psElemType pType, ///< Primitive type.166 psMetadataType type, ///< Type of metadata item.167 const char *comment, ///< Comment for metadata item.168 ... ///< Arguments for name formatting and metadata item data.162 psMetadata* md, ///< Metadata collection to insert metadat item. 163 psS32 where, ///< Location to be added. 164 const char *name, ///< Name of metadata item. 165 psElemType pType, ///< Primitive type. 166 psMetadataType type, ///< Type of metadata item. 167 const char *comment, ///< Comment for metadata item. 168 ... ///< Arguments for name formatting and metadata item data. 169 169 ); 170 170 … … 180 180 */ 181 181 psBool psMetadataRemove( 182 psMetadata* restrict md, ///< Metadata collection to insert metadatitem.183 psS32 where, ///< Location to be removed.184 const char * restrictkey ///< Name of metadata key.182 psMetadata* md, ///< Metadata collection to remove metadata item. 183 psS32 where, ///< Location to be removed. 184 const char * key ///< Name of metadata key. 185 185 ); 186 186 … … 194 194 */ 195 195 psMetadataItem* psMetadataLookup( 196 psMetadata* restrict md, ///< Metadata collection to insert metadata item. 197 const char *restrict key ///< Name of metadata key. 196 psMetadata * md, ///< Metadata collection to lookup metadata item. 197 const char * key ///< Name of metadata key. 198 ); 199 200 /** Find an item in the metadata collection based on key name and return its double precision value. 201 * 202 * Items may be found in the metadata by providing a key. If the key is 203 * non-unique, the value of the first item is returned. If the item is not found, zero is 204 * returned. 205 * 206 * @return psF64 : Value of metadata item. 207 */ 208 psF64 psMetadataLookupF64( 209 psMetadata *md, ///< Metadata collection to lookup metadata item. 210 const char *key ///< Name of metadata key. 211 ); 212 213 /** Find an item in the metadata collection based on key name and return its integer value. 214 * 215 * Items may be found in the metadata by providing a key. If the key is 216 * non-unique, the value of the first item is returned. If the item is not found, zero is 217 * returned. 218 * 219 * @return psS32 : Value of metadata item. 220 */ 221 psS32 psMetadataLookupS32( 222 psMetadata *md, ///< Metadata collection to lookup metadata item. 223 const char *key ///< Name of metadata key. 224 ); 225 226 /** Find an item in the metadata collection based on key name and return its integer value. 227 * 228 * Items may be found in the metadata by providing a key. If the key is 229 * non-unique, the value of the first item is returned. If the item is not found, zero is 230 * returned. 231 * 232 * @return void* : Value of metadata item. 233 */ 234 void* psMetadataLookupPtr( 235 psMetadata* md, ///< Metadata collection to lookup metadata item. 236 const char *key ///< Name of metadata key. 198 237 ); 199 238 … … 206 245 */ 207 246 psMetadataItem* psMetadataGet( 208 psMetadata* restrictmd, ///< Metadata collection to insert metadat item.209 psS32 where ///< Location to be retrieved.247 psMetadata* md, ///< Metadata collection to insert metadat item. 248 psS32 where ///< Location to be retrieved. 210 249 ); 211 250 … … 218 257 */ 219 258 psBool psMetadataSetIterator( 220 psMetadata* restrictmd, ///< Metadata collection to iterate.221 psS32 where ///< Location of iterator.259 psMetadata* md, ///< Metadata collection to iterate. 260 psS32 where ///< Location of iterator. 222 261 ); 223 262 … … 229 268 */ 230 269 psMetadataItem* psMetadataGetNext( 231 psMetadata* restrictmd, ///< Metadata collection to iterate.232 const char * restrictmatch, ///< Beginning of key name.233 psS32 which ///< Iterator to be used.270 psMetadata* md, ///< Metadata collection to iterate. 271 const char * match, ///< Beginning of key name. 272 psS32 which ///< Iterator to be used. 234 273 ); 235 274 … … 241 280 */ 242 281 psMetadataItem* psMetadataGetPrevious( 243 psMetadata * restrict md,///< Metadata collection to iterate.244 const char * restrict match,///< Beginning of key name.245 psS32 which ///< Iterator to be used.282 psMetadata *md, ///< Metadata collection to iterate. 283 const char *match, ///< Beginning of key name. 284 psS32 which ///< Iterator to be used. 246 285 ); 247 286 -
trunk/psLib/src/types/psMetadata.c
r2607 r2648 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 39$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-12-0 3 23:14:28$14 * @version $Revision: 1.40 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-12-07 19:09:05 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 218 218 } 219 219 220 psBool psMetadataAddItem(psMetadata * restrict md, psMetadataItem *restrictmetadataItem, psS32 location)220 psBool psMetadataAddItem(psMetadata *md, psMetadataItem *metadataItem, psS32 location) 221 221 { 222 222 char * key = NULL; … … 328 328 } 329 329 330 psBool psMetadataAdd(psMetadata * restrictmd, psS32 where, const char *name, psElemType pType,330 psBool psMetadataAdd(psMetadata *md, psS32 where, const char *name, psElemType pType, 331 331 psMetadataType type, const char *comment, ...) 332 332 { … … 349 349 } 350 350 351 psBool psMetadataRemove(psMetadata * restrict md, psS32 where, const char *restrictkey)351 psBool psMetadataRemove(psMetadata *md, psS32 where, const char *key) 352 352 { 353 353 psList* mdList = NULL; … … 421 421 } 422 422 423 psMetadataItem* psMetadataLookup(psMetadata * restrict md, const char *restrictkey)423 psMetadataItem* psMetadataLookup(psMetadata *md, const char *key) 424 424 { 425 425 psHash* mdTable = NULL; … … 432 432 433 433 mdTable = md->table; 434 435 434 entry = (psMetadataItem*)psHashLookup(mdTable, key); 436 if (entry == NULL) {437 return NULL;438 }439 435 440 436 return entry; 441 437 } 442 438 443 psMetadataItem* psMetadataGet(psMetadata* restrict md, psS32 where) 439 void* psMetadataLookupPtr(psMetadata *md, const char *key) 440 { 441 void *value = NULL; 442 psElemType pType; 443 psMetadataItem *metadataItem = NULL; 444 445 446 metadataItem = psMetadataLookup(md, key); 447 PS_PTR_CHECK_NULL(metadataItem,NULL); 448 pType = metadataItem->pType; 449 value = metadataItem->data.V; 450 if(pType != PS_TYPE_PTR) { 451 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psMetadata_METATYPE_MISMATCH, pType, 452 PS_TYPE_PTR); 453 } 454 455 return value; 456 } 457 458 psS32 psMetadataLookupS32(psMetadata *md, const char *key) 459 { 460 psS32 value = 0; 461 psElemType pType; 462 psMetadataItem *metadataItem = NULL; 463 464 465 metadataItem = psMetadataLookup(md, key); 466 PS_PTR_CHECK_NULL(metadataItem,0); 467 pType = metadataItem->pType; 468 value = metadataItem->data.S32; 469 if(pType != PS_TYPE_S32) { 470 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psMetadata_METATYPE_MISMATCH, pType, 471 PS_TYPE_S32); 472 } 473 474 return value; 475 } 476 477 psF64 psMetadataLookupF64(psMetadata *md, const char *key) 478 { 479 psF64 value = 0.0; 480 psElemType pType; 481 psMetadataItem *metadataItem = NULL; 482 483 484 metadataItem = psMetadataLookup(md, key); 485 PS_PTR_CHECK_NULL(metadataItem,0.0); 486 pType = metadataItem->pType; 487 value = metadataItem->data.F64; 488 if(pType != PS_TYPE_F64) { 489 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psMetadata_METATYPE_MISMATCH, pType, 490 PS_TYPE_F64); 491 } 492 493 return value; 494 } 495 496 psMetadataItem* psMetadataGet(psMetadata *md, psS32 where) 444 497 { 445 498 psMetadataItem* entry = NULL; … … 457 510 } 458 511 459 psBool psMetadataSetIterator(psMetadata * restrictmd, psS32 where)512 psBool psMetadataSetIterator(psMetadata *md, psS32 where) 460 513 { 461 514 PS_PTR_CHECK_NULL(md,NULL); … … 467 520 } 468 521 469 psMetadataItem* psMetadataGetNext(psMetadata * restrict md, const char *restrictmatch, psS32 which)522 psMetadataItem* psMetadataGetNext(psMetadata *md, const char *match, psS32 which) 470 523 { 471 524 psList* mdList = NULL; … … 497 550 } 498 551 499 psMetadataItem* psMetadataGetPrevious(psMetadata * restrict md, const char *restrictmatch, psS32 which)552 psMetadataItem* psMetadataGetPrevious(psMetadata *md, const char *match, psS32 which) 500 553 { 501 554 psList* mdList = NULL; -
trunk/psLib/src/types/psMetadata.h
r2607 r2648 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 7$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-12-0 3 23:14:34$13 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-12-07 19:08:58 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 56 56 typedef struct psMetadata 57 57 { 58 psList* restrict list; ///< the metadata in linked-list59 psHash* restrict table; ///< the metadata in a hash table58 psList* list; ///< Metadata in linked-list 59 psHash* table; ///< Metadata in a hash table 60 60 } 61 61 psMetadata; … … 148 148 */ 149 149 psBool psMetadataAddItem( 150 psMetadata* restrict md,///< Metadata collection to insert metadat item.151 psMetadataItem* restrict item,///< Metadata item to be added.152 psS32 location ///< Location to be added.150 psMetadata* md, ///< Metadata collection to insert metadat item. 151 psMetadataItem* item, ///< Metadata item to be added. 152 psS32 location ///< Location to be added. 153 153 ); 154 154 … … 160 160 */ 161 161 psBool psMetadataAdd( 162 psMetadata* restrictmd, ///< Metadata collection to insert metadat item.163 psS32 where, ///< Location to be added.164 const char *name, ///< Name of metadata item.165 psElemType pType, ///< Primitive type.166 psMetadataType type, ///< Type of metadata item.167 const char *comment, ///< Comment for metadata item.168 ... ///< Arguments for name formatting and metadata item data.162 psMetadata* md, ///< Metadata collection to insert metadat item. 163 psS32 where, ///< Location to be added. 164 const char *name, ///< Name of metadata item. 165 psElemType pType, ///< Primitive type. 166 psMetadataType type, ///< Type of metadata item. 167 const char *comment, ///< Comment for metadata item. 168 ... ///< Arguments for name formatting and metadata item data. 169 169 ); 170 170 … … 180 180 */ 181 181 psBool psMetadataRemove( 182 psMetadata* restrict md, ///< Metadata collection to insert metadatitem.183 psS32 where, ///< Location to be removed.184 const char * restrictkey ///< Name of metadata key.182 psMetadata* md, ///< Metadata collection to remove metadata item. 183 psS32 where, ///< Location to be removed. 184 const char * key ///< Name of metadata key. 185 185 ); 186 186 … … 194 194 */ 195 195 psMetadataItem* psMetadataLookup( 196 psMetadata* restrict md, ///< Metadata collection to insert metadata item. 197 const char *restrict key ///< Name of metadata key. 196 psMetadata * md, ///< Metadata collection to lookup metadata item. 197 const char * key ///< Name of metadata key. 198 ); 199 200 /** Find an item in the metadata collection based on key name and return its double precision value. 201 * 202 * Items may be found in the metadata by providing a key. If the key is 203 * non-unique, the value of the first item is returned. If the item is not found, zero is 204 * returned. 205 * 206 * @return psF64 : Value of metadata item. 207 */ 208 psF64 psMetadataLookupF64( 209 psMetadata *md, ///< Metadata collection to lookup metadata item. 210 const char *key ///< Name of metadata key. 211 ); 212 213 /** Find an item in the metadata collection based on key name and return its integer value. 214 * 215 * Items may be found in the metadata by providing a key. If the key is 216 * non-unique, the value of the first item is returned. If the item is not found, zero is 217 * returned. 218 * 219 * @return psS32 : Value of metadata item. 220 */ 221 psS32 psMetadataLookupS32( 222 psMetadata *md, ///< Metadata collection to lookup metadata item. 223 const char *key ///< Name of metadata key. 224 ); 225 226 /** Find an item in the metadata collection based on key name and return its integer value. 227 * 228 * Items may be found in the metadata by providing a key. If the key is 229 * non-unique, the value of the first item is returned. If the item is not found, zero is 230 * returned. 231 * 232 * @return void* : Value of metadata item. 233 */ 234 void* psMetadataLookupPtr( 235 psMetadata* md, ///< Metadata collection to lookup metadata item. 236 const char *key ///< Name of metadata key. 198 237 ); 199 238 … … 206 245 */ 207 246 psMetadataItem* psMetadataGet( 208 psMetadata* restrictmd, ///< Metadata collection to insert metadat item.209 psS32 where ///< Location to be retrieved.247 psMetadata* md, ///< Metadata collection to insert metadat item. 248 psS32 where ///< Location to be retrieved. 210 249 ); 211 250 … … 218 257 */ 219 258 psBool psMetadataSetIterator( 220 psMetadata* restrictmd, ///< Metadata collection to iterate.221 psS32 where ///< Location of iterator.259 psMetadata* md, ///< Metadata collection to iterate. 260 psS32 where ///< Location of iterator. 222 261 ); 223 262 … … 229 268 */ 230 269 psMetadataItem* psMetadataGetNext( 231 psMetadata* restrictmd, ///< Metadata collection to iterate.232 const char * restrictmatch, ///< Beginning of key name.233 psS32 which ///< Iterator to be used.270 psMetadata* md, ///< Metadata collection to iterate. 271 const char * match, ///< Beginning of key name. 272 psS32 which ///< Iterator to be used. 234 273 ); 235 274 … … 241 280 */ 242 281 psMetadataItem* psMetadataGetPrevious( 243 psMetadata * restrict md,///< Metadata collection to iterate.244 const char * restrict match,///< Beginning of key name.245 psS32 which ///< Iterator to be used.282 psMetadata *md, ///< Metadata collection to iterate. 283 const char *match, ///< Beginning of key name. 284 psS32 which ///< Iterator to be used. 246 285 ); 247 286
Note:
See TracChangeset
for help on using the changeset viewer.
