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

Metadata Functions
[Astronomy Functions]

Collaboration diagram for Metadata Functions:


Files

file  psMetadata.h
 Contains metadata struuctures, enumerations and functions prototypes.
file  psMetadataIO.h
 Contains metadata input/output functions.

Data Structures

struct  psMetadata
 Metadata data structure. More...
struct  psMetadataIterator
 Metadata iterator. More...
struct  psMetadataItem
 Metadata item data structure. More...
struct  p_psParseLevelInfo

Defines

#define PS_META_IS_PRIMITIVE(TYPE)
#define PS_META_PRIMITIVE_TYPE(METATYPE)
#define PS_METADATA_FLAGS_MASK   0xFF000000
#define PS_METADATA_TYPE_MASK   0x00FFFFFF

Typedefs

typedef psMetadata psMetadata
 Metadata data structure.
typedef psMetadataItem psMetadataItem
 Metadata item data structure.

Enumerations

enum  psMetadataType {
  PS_META_S32 = PS_TYPE_S32, PS_META_F32 = PS_TYPE_F32, PS_META_F64 = PS_TYPE_F64, PS_META_BOOL = PS_TYPE_BOOL, PS_META_LIST = 0x10000, PS_META_STR, PS_META_VEC, PS_META_IMG, PS_META_HASH, PS_META_LOOKUPTABLE,
  PS_META_JPEG, PS_META_PNG, PS_META_ASTROM, PS_META_UNKNOWN, PS_META_MULTI, PS_META_META
}
 Metadata item type. More...
enum  psMetadataFlags { PS_META_DEFAULT = 0, PS_META_REPLACE = 0x1000000, PS_META_DUPLICATE_OK = 0x2000000 }
 Option flags for psMetadata functions. More...

Functions

psMetadataItempsMetadataItemAlloc (const char *name, psMetadataType type, const char *comment,...)
 Create a metadata item.
psMetadataItempsMetadataItemAllocStr (const char *name, const char *comment, const char *value)
 Create a metadata item with specified string data.
psMetadataItempsMetadataItemAllocF32 (const char *name, const char *comment, psF32 value)
 Create a metadata item with specified psF32 data.
psMetadataItempsMetadataItemAllocF64 (const char *name, const char *comment, psF64 value)
 Create a metadata item with specified psF64 data.
psMetadataItempsMetadataItemAllocS32 (const char *name, const char *comment, psS32 value)
 Create a metadata item with specified psS32 data.
psMetadataItempsMetadataItemAllocBool (const char *name, const char *comment, psBool value)
 Create a metadata item with specified psBool data.
psMetadataItempsMetadataItemAllocV (const char *name, psMetadataType type, const char *comment, va_list list)
 Create a metadata item with va_list.
psMetadatapsMetadataAlloc (void)
 Create a metadata collection.
psBool psMetadataAddItem (psMetadata *md, psMetadataItem *item, psS32 location, psS32 flags)
 Add existing metadata item to metadata collection.
psBool psMetadataAdd (psMetadata *md, psS32 location, const char *name, int type, const char *comment,...)
 Create and add a metadata item to metadata collection.
psBool psMetadataAddV (psMetadata *md, psS32 location, const char *name, int type, const char *comment, va_list list)
 Create and add a metadata item to metadata collection.
psBool psMetadataAddS32 (psMetadata *md, psS32 location, const char *name, const char *comment, psS32 value)
psBool psMetadataAddF32 (psMetadata *md, psS32 location, const char *name, const char *comment, psF32 value)
psBool psMetadataAddF64 (psMetadata *md, psS32 location, const char *name, const char *comment, psF64 value)
psBool psMetadataAddList (psMetadata *md, psS32 location, const char *name, const char *comment, psList *value)
psBool psMetadataAddStr (psMetadata *md, psS32 location, const char *name, const char *comment, const char *value)
psBool psMetadataAddVector (psMetadata *md, psS32 location, const char *name, const char *comment, psVector *value)
psBool psMetadataAddImage (psMetadata *md, psS32 location, const char *name, const char *comment, psImage *value)
psBool psMetadataAddHash (psMetadata *md, psS32 location, const char *name, const char *comment, psHash *value)
psBool psMetadataAddLookupTable (psMetadata *md, psS32 location, const char *name, const char *comment, psLookupTable *value)
psBool psMetadataAddUnknown (psMetadata *md, psS32 location, const char *name, const char *comment, psPtr value)
psBool psMetadataAddMetadata (psMetadata *md, psS32 location, const char *name, const char *comment, psMetadata *value)
psBool psMetadataRemove (psMetadata *md, psS32 where, const char *key)
 Remove an item from metadata collection.
