42 lines
1.3 KiB
C
42 lines
1.3 KiB
C
#ifndef INCLUDED_C_INDEXMAXPQ_H
|
|||
|
|
#define INCLUDED_C_INDEXMAXPQ_H
|
||
|
|
|
||
|
|
#ifndef INCLUDED_C_BASE_H
|
||
|
|
#include <c_Base.h>
|
||
|
|
#endif /*INCLUDED_C_BASE_H*/
|
||
|
|
|
||
|
|
|
||
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
||
|
|
/* */
|
||
|
|
|
||
|
|
typedef struct {
|
||
|
|
void* keys;
|
||
|
|
c_size_t element_size;
|
||
|
|
c_size_t max_items;
|
||
|
|
c_size_t size;
|
||
|
|
long long* pq;
|
||
|
|
long long* qp;
|
||
|
|
int (*compar)(const void*, const void*);
|
||
|
|
} c_IndexMaxPQ_t;
|
||
|
|
|
||
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
||
|
|
/* */
|
||
|
|
|
||
|
|
c_err_t c_IndexMaxPQ_Init(c_IndexMaxPQ_t* pq_inst, c_size_t max_items, c_size_t element_size,
|
||
|
|
int (*compar)(const void*, const void*));
|
||
|
|
|
||
|
|
void c_IndexMaxPQ_Destroy(c_IndexMaxPQ_t* pq_inst);
|
||
|
|
|
||
|
|
c_bool_t c_IndexMaxPQ_Contains(c_IndexMaxPQ_t* pq_inst, c_size_t ext_id);
|
||
|
|
|
||
|
|
c_err_t c_IndexMaxPQ_Push(c_IndexMaxPQ_t* pq_inst, c_size_t ext_id, const void* element);
|
||
|
|
|
||
|
|
c_err_t c_IndexMaxPQ_Pop(c_IndexMaxPQ_t* pq_inst, c_size_t* out_ext_id, void* out_element_buffer);
|
||
|
|
|
||
|
|
c_err_t c_IndexMaxPQ_ChangeKey(c_IndexMaxPQ_t* pq_inst, c_size_t ext_id, const void* new_element);
|
||
|
|
|
||
|
|
void* c_IndexMaxPQ_Peek(c_IndexMaxPQ_t* pq_inst, c_size_t* out_ext_id);
|
||
|
|
|
||
|
|
|
||
|
|
#endif /*INCLUDED_C_INDEXMAXPQ_H*/
|