LibJuno 0.1.0
LibJuno is a lightweight C99 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
map.h File Reference
#include "juno/map/map_api.h"
#include "juno/map/map_types.h"
#include "juno/memory/memory_types.h"
#include "juno/status.h"
#include <stddef.h>
#include <stdint.h>
Include dependency graph for map.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

JUNO_STATUS_T Juno_MapInit (JUNO_MAP_T *ptMap, const JUNO_HASH_API_T *ptHashApi, JUNO_MEMORY_T *ptKeyTable, JUNO_MEMORY_T *ptValueTable, size_t zCapacity, JUNO_MAP_KEY_EQUAL_FCN_T pfcnIsEqual, JUNO_FAILURE_HANDLER_T pfcnFailureHandler, JUNO_USER_DATA_T *pvFailureUserData)
 
JUNO_STATUS_T Juno_MapSet (JUNO_MAP_T *ptMap, JUNO_MEMORY_T tKey, JUNO_MEMORY_T tValue)
 
JUNO_STATUS_T Juno_MapRemove (JUNO_MAP_T *ptMap, JUNO_MEMORY_T tKey)
 
JUNO_STATUS_T Juno_MapGet (JUNO_MAP_T *ptMap, JUNO_MEMORY_T tKey, JUNO_MEMORY_T *ptRetValue)
 
const JUNO_MAP_API_TJuno_MapApi (void)
 

Function Documentation

◆ Juno_MapApi()

const JUNO_MAP_API_T * Juno_MapApi ( void  )

◆ Juno_MapGet()

JUNO_STATUS_T Juno_MapGet ( JUNO_MAP_T ptMap,
JUNO_MEMORY_T  tKey,
JUNO_MEMORY_T ptRetValue 
)

Get a value from the map using the key

Parameters
ptMapA pointer to the map
tKeyThe key to use
ptRetValThe return value retrieved using the key
Returns
Status of operation. Returns JUNO_STATUS_DNE_ERROR if the key is not in the map

◆ Juno_MapInit()

JUNO_STATUS_T Juno_MapInit ( JUNO_MAP_T ptMap,
const JUNO_HASH_API_T ptHashApi,
JUNO_MEMORY_T ptKeyTable,
JUNO_MEMORY_T ptValueTable,
size_t  zCapacity,
JUNO_MAP_KEY_EQUAL_FCN_T  pfcnIsEqual,
JUNO_FAILURE_HANDLER_T  pfcnFailureHandler,
JUNO_USER_DATA_T pvFailureUserData 
)

Initialize a Juno Map

Parameters
ptMapA pointer to the map to initalize
ptKeyTableThe allocated memory for the keys
ptValueTableThe allocated memory for the values
zKeySizeThe size of the key
zCapacityThe capacity of the map table
pfcnIsEqualA function to determine if two keys are equal
pfcnFailureHandlerThe failure handler
pvFailureUserDataUser data to provide to the failure handler
Returns
Returns a JUNO_STATUS_SUCCESS on success, and error otherwise

◆ Juno_MapRemove()

JUNO_STATUS_T Juno_MapRemove ( JUNO_MAP_T ptMap,
JUNO_MEMORY_T  tKey 
)

Remove a key,value pair from the map

Parameters
ptMapA pointer to the map
tKeyThe key to remove
Returns
Status of operation

◆ Juno_MapSet()

JUNO_STATUS_T Juno_MapSet ( JUNO_MAP_T ptMap,
JUNO_MEMORY_T  tKey,
JUNO_MEMORY_T  tValue 
)

Add a key,value pair to the map

Parameters
ptMapA pointer to the map
ptKeyA key to add
pvValueA value to add
Returns
Status of operation