psMetadataItempsMetadataLookup (psMetadata *md, const char *key)
 Find an item in the metadata collection based on key name.
psF64 psMetadataLookupF64 (psBool *status, psMetadata *md, const char *key)
 Find an item in the metadata collection based on key name and return its double precision value.
psF32 psMetadataLookupF32 (psBool *status, psMetadata *md, const char *key)
 Find an item in the metadata collection based on key name and return its single precision value.
psS32 psMetadataLookupS32 (psBool *status, psMetadata *md, const char *key)
 Find an item in the metadata collection based on key name and return its integer value.
psBool psMetadataLookupBool (psBool *status, psMetadata *md, const char *key)
 Find an item in the metadata collection based on key name and return its boolean value.
psPtr psMetadataLookupPtr (psBool *status, psMetadata *md, const char *key)
 Find an item in the metadata collection based on key name and return its integer value.
psMetadataItempsMetadataGet (psMetadata *md, psS32 location)
 Find an item in the metadata collection based on list index.
psMetadataIteratorpsMetadataIteratorAlloc (psMetadata *md, int location, const char *regex)
 Creates a psMetadataIterator to iterate over the specified psMetadata.
psBool psMetadataIteratorSet (psMetadataIterator *iterator, int location)
 Set the iterator of the psMetadat to a given position.
psMetadataItempsMetadataGetAndIncrement (psMetadataIterator *iterator)
 Position the specified iterator to the next matching item in psMetadata, given the regular expression of the iterator.
psMetadataItempsMetadataGetAndDecrement (psMetadataIterator *iterator)
 Position the specified iterator to the previous matching item in psMetadata, given the regular expression of the iterator.
p_psParseLevelInfop_psParseLevelInfoAlloc (void)
bool psMetadataItemPrint (FILE *fd, const char *format, const psMetadataItem *metadataItem)
 Print metadata item to file.
psMetadatapsMetadataReadHeader (psMetadata *output, char *extName, psS32 extNum, char *fileName)
 Read metadata header.
psMetadatapsMetadataConfigParse (psMetadata *md, psU32 *nFail, const char *fileName, psBool overwrite)
 Read metadata configuration file.
psMetadatapsMetadataConfigParseXml (psMetadata *md, psU32 *nFail, const char *fileName, psBool overwrite)
 Read XML metadata configuration file.


Define Documentation

#define PS_META_IS_PRIMITIVE TYPE   ) 
 

Value:

(TYPE == PS_META_S32 || \
 TYPE == PS_META_F32 || \
 TYPE == PS_META_F64 || \
 TYPE == PS_META_BOOL)

Definition at line 57 of file psMetadata.h.

#define PS_META_PRIMITIVE_TYPE METATYPE   ) 
 

Value:

( \
        (METATYPE==PS_META_S32) ? PS_TYPE_S32 : \
        (METATYPE==PS_META_F32) ? PS_TYPE_F32 : \
        (METATYPE==PS_META_F64) ? PS_TYPE_F64 : \
        (METATYPE==PS_META_BOOL) ? PS_TYPE_BOOL : 0 )

Definition at line 63 of file psMetadata.h.

#define PS_METADATA_FLAGS_MASK   0xFF000000
 

Definition at line 81 of file psMetadata.h.

#define PS_METADATA_TYPE_MASK   0x00FFFFFF
 

Definition at line 82 of file psMetadata.h.


Typedef Documentation

typedef struct psMetadata psMetadata
 

