1/*---------------------------------------------------------------------------*
2 *  HashMapImpl.h  *
3 *                                                                           *
4 *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
5 *                                                                           *
6 *  Licensed under the Apache License, Version 2.0 (the 'License');          *
7 *  you may not use this file except in compliance with the License.         *
8 *                                                                           *
9 *  You may obtain a copy of the License at                                  *
10 *      http://www.apache.org/licenses/LICENSE-2.0                           *
11 *                                                                           *
12 *  Unless required by applicable law or agreed to in writing, software      *
13 *  distributed under the License is distributed on an 'AS IS' BASIS,        *
14 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15 *  See the License for the specific language governing permissions and      *
16 *  limitations under the License.                                           *
17 *                                                                           *
18 *---------------------------------------------------------------------------*/
19
20#ifndef __HASHMAPIMPL_H
21#define __HASHMAPIMPL_H
22
23
24
25#include <assert.h>
26#include <stdlib.h>
27#include "ESR_ReturnCode.h"
28#include "phashtable.h"
29
30/**
31 * HashMap implementation.
32 */
33typedef struct HashMapImpl_t
34{
35  /**
36   * Interface functions that must be implemented.
37   */
38  HashMap Interface;
39
40  /**
41   * Actual hash table implementation.
42   **/
43  PHashTable *table;
44}
45HashMapImpl;
46
47/**
48 * Default implementation.
49 */
50ESR_SHARED_API ESR_ReturnCode HashMap_Put(HashMap* self, const LCHAR* key, void* value);
51/**
52 * Default implementation.
53 */
54ESR_SHARED_API ESR_ReturnCode HashMap_Remove(HashMap* self, const LCHAR* key);
55/**
56 * Default implementation.
57 */
58ESR_SHARED_API ESR_ReturnCode HashMap_RemoveAndFree(HashMap* self, const LCHAR* key);
59/**
60 * Default implementation.
61 */
62ESR_SHARED_API ESR_ReturnCode HashMap_RemoveAtIndex(HashMap* self, const size_t index);
63/**
64 * Default implementation.
65 */
66ESR_SHARED_API ESR_ReturnCode HashMap_RemoveAll(HashMap* self);
67/**
68 * Default implementation.
69 */
70ESR_SHARED_API ESR_ReturnCode HashMap_RemoveAndFreeAll(HashMap* self);
71/**
72 * Default implementation.
73 */
74ESR_SHARED_API ESR_ReturnCode HashMap_ContainsKey(HashMap* self, const LCHAR* key, ESR_BOOL* exists);
75/**
76 * Default implementation.
77 */
78ESR_SHARED_API ESR_ReturnCode HashMap_Get(HashMap* self, const LCHAR* key, void** value);
79/**
80 * Default implementation.
81 */
82ESR_SHARED_API ESR_ReturnCode HashMap_GetKeyAtIndex(HashMap* self, const size_t index, LCHAR** key);
83/**
84 * Default implementation.
85 */
86ESR_SHARED_API ESR_ReturnCode HashMap_GetValueAtIndex(HashMap* self, const size_t index, void** value);
87/**
88 * Default implementation.
89 */
90ESR_SHARED_API ESR_ReturnCode HashMap_GetSize(HashMap* self, size_t* size);
91/**
92 * Default implementation.
93 */
94ESR_SHARED_API ESR_ReturnCode HashMap_Destroy(HashMap* self);
95
96#endif /* __HASHMAPIMPL_H */
97