OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
phash.h
Go to the documentation of this file.
1 
14 #ifndef __PHASH_H__
15 #define __PHASH_H__
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #include <stdint.h>
22 
23 #ifndef PHASH_API_VERSION
24 
25 #define PHASH_API_VERSION 1002000
26 
27 #define PHASH_API_VERSION_STR "1.2.0"
28 #endif
29 
30 #define PHASH_NO_COPY_KEYS 1
31 
33 typedef struct phash phash;
34 
41 phash *phash_create(uint32_t options);
42 
49 int phash_destroy(phash *h);
50 
59 int phash_set(phash *h, const char *key, void *value);
60 
69 void *phash_get(phash *h, const char *key);
70 
78 int phash_remove(phash *h, const char *key);
79 
86 int phash_rewind(phash *h);
87 
103 int phash_next(phash *h, const char **key, void **value);
104 
109 int phash_size(phash *h);
110 
115 const char *phash_version();
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif // __PHASH_H__
int32 value
Definition: Granule.c:1235
int phash_destroy(phash *h)
Destroy a phash object, free'ing the memory used.
Definition: phash.c:136
float h[MODELMAX]
Definition: atrem_corl1.h:131
int phash_next(phash *h, const char **key, void **value)
Retrieves the next key-value pair in the phash. The order in which the pointers are returned shall be...
Definition: phash.c:275
const char * phash_version()
Returns the source code version and the implemented API version.
Definition: phash.c:316
phash * phash_create(uint32_t options)
Initialize a phash object.
Definition: phash.c:107
Implementation-specific, generic type to store the phash object.
Definition: phash.c:40
int phash_size(phash *h)
Retrieves the number of key-value pairs in the hash object.
Definition: phash.c:312
int phash_set(phash *h, const char *key, void *value)
Add or overwrite a pointer, associating it with the given key.
Definition: phash.c:224
int phash_remove(phash *h, const char *key)
Remove a pointer associated with the given string.
Definition: phash.c:146
void * phash_get(phash *h, const char *key)
Find a pointer associated with the given string.
Definition: phash.c:205
int phash_rewind(phash *h)
Rewind iterator for traversing all the keys and values.
Definition: phash.c:269