open_address_file_hash.h
Go to the documentation of this file.
1 /******************************************************************************/
35 /******************************************************************************/
36 
37 #if !defined(OPEN_ADDRESS_FILE_H_)
38 #define OPEN_ADDRESS_FILE_H_
39 
40 #if defined(__cplusplus)
41 extern "C" {
42 #endif
43 
44 #include <string.h>
45 #include <stdio.h>
46 
47 #include "../dictionary_types.h"
48 #include "./../dictionary.h"
50 
51 #include "../../key_value/kv_system.h"
52 
53 /*edefines file operations for arduino */
54 #include "../../file/sd_stdio_c_iface.h"
55 
56 #define ION_EMPTY -1
57 #define ION_DELETED -2
58 #define ION_IN_USE -3
59 #define SIZEOF(STATUS) 1
60 
65 
69 struct file_hashmap {
71  int map_size;
75  int (*compute_hash)(
77  ion_key_t,
78  int
79  );
80 
83  FILE *file;
84 };
85 
96 oafh_open(
98  ion_file_hashmap_t *hash_map
99 );
100 
108 ion_err_t
109 oafh_close(
110  ion_file_hashmap_t *hash_map
111 );
112 
133 ion_err_t
136  ion_hash_t (*hashing_function)(ion_file_hashmap_t *, ion_key_t, int),
137  ion_key_type_t key_type,
138  ion_key_size_t key_size,
139  ion_value_size_t value_size,
140  int size,
142 );
143 
153 ion_err_t
155  ion_file_hashmap_t *hash_map
156 );
157 
179  ion_file_hashmap_t *hash_map,
180  ion_key_t key,
181  ion_value_t value
182 );
183 
200  ion_file_hashmap_t *hash_map,
201  ion_key_t key,
202  ion_value_t value
203 );
204 
217 int
219  ion_hash_t num,
220  int size
221 );
222 
236 ion_err_t
238  ion_file_hashmap_t *hash_map,
239  ion_key_t key,
240  int *location
241 );
242 
256  ion_file_hashmap_t *hash_map,
257  ion_key_t key
258 );
259 
276 oafh_get(
277  ion_file_hashmap_t *hash_map,
278  ion_key_t key,
279  ion_value_t value
280 );
281 
295  ion_file_hashmap_t *hashmap,
296  ion_key_t key,
297  int size_of_key
298 );
299 
300 /*void
301 static_hash_init(ion_dictonary_handler_t * client);*/
302 
303 #if defined(__cplusplus)
304 }
305 #endif
306 
307 #endif
int ion_hash_t
The position in the hashmap.
enum ION_KEY_TYPE ion_key_type_t
This is the available key types for ION_DB. All types will be based on system defines.
Struct used to maintain an instance of an in memory hashmap.
int ion_value_size_t
The size (length) of a dictionary value in bytes.
Definition: kv_system.h:256
ion_dictionary_parent_t super
ion_err_t oafh_find_item_loc(ion_file_hashmap_t *hash_map, ion_key_t key, int *location)
Locates item in map.
unsigned int ion_dictionary_id_t
A type used to identify dictionaries, specifically in the master table.
Struct containing details for opening a dictionary previously created.
#define key(k)
Definition: bpp_tree.c:75
ion_err_t oafh_close(ion_file_hashmap_t *hash_map)
This function closes a hashmap dictionary.
This is the super type for all dictionaries.
ion_err_t oafh_open(ion_dictionary_config_info_t config, ion_file_hashmap_t *hash_map)
This function opens a hashmap dictionary.
char ion_err_t
The error type used to store error codes.
Definition: kv_system.h:226
void * ion_key_t
A dictionary key.
Definition: kv_system.h:241
int(* compute_hash)(ion_file_hashmap_t *, ion_key_t, int)
void * ion_value_t
A dictionary value.
Definition: kv_system.h:246
ion_status_t oafh_delete(ion_file_hashmap_t *hash_map, ion_key_t key)
Deletes item from map.
ion_status_t oafh_insert(ion_file_hashmap_t *hash_map, ion_key_t key, ion_value_t value)
Insert record into hashmap.
This file includes common components for oadictionary and oahash.
ion_status_t oafh_get(ion_file_hashmap_t *hash_map, ion_key_t key, ion_value_t value)
Locates the record if it exists.
ion_err_t oafh_destroy(ion_file_hashmap_t *hash_map)
Destroys the map in memory.
ion_status_t oafh_update(ion_file_hashmap_t *hash_map, ion_key_t key, ion_value_t value)
Updates a value in the map.
ion_hash_t oafh_compute_simple_hash(ion_file_hashmap_t *hashmap, ion_key_t key, int size_of_key)
A simple hashing algorithm implementation.
ion_err_t oafh_initialize(ion_file_hashmap_t *hashmap, ion_hash_t(*hashing_function)(ion_file_hashmap_t *, ion_key_t, int), ion_key_type_t key_type, ion_key_size_t key_size, ion_value_size_t value_size, int size, ion_dictionary_id_t id)
This function initializes an open address in memory hash map.
char ion_write_concern_t
A type for write concern information used by hash table based dictionaries which limit insert/update ...
int ion_key_size_t
The size (length) of a dictionary key in bytes.
Definition: kv_system.h:251
Struct used to maintain an instance of an in memory hashmap.
ion_write_concern_t write_concern
A status object that describes the result of a dictionary operation.
Definition: kv_system.h:290
int oafh_get_location(ion_hash_t num, int size)
Returns the theoretical location of item in hashmap.