Crossfire Server, Trunk
MinHeap Struct Reference

#include <minheap.h>

+ Collaboration diagram for MinHeap:

Data Fields

void ** arr
 
int capacity
 
void(* element_cleanup )(void *)
 
int(* get_measure )(const void *)
 
int len
 

Detailed Description

In order to adequately path for A* search, we will need a minheap to efficiently handle pathing from the lowest cost to our destination.

But, in order to allow for re-use, this is also designed generically.

99.9% of the time, you are going to want to interact with the functions provided, rather than the struct directly.

If you think you know better than the algorithm, you probably don't. There's a test suite for a reason.

Definition at line 16 of file minheap.h.

Field Documentation

◆ arr

void** MinHeap::arr

The heap array.

Definition at line 18 of file minheap.h.

Referenced by minheap_free(), minheap_init(), minheap_init_static(), minheap_insert(), minheap_normalize(), and minheap_remove().

◆ capacity

int MinHeap::capacity

The capacity of the min-heap.

Definition at line 22 of file minheap.h.

Referenced by minheap_init(), minheap_init_static(), minheap_insert(), and START_TEST().

◆ element_cleanup

void(* MinHeap::element_cleanup) (void *)

Function pointer to clean up the elements. Can do nothing, which allows for us to store primitive data types, stack-allocated data, or data that is still in use.

Definition at line 29 of file minheap.h.

Referenced by minheap_free(), minheap_init(), and minheap_init_static().

◆ get_measure

int(* MinHeap::get_measure) (const void *)

Functon to get the measured quantity from the stored data. The returned measure is what the min-heap organizes on.

Definition at line 25 of file minheap.h.

Referenced by minheap_init(), minheap_init_static(), and minheap_normalize().

◆ len

int MinHeap::len

The in-use length of the min-heap.

Definition at line 20 of file minheap.h.

Referenced by minheap_free(), minheap_init(), minheap_init_static(), minheap_insert(), minheap_normalize(), minheap_remove(), and START_TEST().


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