LibJuno 0.42.0
LibJuno is a lightweight C99 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
JUNO_DS_HEAP_API_TAG Struct Reference

API vtable you must implement to adapt the heap to your storage. More...

#include <heap_api.h>

Data Fields

JUNO_DS_HEAP_COMPARE_RESULT_T(* Compare )(JUNO_DS_HEAP_ROOT_T *ptHeap, size_t parent, size_t child)
 Compare two values to perform the heap operation.
 
JUNO_STATUS_T(* Swap )(JUNO_DS_HEAP_ROOT_T *ptHeap, size_t iFrom, size_t iTo)
 
JUNO_STATUS_T(* Reset )(JUNO_DS_HEAP_ROOT_T *ptHeap, size_t iIndex)
 

Detailed Description

API vtable you must implement to adapt the heap to your storage.

Contract:

  • Compare(parent, child): Return {SUCCESS, true} if the heap property holds between indices, or {SUCCESS, false} if a swap is needed.
  • Swap(iFrom, iTo): Exchange elements at the given indices in your storage.
  • Reset(iIndex): Clear the element at iIndex when it leaves the heap (e.g., set to 0).

Field Documentation

◆ Compare

JUNO_DS_HEAP_COMPARE_RESULT_T(* JUNO_DS_HEAP_API_TAG::Compare) (JUNO_DS_HEAP_ROOT_T *ptHeap, size_t parent, size_t child)

Compare two values to perform the heap operation.

◆ Reset

JUNO_STATUS_T(* JUNO_DS_HEAP_API_TAG::Reset) (JUNO_DS_HEAP_ROOT_T *ptHeap, size_t iIndex)

◆ Swap

JUNO_STATUS_T(* JUNO_DS_HEAP_API_TAG::Swap) (JUNO_DS_HEAP_ROOT_T *ptHeap, size_t iFrom, size_t iTo)

The documentation for this struct was generated from the following file: