EmbeddedEtcher
|
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include "heap.h"
#include "error.h"
#include "ostypes.h"
#include "printf.h"
Functions | |
void | osHeapInit (osHeapNode_t *ioarray) |
void | osHeapHeapify (osHeapNode_t *ioarray, uint8_t iind) |
void | osHeapBuild (osHeapNode_t *ioarray) |
uint8_t | osHeapMaximum (osHeapNode_t *ioarray, osHeapNode_t *iomax) |
uint8_t | osHeapExtractMaximum (osHeapNode_t *ioarray, osHeapNode_t *iomax) |
uint8_t | osHeapInsert (osHeapNode_t *ioarray, osHeapNode_t x) |
void | osHeapPrintS (osHeapNode_t *ioarray) |
uint8_t | osHeapIsEmpty (osHeapNode_t *ioarray) |
void osHeapBuild | ( | osHeapNode_t * | ioarray | ) |
Build the heap from the bottom up. Given an array which is not heapified at all.
ioarray | Array where the heap is stored. |
uint8_t osHeapExtractMaximum | ( | osHeapNode_t * | ioarray, |
osHeapNode_t * | iomax | ||
) |
Copy heap maximum and remove it (extract).
ioarray | Array where the heap is stored. |
iomax | Node, which is the maximum. |
1 | (SUCCESS) or 0 (heap is empty). |
void osHeapHeapify | ( | osHeapNode_t * | ioarray, |
uint8_t | iind | ||
) |
Classic heapify operation.
ioarray | Array where the heap is stored. |
iind | Element to be put in the right place. |
void osHeapInit | ( | osHeapNode_t * | ioarray | ) |
Initializes all heap elements by setting them to NULL.
Array | where the heap is stored. |
uint8_t osHeapInsert | ( | osHeapNode_t * | ioarray, |
osHeapNode_t | x | ||
) |
Insert a node into the heap.
ioarray | Array where the heap is stored. |
x | Node to be inserted into the heap. |
1 | (SUCCESS) or 0 (heap is full). |
uint8_t osHeapIsEmpty | ( | osHeapNode_t * | ioarray | ) |
Is the heap empty?
ioarray | Array where the heap is stored. |
uint8_t osHeapMaximum | ( | osHeapNode_t * | ioarray, |
osHeapNode_t * | iomax | ||
) |
Copy heap maximum.
ioarray | Array where the heap is stored. |
iomax | Node, which is the maximum. |
1 | (SUCCESS) or 0 (heap is empty). |
void osHeapPrintS | ( | osHeapNode_t * | ioarray | ) |
Print heap all priorities for debugging purposes.
ioarray | Array where the heap is stored. |