LibJuno 0.23.0
LibJuno is a lightweight C99 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
map_api.h
Go to the documentation of this file.
1/*
2 MIT License
3
4 Copyright (c) 2025 Robin A. Onsay
5
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files
8 (the "Software"), to deal in the Software without restriction,
9 including without limitation the rights to use, copy, modify, merge,
10 publish, distribute, sublicense, and/or sell copies of the Software,
11 and to permit persons to whom the Software is furnished to do so,
12 subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be
15 included in all copies or substantial portions of the Software.
16*/
17
27#ifndef JUNO_MAP_API_H
28#define JUNO_MAP_API_H
29#include "juno/hash/hash_api.h"
31#include "juno/status.h"
32#include "juno/module.h"
33#include <stdbool.h>
34#ifdef __cplusplus
35extern "C"
36{
37#endif
38
41
43JUNO_MODULE_BASE_DECLARE(JUNO_MAP_BASE_T);
44
46 JUNO_HASH_T *ptHash;
47 JUNO_MEMORY_T *ptMapKeys;
48 JUNO_MEMORY_T *ptMapValues;
49 size_t zCapacity;
50 size_t zLenHashTable;
51 JUNO_MAP_KEY_EQUAL_FCN_T pfcnIsEqual;
52);
53
55{
61 JUNO_STATUS_T (*Set)(JUNO_MAP_T *ptMap, JUNO_MEMORY_T tKey, JUNO_MEMORY_T tValue);
62
67 JUNO_STATUS_T (*Remove)(JUNO_MAP_T *ptMap, JUNO_MEMORY_T tKey);
68
75 JUNO_STATUS_T (*Get)(JUNO_MAP_T *ptMap, JUNO_MEMORY_T tKey, JUNO_MEMORY_T *ptRetValue);
76};
77
78#ifdef __cplusplus
79}
80#endif
81#endif // JUNO_MAP_API_H
bool(* JUNO_MAP_KEY_EQUAL_FCN_T)(JUNO_MEMORY_T ptKey1, JUNO_MEMORY_T ptKey2)
Definition map_api.h:40
#define JUNO_MODULE_BASE(name, API, members)
Definition module.h:81
#define JUNO_MODULE_BASE_DECLARE(name)
Definition module.h:31
#define JUNO_MODULE_DECLARE(name)
Definition module.h:26
enum JUNO_STATUS_TAG JUNO_STATUS_T
Definition map_api.h:55
JUNO_STATUS_T(* Remove)(JUNO_MAP_T *ptMap, JUNO_MEMORY_T tKey)
Definition map_api.h:67
JUNO_STATUS_T(* Set)(JUNO_MAP_T *ptMap, JUNO_MEMORY_T tKey, JUNO_MEMORY_T tValue)
Definition map_api.h:61
JUNO_STATUS_T(* Get)(JUNO_MAP_T *ptMap, JUNO_MEMORY_T tKey, JUNO_MEMORY_T *ptRetValue)
Definition map_api.h:75
Structure for an allocated memory segment. Describes the allocated memory with a pointer to the start...
Definition memory_api.h:65