cr8r_pheap_ft Struct Reference

function table for pairing heaps note that since this is an intrusive data structure, base.size is actually the OFFSET of the cr8r_pheap_node struct within the outer struct, and cmp, alloc, and free deal with outer struct pointers. More...

#include <pheap.h>

Data Fields

cr8r_base_ft base
 Base function table values (data and size)
 
int(* cmp )(const cr8r_base_ft *, const void *, const void *)
 Function to compare elements. More...
 
void *(* alloc )(cr8r_base_ft *)
 Function to allocate a new node. More...
 
void(* free )(cr8r_base_ft *, void *)
 Function to deallocate a node.
 

Detailed Description

function table for pairing heaps note that since this is an intrusive data structure, base.size is actually the OFFSET of the cr8r_pheap_node struct within the outer struct, and cmp, alloc, and free deal with outer struct pointers.

Definition at line 48 of file pheap.h.

Field Documentation

◆ cmp

int(* cr8r_pheap_ft::cmp) (const cr8r_base_ft *, const void *, const void *)

Function to compare elements.

Should only depend on "key" data within the elements. Should return 0 for elements that are equal, or any nonzero int for elements that are not equal. Equality according to this function should imply equal hash values. Currently no requirement is placed on return values for unequal operands beyond being nonzero, but if possible <0 should indicate the first operand is smaller, >0 should indicate the first argument is large, and the function should avoid returning INT_MIN

some cmps are unsequenced so data really must not be modified here

Definition at line 59 of file pheap.h.

◆ alloc

void*(* cr8r_pheap_ft::alloc) (cr8r_base_ft *)

Function to allocate a new node.

This should allocate base.size + sizeof(cr8r_pheap_node) bytes (remember for this data structure base.size is actaully the offset of the cr8r_pheap_node within the outer struct). The slab allocator in this library is designed to work well for allocating nodes

Definition at line 65 of file pheap.h.


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