2 * Copyright 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_GENERIC_CONTAINER_CONTAINER_HASH_TABLE_H_
8 #define NATIVE_CLIENT_SRC_TRUSTED_GENERIC_CONTAINER_CONTAINER_HASH_TABLE_H_
10 #include "native_client/src/include/nacl_base.h"
11 #include "native_client/src/include/portability.h"
13 #include "native_client/src/trusted/generic_container/container.h"
17 struct NaClContainerHashTblEntry {
22 #define NACL_CHTE_USED (1<<0)
23 /* slot occupied, so keep probing */
25 #define NACL_CHTE_DELETED (1<<1)
26 /* slot occupied but deleted, keep probing */
28 struct NaClContainerHashTbl {
29 struct NaClContainer base;
30 struct NaClHashFunctor *hash_functor;
33 struct NaClContainerHashTblEntry *bucket;
36 int NaClContainerHashTblCtor(struct NaClContainerHashTbl *self,
37 struct NaClHashFunctor *hash_functor,
40 int NaClContainerHashTblInsert(struct NaClContainer *vself,
43 struct NaClContainerIter *NaClContainerHashTblFind(
44 struct NaClContainer *vself,
46 struct NaClContainerIter *out);
48 void NaClContainerHashTblDtor(struct NaClContainer *vself);
50 struct NaClContainerHashTblIter {
51 struct NaClContainerIter base;
52 struct NaClContainerHashTbl *htbl;
56 int NaClContainerHashTblIterCtor(struct NaClContainer *vself,
57 struct NaClContainerIter *viter);
61 #endif /* NATIVE_CLIENT_SRC_TRUSTED_GENERIC_CONTAINER_CONTAINER_HASH_TABLE_H_ */