le_hashmap.h

Go to the documentation of this file.
1 /**
2  * @page c_hashmap HashMap API
3  *
4  * @ref le_hashmap.h "API Reference"
5  *
6  * <HR>
7  *
8  * This API provides a straightforward HashMap implementation.
9  *
10  * @section c_hashmap_create Creating a HashMap
11  *
12  * Use @c le_hashmap_Create() to create a hashmap. It's the responsibility of
13  * the caller to maintain type integrity using this function's parameters.
14  * It's important to supply hash and equality functions that operate on the
15  * type of key that you intend to store. It's unwise to mix types in a single table because
16  * implementation of the table has no way to detect this behaviour.
17  *
18  * Choose the initial size should carefully as the index size remains fixed. The best
19  * choice for the initial size is a prime number slightly larger than the
20  * maximum expected capacity. If a too small size is chosen, there will be an
21  * increase in collisions that degrade performance over time.
22  *
23  * All hashmaps have names for diagnostic purposes.
24  *
25  * @section c_hashmap_insert Adding key-value pairs
26  *
27  * Key-value pairs are added using le_hashmap_Put(). For example:
28  *
29  * @code
30  * static void StoreStuff(const char* keyStr, const char* valueStr)
31  * {
32  * myTable = le_hashmap_Create(
33  * "My Table",
34  * 31,
35  * le_hashmap_HashString,
36  * le_hashmap_EqualsString
37  * );
38  *
39  * le_hashmap_Put(myTable, keyStr, valueStr);
40  * ....
41  * }
42  * @endcode
43  *
44  * The table does not take control of the keys or values. The map only stores the pointers
45  * to these values, not the values themselves. It's the responsibility of the caller to manage
46  * the actual data storage.
47  *
48  * @subsection c_hashmap_tips Tip
49  *
50  * The code sample shows some pre-defined functions for certain
51  * key types. The key types supported are uint32_t, uint64_t and strings. The strings must be
52  * NULL terminated.
53  *
54  * Tables can also have their own hash and equality functions,
55  * but ensure the functions work on the type of key you're
56  * storing. The hash function should provide a good distribution of values. It
57  * is not required that they be unique.
58  *
59  * @section c_hashmap_iterating Iterating over a map
60  *
61  * This API allows the user of the map to iterate over the entire
62  * map, acting on each key-value pair. You supply a callback function conforming
63  * to the prototype:
64  * @code
65  * bool (*callback)(void* key, void* value, void* context)
66  * @endcode
67  *
68  * This can then be used to process every value in the map. The return value from the
69  * callback function determines if iteration should continue or stop. If the function
70  * returns false then iteration will cease. For example:
71  *
72  * @code
73  * bool ProcessTableData
74  * (
75  * void* keyPtr, // Pointer to the map entry's key
76  * void* valuePtr, // Pointer to the map entry's value
77  * void* contextPtr // Pointer to an abritrary context for the callback function
78  * )
79  * {
80  * int keyCheck = *((int*)context);
81  * int currentKey = *((int*)key);
82  *
83  * if (keyCheck == currentKey) return false;
84  *
85  * // Do some stuff, maybe print out data or do a calculation
86  * return true;
87  * }
88  *
89  * {
90  * // ... somewhere else in the code ...
91  * int lastKey = 10;
92  * le_hashmap_ForEach (myTable, processTableData, &lastKey);
93  * }
94  * @endcode
95  *
96  * This code sample shows the callback function must also be aware of the
97  * types stored in the table.
98  *
99  * However, keep in mind that it is unsafe and undefined to modify the map during
100  * this style of iteration.
101  *
102  * Alternatively, the calling function can control the iteration by first
103  * calling @c le_hashmap_GetIterator(). This returns an iterator that is ready
104  * to return each key/value pair in the map in the order in which they are
105  * stored. The iterator is controlled by calling @c le_hashmap_NextNode(), and must
106  * be called before accessing any elements. You can then retrieve pointers to
107  * the key and value by using le_hashmap_GetKey() and le_hashmap_GetValue().
108  *
109  * @note There is only one iterator per hashtable. Calling le_hashmap_GetIterator()
110  * will simply re-initialize the current iterator
111  *
112  * It is possible to add and remove items during this style of iteration. When
113  * adding items during an iteration it is not guaranteed that the newly added item
114  * will be iterated over. It's very possible that the newly added item is added in
115  * an earlier location than the iterator is curently pointed at.
116  *
117  * When removing items during an iteration you also have to keep in mind that the
118  * iterator's current item may be the one removed. If this is the case,
119  * le_hashmap_GetKey, and le_hashmap_GetValue will return NULL until either,
120  * le_hashmap_NextNode, or le_hashmap_PrevNode are called.
121  *
122  * For example (assuming a table of string/string):
123  *
124  * @code
125  * void ProcessTable(le_hashmap_Ref_t myTable)
126  * {
127  * char* nextKey;
128  * char* nextVal;
129  *
130  * le_hashmap_It_Ref_t myIter = le_hashmap_GetIterator(myTable);
131  *
132  * while (LE_OK == le_hashmap_NextNode(myIter))
133  * {
134  * // Do something with the strings
135  * nextKey = le_hashmap_GetKey(myIter);
136  * nextVal = le_hashmap_GetValue(myIter);
137  * }
138  * }
139  * @endcode
140  *
141  * If you need to control access to the hashmap, then a mutex can be used.
142  *
143  * @section c_hashmap_tracing Tracing a map
144  *
145  * Hashmaps can be traced using the logging system.
146  *
147  * If @c le_hashmap_MakeTraceable() is called for a specified hashmap object, the name of that
148  * hashmap (the name passed into le_hashmap_Create() ) becomes a trace keyword
149  * to enable and disable tracing of that particular hashmap.
150  *
151  * If @c le_hashmap_EnableTrace() is called for a hashmap object, tracing is
152  * immediately activated for that hashmap.
153  *
154  * See @ref c_log_controlling for more information on how to enable and disable tracing using
155  * configuration and/or the log control tool.
156  *
157  * <HR>
158  *
159  * Copyright (C) Sierra Wireless Inc.
160  */
161 
162 //--------------------------------------------------------------------------------------------------
163 /**
164  * @file le_hashmap.h
165  *
166  * Legato @ref c_hashmap include file.
167  *
168  * Copyright (C) Sierra Wireless Inc.
169  */
170 //--------------------------------------------------------------------------------------------------
171 
172 #ifndef LEGATO_HASHMAP_INCLUDE_GUARD
173 #define LEGATO_HASHMAP_INCLUDE_GUARD
174 
175 //--------------------------------------------------------------------------------------------------
176 /**
177  * Reference to a HashMap.
178  */
179 //--------------------------------------------------------------------------------------------------
180 typedef struct le_hashmap* le_hashmap_Ref_t;
181 
182 //--------------------------------------------------------------------------------------------------
183 /**
184  * Reference to a HashMap Iterator.
185  */
186 //--------------------------------------------------------------------------------------------------
187 typedef struct le_hashmap_It* le_hashmap_It_Ref_t;
188 
189 //--------------------------------------------------------------------------------------------------
190 /**
191  * Prototype for hash functions. The hash function must generate a good spread of hashes without
192  * consuming lots of processing power.
193  *
194  * @param keyToHashPtr Pointer to the key which will be hashed
195  * @return The calculated hash value
196  */
197 //--------------------------------------------------------------------------------------------------
198 typedef size_t (*le_hashmap_HashFunc_t)
199 (
200  const void* keyToHashPtr
201 );
202 
203 //--------------------------------------------------------------------------------------------------
204 /**
205  * Prototype for equality functions. The equality function returns true if the the keys point to
206  * values are equivalent. The HashMap doesn't know in advance which types are to be stored so
207  * this function must be supplied by the caller.
208  *
209  * @param firstKeyPtr Pointer to the first key for comparing.
210  * @param secondKeyPtr Pointer to the second key for comparing.
211  * @return Returns true if the values are the same, false otherwise
212  */
213 //--------------------------------------------------------------------------------------------------
214 typedef bool (*le_hashmap_EqualsFunc_t)
215 (
216  const void* firstKeyPtr,
217  const void* secondKeyPtr
218 );
219 
220 
221 //--------------------------------------------------------------------------------------------------
222 /**
223  * Prototype for callback functions for the iterator function le_hashmap_ForEach(). This function should
224  * return true in order to continue iterating, or false to stop.
225  *
226  * @param keyPtr Pointer to the key at the current position in the map
227  * @param valuePtr Pointer to the value associated to this key
228  * @param contextPtr Pointer to the context supplied to le_hashmap_ForEach()
229  * @return Returns true to continue, false to stop
230  */
231 //--------------------------------------------------------------------------------------------------
232 typedef bool (*le_hashmap_ForEachHandler_t)
233 (
234  const void* keyPtr,
235  const void* valuePtr,
236  void* contextPtr
237 );
238 
239 //--------------------------------------------------------------------------------------------------
240 /**
241  * Create a HashMap.
242  *
243  * If you create a hashmap with a smaller capacity than you actually use, then
244  * the map will continue to work, but performance will degrade the more you put in the map.
245  *
246  * @return Returns a reference to the map.
247  *
248  * @note Terminates the process on failure, so no need to check the return value for errors.
249  */
250 //--------------------------------------------------------------------------------------------------
252 (
253  const char* nameStr, ///< [in] Name of the HashMap
254  size_t capacity, ///< [in] Size of the hashmap
255  le_hashmap_HashFunc_t hashFunc, ///< [in] Hash function
256  le_hashmap_EqualsFunc_t equalsFunc ///< [in] Equality function
257 );
258 
259 //--------------------------------------------------------------------------------------------------
260 /**
261  * Add a key-value pair to a HashMap. If the key already exists in the map, the previous value
262  * will be replaced with the new value passed into this function.
263  *
264  * @return Returns NULL for a new entry or a pointer to the old value if it is replaced.
265  *
266  */
267 //--------------------------------------------------------------------------------------------------
268 
269 void* le_hashmap_Put
270 (
271  le_hashmap_Ref_t mapRef, ///< [in] Reference to the map.
272  const void* keyPtr, ///< [in] Pointer to the key to be stored.
273  const void* valuePtr ///< [in] Pointer to the value to be stored.
274 );
275 
276 //--------------------------------------------------------------------------------------------------
277 /**
278  * Retrieve a value from a HashMap.
279  *
280  * @return Returns a pointer to the value or NULL if the key is not found.
281  *
282  */
283 //--------------------------------------------------------------------------------------------------
284 
285 void* le_hashmap_Get
286 (
287  le_hashmap_Ref_t mapRef, ///< [in] Reference to the map.
288  const void* keyPtr ///< [in] Pointer to the key to be retrieved.
289 );
290 
291 //--------------------------------------------------------------------------------------------------
292 /**
293  * Retrieve a stored key from a HashMap.
294  *
295  * @return Returns a pointer to the key that was stored in the HashMap by le_hashmap_Put() or
296  * NULL if the key is not found.
297  *
298  */
299 //--------------------------------------------------------------------------------------------------
301 (
302  le_hashmap_Ref_t mapRef, ///< [in] Reference to the map.
303  const void* keyPtr ///< [in] Pointer to the key to be retrieved.
304 );
305 
306 //--------------------------------------------------------------------------------------------------
307 /**
308  * Remove a value from a HashMap.
309  *
310  * @return Returns a pointer to the value or NULL if the key is not found.
311  *
312  */
313 //--------------------------------------------------------------------------------------------------
314 
315 void* le_hashmap_Remove
316 (
317  le_hashmap_Ref_t mapRef, ///< [in] Reference to the map.
318  const void* keyPtr ///< [in] Pointer to the key to be removed.
319 );
320 
321 //--------------------------------------------------------------------------------------------------
322 /**
323  * Tests if the HashMap is empty (i.e. contains zero keys).
324  *
325  * @return Returns true if empty, false otherwise.
326  *
327  */
328 //--------------------------------------------------------------------------------------------------
329 
331 (
332  le_hashmap_Ref_t mapRef ///< [in] Reference to the map.
333 );
334 
335 //--------------------------------------------------------------------------------------------------
336 /**
337  * Calculates the number of keys in the HashMap.
338  *
339  * @return The number of keys in the HashMap.
340  *
341  */
342 //--------------------------------------------------------------------------------------------------
343 
344 size_t le_hashmap_Size
345 (
346  le_hashmap_Ref_t mapRef ///< [in] Reference to the map.
347 );
348 
349 //--------------------------------------------------------------------------------------------------
350 /**
351  * Tests if the HashMap contains a particular key.
352  *
353  * @return Returns true if the key is found, false otherwise.
354  *
355  */
356 //--------------------------------------------------------------------------------------------------
357 
359 (
360  le_hashmap_Ref_t mapRef, ///< [in] Reference to the map.
361  const void* keyPtr ///< [in] Pointer to the key to be searched.
362 );
363 
364 //--------------------------------------------------------------------------------------------------
365 /**
366  * Deletes all the entries held in the hashmap. This will not delete the data pointed to by the
367  * key and value pointers. That cleanup is the responsibility of the caller.
368  * This allows the map to be re-used. Currently maps can't be deleted.
369  *
370  */
371 //--------------------------------------------------------------------------------------------------
372 
374 (
375  le_hashmap_Ref_t mapRef ///< [in] Reference to the map.
376 );
377 
378 //--------------------------------------------------------------------------------------------------
379 /**
380  * Iterates over the whole map, calling the supplied callback with each key-value pair. If the callback
381  * returns false for any key then this function will return.
382  *
383  * @return Returns true if all elements were checked; or false if iteration was stopped early
384  *
385  */
386 //--------------------------------------------------------------------------------------------------
388 (
389  le_hashmap_Ref_t mapRef, ///< [in] Reference to the map.
390  le_hashmap_ForEachHandler_t forEachFn, ///< [in] Callback function to be called with each pair.
391  void* contextPtr ///< [in] Pointer to a context to be supplied to the callback.
392 );
393 
394 //--------------------------------------------------------------------------------------------------
395 /**
396  * Gets an iterator for step-by-step iteration over the map. In this mode,
397  * the iteration is controlled by the calling function using the le_hashmap_NextNode() function.
398  * There is one iterator per map, and calling this function resets the
399  * iterator position to the start of the map.
400  * The iterator is not ready for data access until le_hashmap_NextNode() has been called
401  * at least once.
402  *
403  * @return Returns A reference to a hashmap iterator which is ready
404  * for le_hashmap_NextNode() to be called on it
405  *
406  */
407 //--------------------------------------------------------------------------------------------------
409 (
410  le_hashmap_Ref_t mapRef ///< [in] Reference to the map.
411 );
412 
413 //--------------------------------------------------------------------------------------------------
414 /**
415  * Moves the iterator to the next key/value pair in the map. Order is dependent
416  * on the hash algorithm and the order of inserts, and is not sorted at all.
417  *
418  * @return Returns LE_OK unless you go past the end of the map, then returns LE_NOT_FOUND.
419  *
420  */
421 //--------------------------------------------------------------------------------------------------
423 (
424  le_hashmap_It_Ref_t iteratorRef ///< [IN] Reference to the iterator.
425 );
426 
427 //--------------------------------------------------------------------------------------------------
428 /**
429  * Moves the iterator to the previous key/value pair in the map. Order is dependent
430  * on the hash algorithm and the order of inserts, and is not sorted at all.
431  *
432  * @return Returns LE_OK unless you go past the beginning of the map, then returns LE_NOT_FOUND.
433  *
434  */
435 //--------------------------------------------------------------------------------------------------
437 (
438  le_hashmap_It_Ref_t iteratorRef ///< [IN] Reference to the iterator
439 );
440 
441 //--------------------------------------------------------------------------------------------------
442 /**
443  * Retrieves a pointer to the key where the iterator is currently pointing.
444  * If the iterator has just been initialized and le_hashmap_NextNode() has not been
445  * called, or if the iterator has been invalidated, this will return NULL.
446  *
447  * @return Pointer to the current key, or NULL if the iterator has been invalidated or is not
448  * ready.
449  *
450  */
451 //--------------------------------------------------------------------------------------------------
452 const void* le_hashmap_GetKey
453 (
454  le_hashmap_It_Ref_t iteratorRef ///< [IN] Reference to the iterator.
455 );
456 
457 //--------------------------------------------------------------------------------------------------
458 /**
459  * Retrieves a pointer to the value where the iterator is currently pointing.
460  * If the iterator has just been initialized and le_hashmap_NextNode() has not been
461  * called, or if the iterator has been invalidated, this will return NULL.
462  *
463  * @return Pointer to the current value, or NULL if the iterator has been invalidated or is not
464  * ready.
465  *
466  */
467 //--------------------------------------------------------------------------------------------------
469 (
470  le_hashmap_It_Ref_t iteratorRef ///< [IN] Reference to the iterator.
471 );
472 
473 //--------------------------------------------------------------------------------------------------
474 /**
475  * Retrieves the key and value of the first node stored in the hashmap.
476  * The hashmap is not sorted so this will simply return the first node stored in the map.
477  * There is no guarantee that a subsequent call to this function will return the same pair
478  * if new keys have been added to the map.
479  * If NULL is passed as the firstValuePointer then only the key will be returned.
480  *
481  * @return LE_OK if the first node is returned or LE_NOT_FOUND if the map is empty.
482  * LE_BAD_PARAMETER if the key is NULL.
483  *
484  */
485 //--------------------------------------------------------------------------------------------------
487 (
488  le_hashmap_Ref_t mapRef, ///< [in] Reference to the map
489  void **firstKeyPtr, ///< [out] Pointer to the first key
490  void **firstValuePtr ///< [out] Pointer to the first value
491 );
492 
493 //--------------------------------------------------------------------------------------------------
494 /**
495  * Retrieves the key and value of the node after the passed in key.
496  * The hashmap is not sorted so this will simply return the next node stored in the map.
497  * There is no guarantee that a subsequent call to this function will return the same pair
498  * if new keys have been added to the map.
499  * If NULL is passed as the nextValuePtr then only the key will be returned.
500  *
501  * @return LE_OK if the next node is returned. If the keyPtr is not found in the
502  * map then LE_BAD_PARAMETER is returned. LE_NOT_FOUND is returned if the passed
503  * in key is the last one in the map.
504  *
505  */
506 //--------------------------------------------------------------------------------------------------
508 (
509  le_hashmap_Ref_t mapRef, ///< [in] Reference to the map
510  const void* keyPtr, ///< [in] Pointer to the key to be searched for
511  void **nextKeyPtr, ///< [out] Pointer to the first key
512  void **nextValuePtr ///< [out] Pointer to the first value
513 );
514 
515 
516 //--------------------------------------------------------------------------------------------------
517 /**
518  * Counts the total number of collisions in the map. A collision occurs
519  * when more than one entry is stored in the map at the same index.
520  *
521  * @return Returns the total collisions in the map.
522  *
523  */
524 //--------------------------------------------------------------------------------------------------
525 
527 (
528  le_hashmap_Ref_t mapRef ///< [in] Reference to the map.
529 );
530 
531 //--------------------------------------------------------------------------------------------------
532 /**
533  * String hashing function. Can be used as a parameter to le_hashmap_Create() if the key to
534  * the table is a string.
535  *
536  * @return Returns the hash value of the string pointed to by stringToHash.
537  *
538  */
539 //--------------------------------------------------------------------------------------------------
540 
542 (
543  const void* stringToHashPtr ///< [in] Pointer to the string to be hashed.
544 );
545 
546 //--------------------------------------------------------------------------------------------------
547 /**
548  * String equality function. Can be used as a parameter to le_hashmap_Create() if the key to
549  * the table is a string
550  *
551  * @return Returns true if the strings are identical, false otherwise.
552  *
553  */
554 //--------------------------------------------------------------------------------------------------
555 
557 (
558  const void* firstStringPtr, ///< [in] Pointer to the first string for comparing.
559  const void* secondStringPtr ///< [in] Pointer to the second string for comparing.
560 );
561 
562 //--------------------------------------------------------------------------------------------------
563 /**
564  * Integer hashing function. Can be used as a parameter to le_hashmap_Create() if the key to
565  * the table is a uint32_t.
566  *
567  * @return Returns the hash value of the uint32_t pointed to by intToHash.
568  *
569  */
570 //--------------------------------------------------------------------------------------------------
571 
573 (
574  const void* intToHashPtr ///< [in] Pointer to the integer to be hashed.
575 );
576 
577 //--------------------------------------------------------------------------------------------------
578 /**
579  * Integer equality function. Can be used as a parameter to le_hashmap_Create() if the key to
580  * the table is a uint32_t.
581  *
582  * @return Returns true if the integers are equal, false otherwise.
583  *
584  */
585 //--------------------------------------------------------------------------------------------------
586 
588 (
589  const void* firstIntPtr, ///< [in] Pointer to the first integer for comparing.
590  const void* secondIntPtr ///< [in] Pointer to the second integer for comparing.
591 );
592 
593 //--------------------------------------------------------------------------------------------------
594 /**
595  * Long integer hashing function. This can be used as a paramter to le_hashmap_Create if the key to
596  * the table is a uint64_t
597  *
598  * @return Returns the hash value of the uint64_t pointed to by intToHash
599  *
600  */
601 //--------------------------------------------------------------------------------------------------
602 
604 (
605  const void* intToHashPtr ///< [in] Pointer to the long integer to be hashed
606 );
607 
608 //--------------------------------------------------------------------------------------------------
609 /**
610  * Long integer equality function. This can be used as a paramter to le_hashmap_Create if the key to
611  * the table is a uint64_t
612  *
613  * @return Returns true if the integers are equal, false otherwise
614  *
615  */
616 //--------------------------------------------------------------------------------------------------
617 
619 (
620  const void* firstIntPtr, ///< [in] Pointer to the first long integer for comparing.
621  const void* secondIntPtr ///< [in] Pointer to the second long integer for comparing.
622 );
623 
624 //--------------------------------------------------------------------------------------------------
625 /**
626  * Pointer hashing function. Can be used as a parameter to le_hashmap_Create() if the key to
627  * the table is an pointer or reference. Simply pass in the address as the key.
628  *
629  * @return Returns the hash value of the pointer pointed to by voidToHashPtr
630  *
631  */
632 //--------------------------------------------------------------------------------------------------
633 
635 (
636  const void* voidToHashPtr ///< [in] Pointer to be hashed
637 );
638 
639 //--------------------------------------------------------------------------------------------------
640 /**
641  * Pointer equality function. Can be used as a parameter to le_hashmap_Create() if the key to
642  * the table is an pointer or reference.
643  *
644  * @return Returns true if the pointers are equal, false otherwise
645  *
646  */
647 //--------------------------------------------------------------------------------------------------
648 
650 (
651  const void* firstVoidPtr, ///< [in] First pointer for comparing.
652  const void* secondVoidPtr ///< [in] Second pointer for comparing.
653 );
654 
655 
656 //--------------------------------------------------------------------------------------------------
657 /**
658  * Generic hash for any plain-old-datatype.
659  */
660 //--------------------------------------------------------------------------------------------------
661 #define LE_HASHMAP_MAKE_HASH(type) \
662  static size_t Hash##type \
663  ( \
664  const void* type##Name \
665  ) \
666  { \
667  size_t byte=0, hash = 0; \
668  unsigned char c; \
669  const unsigned char* ptr = type##Name; \
670  for (byte = 0; byte < sizeof(type); ++byte) \
671  { \
672  c = *ptr++; \
673  hash = c + (hash << 6) + (hash << 16) - hash; \
674  } \
675  return hash; \
676  } \
677  static bool Equals##type \
678  ( \
679  const void* first##type, \
680  const void* second##type \
681  ) \
682  { \
683  return memcmp(first##type, second##type, sizeof(type)) == 0; \
684  }
685 
686 
687 
688 //--------------------------------------------------------------------------------------------------
689 /**
690  * Makes a particular hashmap traceable without enabling the tracing. After this is called, when
691  * the trace keyword for this hashmap (the hashmap's name) is enabled for the "framework" component
692  * in the process, tracing will start. If that keyword was enabled before
693  * this function was called, tracing will start immediately when it is called.
694  **/
695 //--------------------------------------------------------------------------------------------------
697 (
698  le_hashmap_Ref_t mapRef ///< [in] Reference to the map.
699 );
700 
701 
702 //--------------------------------------------------------------------------------------------------
703 /**
704  * Immediately enables tracing on a particular hashmap object.
705  **/
706 //--------------------------------------------------------------------------------------------------
708 (
709  le_hashmap_Ref_t mapRef ///< [in] Reference to the map.
710 );
711 
712 
713 #endif /* LEGATO_HASHMAP_INCLUDE_GUARD */
const void * le_hashmap_GetKey(le_hashmap_It_Ref_t iteratorRef)
void le_hashmap_EnableTrace(le_hashmap_Ref_t mapRef)
bool le_hashmap_ForEach(le_hashmap_Ref_t mapRef, le_hashmap_ForEachHandler_t forEachFn, void *contextPtr)
void * le_hashmap_GetStoredKey(le_hashmap_Ref_t mapRef, const void *keyPtr)
le_result_t
Definition: le_basics.h:35
le_hashmap_It_Ref_t le_hashmap_GetIterator(le_hashmap_Ref_t mapRef)
struct le_hashmap_It * le_hashmap_It_Ref_t
Definition: le_hashmap.h:187
size_t(* le_hashmap_HashFunc_t)(const void *keyToHashPtr)
Definition: le_hashmap.h:199
struct le_hashmap * le_hashmap_Ref_t
Definition: le_hashmap.h:180
size_t le_hashmap_Size(le_hashmap_Ref_t mapRef)
bool le_hashmap_EqualsString(const void *firstStringPtr, const void *secondStringPtr)
size_t le_hashmap_HashUInt32(const void *intToHashPtr)
size_t le_hashmap_HashString(const void *stringToHashPtr)
bool le_hashmap_isEmpty(le_hashmap_Ref_t mapRef)
bool le_hashmap_EqualsVoidPointer(const void *firstVoidPtr, const void *secondVoidPtr)
void * le_hashmap_Put(le_hashmap_Ref_t mapRef, const void *keyPtr, const void *valuePtr)
void * le_hashmap_GetValue(le_hashmap_It_Ref_t iteratorRef)
bool(* le_hashmap_EqualsFunc_t)(const void *firstKeyPtr, const void *secondKeyPtr)
Definition: le_hashmap.h:215
bool(* le_hashmap_ForEachHandler_t)(const void *keyPtr, const void *valuePtr, void *contextPtr)
Definition: le_hashmap.h:233
size_t le_hashmap_CountCollisions(le_hashmap_Ref_t mapRef)
le_result_t le_hashmap_GetFirstNode(le_hashmap_Ref_t mapRef, void **firstKeyPtr, void **firstValuePtr)
size_t le_hashmap_HashVoidPointer(const void *voidToHashPtr)
void le_hashmap_MakeTraceable(le_hashmap_Ref_t mapRef)
void * le_hashmap_Remove(le_hashmap_Ref_t mapRef, const void *keyPtr)
bool le_hashmap_ContainsKey(le_hashmap_Ref_t mapRef, const void *keyPtr)
le_hashmap_Ref_t le_hashmap_Create(const char *nameStr, size_t capacity, le_hashmap_HashFunc_t hashFunc, le_hashmap_EqualsFunc_t equalsFunc)
void le_hashmap_RemoveAll(le_hashmap_Ref_t mapRef)
bool le_hashmap_EqualsUInt64(const void *firstIntPtr, const void *secondIntPtr)
void * le_hashmap_Get(le_hashmap_Ref_t mapRef, const void *keyPtr)
le_result_t le_hashmap_NextNode(le_hashmap_It_Ref_t iteratorRef)
bool le_hashmap_EqualsUInt32(const void *firstIntPtr, const void *secondIntPtr)
size_t le_hashmap_HashUInt64(const void *intToHashPtr)
le_result_t le_hashmap_PrevNode(le_hashmap_It_Ref_t iteratorRef)
le_result_t le_hashmap_GetNodeAfter(le_hashmap_Ref_t mapRef, const void *keyPtr, void **nextKeyPtr, void **nextValuePtr)