Changeset 1588 for trunk/archive/pslib/include/psMetadata.h
- Timestamp:
- Aug 18, 2004, 5:58:03 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/include/psMetadata.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/include/psMetadata.h
r753 r1588 22 22 } psMetadataType; 23 23 24 /** Metadata flags (not exclusive with psMetadataType). */25 typedef enum {26 PS_META_TYPE_MASK = 0xffff, ///< the type enum must fit in this mask27 PS_META_UNIQUE = 0x10000, ///< the name must be unique (default)28 PS_META_NON_UNIQUE = 0x20000, ///< the name may be repeated, and should be disambiguated for us29 } psMetadataFlags;30 31 24 /** A struct to define a single item of metadata */ 32 25 typedef struct { 33 26 const int id; ///< unique ID for this item 34 c har *restrict name;///< Name of item27 const char *name; ///< Name of item 35 28 psMetadataType type; ///< type of this item 36 psMetadataFlags flags; ///< flags associated with this item 37 union { 29 const union { 38 30 psS32 S32; ///< integer value 39 31 psF32 F32; ///< floating value 40 32 psF64 F64; ///< double value 41 void * V; ///< other type33 void *void; ///< other type 42 34 } data; ///< value of metadata 43 35 char *comment; ///< optional comment ("", not NULL) 44 psDlist * restrict items;///< list of psMetadataItems with the same name36 psDlist *items; ///< list of psMetadataItems with the same name 45 37 } psMetadataItem; 46 38 47 39 /** A set of metadata */ 48 40 typedef struct { 49 psDlist * restrict list;///< list of psMetadataItem50 psHash * restrict table;///< hash table of the same metadata41 psDlist *list; ///< list of psMetadataItem 42 psHash *table; ///< hash table of the same metadata 51 43 } psMetadata; 52 44 … … 58 50 /** Constructor */ 59 51 psMetadataItem *psMetadataItemAlloc(const char *name, ///< name of new item of metadata (sprintf format) 60 int format, ///< type of this piece of metadata + flags52 psMetadataType type, ///< type of this piece of metadata 61 53 const char *comment, ///< comment associated with item 62 54 ...) ///< arguments for name and data … … 64 56 65 57 psMetadataItem *psMetadataItemAllocV(const char *name, ///< name of new item of metadata (sprintf format) 66 int format, ///< type of this piece of metadata + flags58 psMetadataType type, ///< type of this piece of metadata 67 59 const char *comment, ///< comment associated with item 68 60 va_list ap) ///< arguments for name and data 69 ;70 71 /** Destructor */72 void psMetadataItemFree(psMetadataItem *ms) ///< piece of metadata to destroy73 61 ; 74 62 … … 77 65 ; 78 66 79 /** Destructor */80 void psMetadataFree(psMetadata *md) ///< destroy a set of metadata81 ;82 83 67 /**** Utilities **********************************************************************/ 84 68 85 69 /// Add item to the end of the metadata 86 psMetadataItem *psMetadataAppendItem(psMetadata *restrict md, ///< metadata to add to 87 psMetadataItem *restrict item) ///< Metatdata item to add 70 psMetadataItem *psMetadataAddItem(psMetadata *md, ///< metadata to add to 71 int where, ///< Where to add item 72 psMetadataItem *item) ///< Metatdata item to add 88 73 ; 89 74 90 75 /// Add item to the end of the metadata. Combines psMetadataItemAlloc and psMetadataAppendItem 91 psMetadataItem *psMetadataAppend(psMetadata *restrict md, ///< Metadata to add to 92 const char *name, ///< name of new item of metadata (sprintf format) 93 int format, ///< type of this piece of metadata + flags 94 const char *comment, ///< comment associated with item 95 ...) ///< possible arguments for name format 76 psMetadataItem *psMetadataAdd(psMetadata *md, ///< Metadata to add to 77 int where, ///< Where to add item 78 const char *name, ///< name of new item of metadata (sprintf format) 79 int format, ///< type of this piece of metadata + flags 80 const char *comment, ///< comment associated with item 81 ...) ///< possible arguments for name format 96 82 ; 97 83 98 84 /// delete item from the metadata 99 psMetadataItem *psMetadataRemove(psMetadata *restrict md, ///< metadata to delete from 100 const char *restrict key ///< Key to delete 85 bool *psMetadataRemove(psMetadata *md, ///< metadata to delete from 86 int where, ///< Where to remove 87 const char *key ///< Key to delete 88 ); 89 90 /// find the metadata with the specified key 91 psMetadataItem *psMetadataLookup(const psMetadata *md, ///< metadata to look up 92 const char *key ///< Key to find 93 ); 94 95 /// retrieve the metadata on the basis of entry position 96 psMetadataItem *psMetadataGet(const psMetadata *md, ///< metadata to look up 97 int which ///< entry position 101 98 ); 102 99 … … 106 103 107 104 /// get the next item in the sequence 108 psMetadataItem *psMetadataGetNext(psMetadata * restrictmd, ///< metadata to get from109 const char * restrict match, ///< Match this105 psMetadataItem *psMetadataGetNext(psMetadata *md, ///< metadata to get from 106 const char *match, ///< String to match 110 107 int which ///< Which iterator to use 111 108 ); 112 109 113 /// find the metadata with the specified key 114 psMetadataItem *psMetadataLookup(const psMetadata *restrict md, ///< metadata to look up 115 const char *restrict key ///< Key to find 110 /// get the next item in the sequence 111 psMetadataItem *psMetadataGetPrevious(psMetadata *md, ///< metadata to get from 112 const char *match, ///< String to match 113 int which ///< Which iterator to use 116 114 ); 117 115 118 116 /// print metadata item to the specified stream 119 void psMetadataItemPrint(FILE *fd, ///< file descriptor to write to120 const psMetadataItem *restrict md, ///< item of metadata to print121 const char *prefix ///< print this at the beginning of each line117 void psMetadataItemPrint(FILE *fd, ///< file descriptor to write to 118 const char *format, ///< Format of output 119 const psMetadataItem *md ///< item of metadata to print 122 120 ); 123 121
Note:
See TracChangeset
for help on using the changeset viewer.
