25 #ifndef HTSLIB_KHASH_STR2INT_H
26 #define HTSLIB_KHASH_STR2INT_H
36 static inline
void *khash_str2int_init(
void)
44 static inline void khash_str2int_destroy(
void *_hash)
53 static inline void khash_str2int_destroy_free(
void *_hash)
57 if (hash == 0)
return;
58 for (k = 0; k <
kh_end(hash); ++k)
66 static inline int khash_str2int_has_key(
void *_hash,
const char *
str)
70 if ( k ==
kh_end(hash) )
return 0;
78 static inline int khash_str2int_get(
void *_hash,
const char *str,
int *value)
82 if ( !hash )
return -1;
83 k =
kh_get(str2int, hash, str);
84 if ( k ==
kh_end(hash) )
return -1;
85 if ( !value )
return 0;
96 static inline int khash_str2int_inc(
void *_hash,
const char *str)
101 if ( !hash )
return -1;
102 k =
kh_put(str2int, hash, str, &ret);
103 if (ret == 0)
return kh_val(hash, k);
113 static inline int khash_str2int_set(
void *_hash,
const char *str,
int value)
118 if ( !hash )
return -1;
119 k =
kh_put(str2int, hash, str, &ret);
127 static inline int khash_str2int_size(
void *_hash)
#define kh_val(h, x)
Definition: khash.h:506
#define kh_exist(h, x)
Definition: khash.h:489
khint32_t khint_t
Definition: khash.h:152
#define kh_end(h)
Definition: khash.h:525
#define kh_put(name, h, k, r)
Definition: khash.h:464
#define KHASH_MAP_INIT_STR(name, khval_t)
Definition: khash.h:614
#define kh_init(name)
Definition: khash.h:429
#define kh_size(h)
Definition: khash.h:532
#define kh_destroy(name, h)
Definition: khash.h:436
#define str(x)
Definition: sam.c:66
#define khash_t(name)
Definition: khash.h:422
#define kh_key(h, x)
Definition: khash.h:497
#define kh_get(name, h, k)
Definition: khash.h:473