Metadata data structure.

Struct for holding metadata items. Metadata items are held in two containers. The first employs a doubly-linked list to preserve the order of the metadata. The second container employs a hash table which allows fast lookup when given a metadata keyword.

typedef struct psMetadataItem psMetadataItem
 

Metadata item data structure.

Struct for maintaining metadata items of varying types. It also contains information about the item name, flags, comments, and other items with the same name.


Enumeration Type Documentation

enum psMetadataFlags
 

Option flags for psMetadata functions.

Enumeration for the modification of the behaviour in psMetadataAddItem.

See also:
psMetadataAddItem
Enumeration values:
PS_META_DEFAULT  default behaviour (duplicate entry is an error)
PS_META_REPLACE  allow entry to be replaced
PS_META_DUPLICATE_OK  allow duplicate entries

Definition at line 75 of file psMetadata.h.

enum psMetadataType
 

Metadata item type.

Enumeration for maintaining metadata item types.

Enumeration values:
PS_META_S32  psS32 primitive data.
PS_META_F32  psF32 primitive data.
PS_META_F64  psF64 primitive data.
PS_META_BOOL  psBool primitive data.
PS_META_LIST  List data (Stored as item.data.list).
PS_META_STR  String data (Stored as item.data.V).
PS_META_VEC  Vector data (Stored as item.data.V).
PS_META_IMG  Image data (Stored as item.data.V).
PS_META_HASH  Hash data (Stored as item.data.V).
PS_META_LOOKUPTABLE  Lookup table data (Stored as item.data.V).
PS_META_JPEG  JPEG data (Stored as item.data.V).
PS_META_PNG  PNG data (Stored as item.data.V).
PS_META_ASTROM  Astrometric coefficients (Stored as item.data.V).
PS_META_UNKNOWN  Other data (Stored as item.data.V).
PS_META_MULTI  Used internally, do not create an metadata item of this type.
PS_META_META  Metadata data (Stored as item.data.md).

Definition at line 38 of file psMetadata.h.


Function Documentation

p_psParseLevelInfo* p_psParseLevelInfoAlloc void   ) 
 

psBool psMetadataAdd psMetadata md,
psS32  location,
const char *  name,
int  type,
const char *  comment,
  ...
 

Create and add a metadata item to metadata collection.

Creates a new metadata item add to the metadata collection.

Returns:
bool: True for success, false for failure.
Parameters:
md  Metadata collection to insert metadata item.
location  Index number, PS_LIST_HEAD, or PS_LIST_TAIL
name  Name of metadata item.
type  Type of metadata item (psMetadataType) and options (psMetadataFlags)
comment  Comment for metadata item.

psBool psMetadataAddF32 psMetadata md,
psS32  location,
const char *  name,
const char *  comment,
psF32  value
 

psBool psMetadataAddF64 psMetadata md,
psS32  location,
const char *  name,
const char *  comment,
psF64  value
 

psBool psMetadataAddHash psMetadata md,
psS32  location,
const char *  name,
const char *  comment,
psHash value
 

psBool psMetadataAddImage psMetadata md,
psS32  location,
const char *  name,
const char *  comment,
psImage value
 

psBool psMetadataAddItem psMetadata md,
psMetadataItem item,
psS32  location,
psS32  flags
 

Add existing metadata item to metadata collection.

Add a metadata item that has already been created to the metadata collection.

Returns:
bool: True for success, false for failure.
Parameters:
md  Metadata collection to insert metadat item.
item  Metadata item to be added.
location  Index number, PS_LIST_HEAD, or PS_LIST_TAIL
flags  Options flag mask, see psMetadataFlags enum

psBool psMetadataAddList psMetadata md,
psS32  location,
const char *  name,
const char *  comment,
psList value
 

psBool psMetadataAddLookupTable psMetadata md,
psS32  location,
const char *  name,
const char *  comment,
psLookupTable value
 

psBool psMetadataAddMetadata psMetadata md,
psS32  location,
const char *  name,
const char *  comment,
psMetadata value
 

