BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJLIB Reference

hash.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __PJ_HASH_H__
20#define __PJ_HASH_H__
21
27#include <pj/types.h>
28
30
45#define PJ_HASH_KEY_STRING ((unsigned)-1)
46
50#define PJ_HASH_ENTRY_BUF_SIZE (3*sizeof(void*) + 2*sizeof(pj_uint32_t))
51
55typedef void *pj_hash_entry_buf[(PJ_HASH_ENTRY_BUF_SIZE+sizeof(void*)-1)/(sizeof(void*))];
56
69 const void *key, unsigned keylen);
70
71
84 char *result,
85 const pj_str_t *key);
86
95PJ_DECL(pj_hash_table_t*) pj_hash_create(pj_pool_t *pool, unsigned size);
96
97
112PJ_DECL(void *) pj_hash_get( pj_hash_table_t *ht,
113 const void *key, unsigned keylen,
114 pj_uint32_t *hval );
115
116
124 const void *key, unsigned keylen,
125 pj_uint32_t *hval );
126
127
149PJ_DECL(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht,
150 const void *key, unsigned keylen, pj_uint32_t hval,
151 void *value );
152
153
161 const void *key, unsigned keylen,
162 pj_uint32_t hval, void *value );
163
164
184 const void *key, unsigned keylen,
185 pj_uint32_t hval, pj_hash_entry_buf entry_buf,
186 void *value);
187
195 const void *key, unsigned keylen,
196 pj_uint32_t hval,
197 pj_hash_entry_buf entry_buf,
198 void *value);
199
207PJ_DECL(unsigned) pj_hash_count( pj_hash_table_t *ht );
208
209
219 pj_hash_iterator_t *it );
220
221
231 pj_hash_iterator_t *it );
232
241PJ_DECL(void*) pj_hash_this( pj_hash_table_t *ht,
242 pj_hash_iterator_t *it );
243
244
250
251#endif
252
253
struct pj_hash_table_t pj_hash_table_t
Definition: types.h:167
unsigned int pj_uint32_t
Definition: types.h:43
pj_hash_table_t * pj_hash_create(pj_pool_t *pool, unsigned size)
void pj_hash_set_np_lower(pj_hash_table_t *ht, const void *key, unsigned keylen, pj_uint32_t hval, pj_hash_entry_buf entry_buf, void *value)
pj_hash_iterator_t * pj_hash_next(pj_hash_table_t *ht, pj_hash_iterator_t *it)
void pj_hash_set(pj_pool_t *pool, pj_hash_table_t *ht, const void *key, unsigned keylen, pj_uint32_t hval, void *value)
void * pj_hash_get(pj_hash_table_t *ht, const void *key, unsigned keylen, pj_uint32_t *hval)
#define PJ_HASH_ENTRY_BUF_SIZE
Definition: hash.h:50
void * pj_hash_entry_buf[((3 *sizeof(void *)+2 *sizeof(pj_uint32_t))+sizeof(void *) -1)/(sizeof(void *))]
Definition: hash.h:55
pj_hash_iterator_t * pj_hash_first(pj_hash_table_t *ht, pj_hash_iterator_t *it)
void pj_hash_set_np(pj_hash_table_t *ht, const void *key, unsigned keylen, pj_uint32_t hval, pj_hash_entry_buf entry_buf, void *value)
pj_uint32_t pj_hash_calc_tolower(pj_uint32_t hval, char *result, const pj_str_t *key)
void pj_hash_set_lower(pj_pool_t *pool, pj_hash_table_t *ht, const void *key, unsigned keylen, pj_uint32_t hval, void *value)
pj_uint32_t pj_hash_calc(pj_uint32_t hval, const void *key, unsigned keylen)
unsigned pj_hash_count(pj_hash_table_t *ht)
void * pj_hash_this(pj_hash_table_t *ht, pj_hash_iterator_t *it)
void * pj_hash_get_lower(pj_hash_table_t *ht, const void *key, unsigned keylen, pj_uint32_t *hval)
#define PJ_BEGIN_DECL
Definition: config.h:1284
#define PJ_END_DECL
Definition: config.h:1285
Definition: types.h:180
Definition: pool.h:310
Definition: types.h:120
Declaration of basic types and utility.

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.