hashmap.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. Copyright 1999 ImageMagick Studio LLC, a non-profit organization
  3. dedicated to making software imaging solutions freely available.
  4. You may not use this file except in compliance with the License. You may
  5. obtain a copy of the License at
  6. https://imagemagick.org/script/license.php
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. MagickCore hash methods.
  13. */
  14. #ifndef MAGICKCORE_HASHMAP_H
  15. #define MAGICKCORE_HASHMAP_H
  16. #if defined(__cplusplus) || defined(c_plusplus)
  17. extern "C" {
  18. #endif
  19. #define SmallHashmapSize 17
  20. #define MediumHashmapSize 509
  21. #define LargeHashmapSize 8191
  22. #define HugeHashmapSize 131071
  23. typedef struct _HashmapInfo
  24. HashmapInfo;
  25. typedef struct _LinkedListInfo
  26. LinkedListInfo;
  27. extern MagickExport HashmapInfo
  28. *DestroyHashmap(HashmapInfo *),
  29. *NewHashmap(const size_t,size_t (*)(const void *),MagickBooleanType (*)
  30. (const void *,const void *),void *(*)(void *),void *(*)(void *));
  31. extern MagickExport LinkedListInfo
  32. *DestroyLinkedList(LinkedListInfo *,void *(*)(void *)),
  33. *NewLinkedList(const size_t);
  34. extern MagickExport MagickBooleanType
  35. AppendValueToLinkedList(LinkedListInfo *,const void *),
  36. CompareHashmapString(const void *,const void *),
  37. CompareHashmapStringInfo(const void *,const void *),
  38. InsertValueInLinkedList(LinkedListInfo *,const size_t,const void *),
  39. InsertValueInSortedLinkedList(LinkedListInfo *,
  40. int (*)(const void *,const void *),void **,const void *),
  41. IsHashmapEmpty(const HashmapInfo *),
  42. IsLinkedListEmpty(const LinkedListInfo *),
  43. LinkedListToArray(LinkedListInfo *,void **),
  44. PutEntryInHashmap(HashmapInfo *,const void *,const void *);
  45. extern MagickExport size_t
  46. GetNumberOfElementsInLinkedList(const LinkedListInfo *),
  47. GetNumberOfEntriesInHashmap(const HashmapInfo *),
  48. HashPointerType(const void *),
  49. HashStringType(const void *),
  50. HashStringInfoType(const void *);
  51. extern MagickExport void
  52. ClearLinkedList(LinkedListInfo *,void *(*)(void *)),
  53. *GetLastValueInLinkedList(LinkedListInfo *),
  54. *GetNextKeyInHashmap(HashmapInfo *),
  55. *GetNextValueInHashmap(HashmapInfo *),
  56. *GetNextValueInLinkedList(LinkedListInfo *),
  57. *GetValueFromHashmap(HashmapInfo *,const void *),
  58. *GetValueFromLinkedList(LinkedListInfo *,const size_t),
  59. *RemoveElementByValueFromLinkedList(LinkedListInfo *,const void *),
  60. *RemoveElementFromLinkedList(LinkedListInfo *,const size_t),
  61. *RemoveEntryFromHashmap(HashmapInfo *,const void *),
  62. *RemoveLastElementFromLinkedList(LinkedListInfo *),
  63. ResetHashmapIterator(HashmapInfo *),
  64. ResetLinkedListIterator(LinkedListInfo *);
  65. #if defined(__cplusplus) || defined(c_plusplus)
  66. }
  67. #endif
  68. #endif