psBool psMetadataAddS32 psMetadata md,
psS32  location,
const char *  name,
const char *  comment,
psS32  value
 

psBool psMetadataAddStr psMetadata md,
psS32  location,
const char *  name,
const char *  comment,
const char *  value
 

psBool psMetadataAddUnknown psMetadata md,
psS32  location,
const char *  name,
const char *  comment,
psPtr  value
 

psBool psMetadataAddV psMetadata md,
psS32  location,
const char *  name,
int  type,
const char *  comment,
va_list  list
 

Create and add a metadata item to metadata collection.

Creates a new metadata item add to the metadata collection.

Returns:
bool: True for success, false for failure.
Parameters:
md  Metadata collection to insert metadat item.
location  Index number, PS_LIST_HEAD, or PS_LIST_TAIL
name  Name of metadata item.
type  Type of metadata item (psMetadataType) and options (psMetadataFlags)
comment  Comment for metadata item.
list  Arguments for name formatting and metadata item data.

psBool psMetadataAddVector psMetadata md,
psS32  location,
const char *  name,
const char *  comment,
psVector value
 

psMetadata* psMetadataAlloc void   ) 
 

Create a metadata collection.

Returns an empty metadata container with fully allocated internal metadata containers.

Returns:
psMetadata* : Pointer metadata.

psMetadata* psMetadataConfigParse psMetadata md,
psU32 nFail,
const char *  fileName,
psBool  overwrite
 

Read metadata configuration file.

Loads pre-defined settings by parsing a configuration file into a psMetadata structure.

Returns:
psMetadata* : Resulting metadata from read.
Parameters:
md  Resulting metadata from read.
nFail  Number of failed lines.
fileName  Name of file to read.
overwrite  Allow overwrite of duplicate specifications.

psMetadata* psMetadataConfigParseXml psMetadata md,
psU32 nFail,
const char *  fileName,
psBool  overwrite
 

Read XML metadata configuration file.

Loads pre-defined XML settings by parsing a configuration file into a psMetadata structure.

Returns:
psMetadata* : Resulting metadata from read.
Parameters:
md  Resulting metadata from read.
nFail  Number of failed lines.
fileName  Name of file to read.
overwrite  Allow overwrite of duplicate specifications.

psMetadataItem* psMetadataGet psMetadata md,
psS32  location
 

Find an item in the metadata collection based on list index.

Items may be found in the metadata by their entry position in the list container.

Returns:
psMetadataItem* : Pointer metadata item.
Parameters:
md  Metadata collection to retrieve metadata item.
location  Index number, PS_LIST_HEAD, or PS_LIST_TAIL

psMetadataItem* psMetadataGetAndDecrement psMetadataIterator iterator  ) 
 

Position the specified iterator to the previous matching item in psMetadata, given the regular expression of the iterator.

Returns:
psPtr the psMetadataItem at the original iterator position or NULL if the iterator went past the beginning of the list.
Parameters:
iterator  iterator to move

psMetadataItem* psMetadataGetAndIncrement psMetadataIterator iterator  ) 
 

Position the specified iterator to the next matching item in psMetadata, given the regular expression of the iterator.

Returns:
psPtr the psMetadataItem at the original iterator position or NULL if the iterator went past the end of the list.
Parameters:
iterator  iterator to move

psMetadataItem* psMetadataItemAlloc const char *  name,
psMetadataType  type,
const char *  comment,
  ...
 

Create a metadata item.

Returns a fill psMetadataItem ready for insertion into the psMetadata struct. The name argument specifies the name to use for this item, and may include sprintf formatting codes. The format entry specifies both the metadata type and optional flags and is created by bit-wise or of the appropriate type and flag. The comment argument is a fixed string used to comment the metadata item. The arguments to the name formatting codes and the metadata itself are passed as arguments following the comment string. The data must be a pointer for any of the elements stored in data.void. The argument list must be interpreted appropriately by the va_list operators in the function specified size and type.

Returns:
psMetadataItem* : Pointer metadata item.
Parameters:
name  Name of metadata item.
type  Type of metadata item.
comment  Comment for metadata item.

psMetadataItem* psMetadataItemAllocBool const char *  name,
const char *  comment,
psBool  value
 

Create a metadata item with specified psBool data.

Returns a fill psMetadataItem ready for insertion into the psMetadata struct.

Returns:
psMetadataItem* : Pointer metadata item.
Parameters:
name  Name of metadata item.
comment  Comment for metadata item.
value  the value of the metadata item.

psMetadataItem* psMetadataItemAllocF32 const char *  name,
const char *  comment,
psF32  value
 

Create a metadata item with specified psF32 data.

Returns a fill psMetadataItem ready for insertion into the psMetadata struct.

Returns:
psMetadataItem* : Pointer metadata item.
Parameters:
name  Name of metadata item.
comment  Comment for metadata item.
value  the value of the metadata item.

psMetadataItem* psMetadataItemAllocF64 const char *  name,
const char *  comment,
psF64  value
 

Create a metadata item with specified psF64 data.

Returns a fill psMetadataItem ready for insertion into the psMetadata struct.

Returns:
psMetadataItem* : Pointer metadata item.
Parameters:
name  Name of metadata item.
comment  Comment for metadata item.
value  the value of the metadata item.

psMetadataItem* psMetadataItemAllocS32 const char *  name,
const char *  comment,
psS32  value
 

Create a metadata item with specified psS32 data.

Returns a fill psMetadataItem ready for insertion into the psMetadata struct.

Returns:
psMetadataItem* : Pointer metadata item.
Parameters:
name  Name of metadata item.
comment  Comment for metadata item.
value  the value of the metadata item.

psMetadataItem* psMetadataItemAllocStr const char *  name,
const char *  comment,
const char *  value
 

Create a metadata item with specified string data.

Returns a fill psMetadataItem ready for insertion into the psMetadata struct.

Returns:
psMetadataItem* : Pointer metadata item.
Parameters:
name  Name of metadata item.
comment  Comment for metadata item.
value  the value of the metadata item.

psMetadataItem* psMetadataItemAllocV const char *  name,
psMetadataType  type,
const char *  comment,
va_list  list
 

Create a metadata item with va_list.

Returns a fill psMetadataItem ready for insertion into the psMetadata struct. The name argument specifies the name to use for this item, and may include sprintf formatting codes. The format entry specifies both the metadata type and optional flags and is created by bit-wise or of the appropriate type and flag. The comment argument is a fixed string used to comment the metadata item. The arguments to the name formatting codes and the metadata itself are passed as arguments following the comment string. The data must be a pointer for any of the elements stored in data.void. The argument list must be interpreted appropriately by the va_list operators in the function specified size and type.

Returns:
psMetadataItem* : Pointer metadata item.
Parameters:
name  Name of metadata item.
type  Type of metadata item.
comment  Comment for metadata item.
list  Arguments for name formatting and metadata item data.

bool psMetadataItemPrint FILE *  fd,
const char *  format,
const psMetadataItem metadataItem
 

Print metadata item to file.

Metadata items may be printed to an open file descriptor based on a provided format. The format is a sprintf format statement with exactly one formatting command. If the metadata item type is a numeric type, this formatting command must also be numeric, and the type conversion performed to the value to match the format type. If the metadata type is a string, the fromatting command must also be for a string. If the metadata type is any other data type, printing is not allowed.

Returns:
psMetadataItem* : Pointer metadata item.
Parameters:
fd  Pointer to file to write metadata item.
format  Format to print metadata item.
metadataItem  Metadata item to print.

psMetadataIterator* psMetadataIteratorAlloc psMetadata md,
int  location,
const char *  regex
 

Creates a psMetadataIterator to iterate over the specified psMetadata.

Supports the subsetting of the metadata via keyword using regular expression. If no regular expression is specified, iteration over the entire psMetadata is performed.

Returns:
psMetadataIterator* a new psMetadataIterator, of NULL if error occurred
Parameters:
md  the psMetadata to iterate with
location  Index number, PS_LIST_HEAD, or PS_LIST_TAIL
regex  A regular expression for subsetting the psMetadata. If NULL, no subsetting is performed.

psBool psMetadataIteratorSet psMetadataIterator iterator,
int  location
 

Set the iterator of the psMetadat to a given position.

If location is invalid the iterator position is not changed.

Returns:
psBool TRUE if iterator successfully set, otherwise FALSE.
Parameters:
iterator  psMetadata iterator
location  index number, PS_LIST_HEAD, or PS_LIST_TAIL

psMetadataItem* psMetadataLookup psMetadata md,
const char *  key
 

Find an item in the metadata collection based on key name.

Items may be found in the metadata by providing a key. If the key is non-unique, the first item is returned. If the item is not found, null is returned.

Returns:
psMetadataItem* : Pointer metadata item.
Parameters:
md  Metadata collection to lookup metadata item.
key  Name of metadata key.

psBool psMetadataLookupBool psBool status,
psMetadata md,
const char *  key
 

Find an item in the metadata collection based on key name and return its boolean value.

Items may be found in the metadata by providing a key. If the key is non-unique, the value of the first item is returned. If the item is not found, zero is returned.

Returns:
psBool : Value of metadata item.
Parameters:
status  Status of lookup.
md  Metadata collection to lookup metadata item.
key  Name of metadata key.

psF32 psMetadataLookupF32 psBool status,
psMetadata md,
const char *  key
 

Find an item in the metadata collection based on key name and return its single precision value.

Items may be found in the metadata by providing a key. If the key is non-unique, the value of the first item is returned. If the item is not found, zero is returned.

Returns:
psF32 : Value of metadata item.
Parameters:
status  Status of lookup.
md  Metadata collection to lookup metadata item.
key  Name of metadata key.

psF64 psMetadataLookupF64 psBool status,
psMetadata md,
const char *  key
 

Find an item in the metadata collection based on key name and return its double precision value.

Items may be found in the metadata by providing a key. If the key is non-unique, the value of the first item is returned. If the item is not found, zero is returned.

Returns:
psF64 : Value of metadata item.
Parameters:
status  Status of lookup.
md  Metadata collection to lookup metadata item.
key  Name of metadata key.

psPtr psMetadataLookupPtr psBool status,
psMetadata md,
const char *  key
 

Find an item in the metadata collection based on key name and return its integer value.

Items may be found in the metadata by providing a key. If the key is non-unique, the value of the first item is returned. If the item is not found, zero is returned.

Returns:
void* : Value of metadata item.
Parameters:
status  Status of lookup.
md  Metadata collection to lookup metadata item.
key  Name of metadata key.

psS32 psMetadataLookupS32 psBool status,
psMetadata md,
const char *  key
 

Find an item in the metadata collection based on key name and return its integer value.

Items may be found in the metadata by providing a key. If the key is non-unique, the value of the first item is returned. If the item is not found, zero is returned.

Returns:
psS32 : Value of metadata item.
Parameters:
status  Status of lookup.
md  Metadata collection to lookup metadata item.
key  Name of metadata key.

psMetadata* psMetadataReadHeader psMetadata output,
char *  extName,
psS32  extNum,
char *  fileName
 

Read metadata header.

Read a metadata header from file. If the file is not found, an error is reported.

Returns:
psMetadata* : Pointer to resulting metadata.
Parameters:
output  Resulting metadata from read.
extName  File name extension string.
extNum  File name extension number. Starts at 1.
fileName  Name of file to read.

psBool psMetadataRemove psMetadata md,
psS32  where,
const char *  key
 

Remove an item from metadata collection.

Items may be removed from metadata by specifing a key or location. If the name is null, the where argument is used instead. If name is not null, where is set to PS_LIST_UNKNOWN. If the item is found, it is removed from the metadata and true is returned. If the key is not unique, then all items corresponding to it are removed.

Returns:
bool: True for success, false for failure.
Parameters:
md  Metadata collection to remove metadata item.
where  Index number, PS_LIST_HEAD, or PS_LIST_TAIL
key  Name of metadata key.


Generated on Wed Jun 15 11:01:15 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.1