FEMU  原版 master 7e238cc
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
pqueue.h 文件参考

Priority Queue function declarations 更多...

此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  pqueue_t
 
typedef unsigned long long pqueue_pri_t
 
typedef pqueue_pri_t(* pqueue_get_pri_f) (void *a)
 
typedef void(* pqueue_set_pri_f) (void *a, pqueue_pri_t pri)
 
typedef int(* pqueue_cmp_pri_f) (pqueue_pri_t next, pqueue_pri_t curr)
 
typedef size_t(* pqueue_get_pos_f) (void *a)
 
typedef void(* pqueue_set_pos_f) (void *a, size_t pos)
 
typedef void(* pqueue_print_entry_f) (FILE *out, void *a)
 
typedef struct pqueue_t pqueue_t
 
pqueue_tpqueue_init (size_t n, pqueue_cmp_pri_f cmppri, pqueue_get_pri_f getpri, pqueue_set_pri_f setpri, pqueue_get_pos_f getpos, pqueue_set_pos_f setpos)
 
void pqueue_free (pqueue_t *q)
 
size_t pqueue_size (pqueue_t *q)
 
int pqueue_insert (pqueue_t *q, void *d)
 
void pqueue_change_priority (pqueue_t *q, pqueue_pri_t new_pri, void *d)
 
void * pqueue_pop (pqueue_t *q)
 
int pqueue_remove (pqueue_t *q, void *d)
 
void * pqueue_peek (pqueue_t *q)
 
void pqueue_print (pqueue_t *q, FILE *out, pqueue_print_entry_f print)
 
void pqueue_dump (pqueue_t *q, FILE *out, pqueue_print_entry_f print)
 
int pqueue_is_valid (pqueue_t *q)
 

详细描述

Priority Queue function declarations

类型定义说明

◆ pqueue_cmp_pri_f

typedef int(* pqueue_cmp_pri_f) (pqueue_pri_t next, pqueue_pri_t curr)

◆ pqueue_get_pos_f

typedef size_t(* pqueue_get_pos_f) (void *a)

callback functions to get/set the position of an element

◆ pqueue_get_pri_f

typedef pqueue_pri_t(* pqueue_get_pri_f) (void *a)

callback functions to get/set/compare the priority of an element

◆ pqueue_pri_t

typedef unsigned long long pqueue_pri_t

priority data type

◆ pqueue_print_entry_f

typedef void(* pqueue_print_entry_f) (FILE *out, void *a)

debug callback function to print a entry

◆ pqueue_set_pos_f

typedef void(* pqueue_set_pos_f) (void *a, size_t pos)

◆ pqueue_set_pri_f

typedef void(* pqueue_set_pri_f) (void *a, pqueue_pri_t pri)

◆ pqueue_t

typedef struct pqueue_t pqueue_t

the priority queue handle

函数说明

◆ pqueue_change_priority()

void pqueue_change_priority ( pqueue_t q,
pqueue_pri_t  new_pri,
void *  d 
)

move an existing entry to a different priority

参数
qthe queue
new_prithe new priority
dthe entry
函数调用图:
这是这个函数的调用关系图:

◆ pqueue_dump()

void pqueue_dump ( pqueue_t q,
FILE *  out,
pqueue_print_entry_f  print 
)

dump the queue and it's internal structure

函数调用图:

◆ pqueue_free()

void pqueue_free ( pqueue_t q)

free all memory used by the queue

参数
qthe queue
这是这个函数的调用关系图:

◆ pqueue_init()

pqueue_t* pqueue_init ( size_t  n,
pqueue_cmp_pri_f  cmppri,
pqueue_get_pri_f  getpri,
pqueue_set_pri_f  setpri,
pqueue_get_pos_f  getpos,
pqueue_set_pos_f  setpos 
)

initialize the queue

参数
nthe initial estimate of the number of queue items for which memory should be preallocated
cmppriThe callback function to run to compare two elements This callback should return 0 for 'lower' and non-zero for 'higher', or vice versa if reverse priority is desired
setprithe callback function to run to assign a score to an element
getprithe callback function to run to set a score to an element
getposthe callback function to get the current element's position
setposthe callback function to set the current element's position
返回
the handle or NULL for insufficent memory
这是这个函数的调用关系图:

◆ pqueue_insert()

int pqueue_insert ( pqueue_t q,
void *  d 
)

insert an item into the queue.

参数
qthe queue
dthe item
返回
0 on success
函数调用图:
这是这个函数的调用关系图:

◆ pqueue_is_valid()

int pqueue_is_valid ( pqueue_t q)

checks that the pq is in the right order, etc

函数调用图:

◆ pqueue_peek()

void* pqueue_peek ( pqueue_t q)

access highest-ranking item without removing it.

参数
qthe queue
返回
NULL on error, otherwise the entry
这是这个函数的调用关系图:

◆ pqueue_pop()

void* pqueue_pop ( pqueue_t q)

pop the highest-ranking item from the queue.

参数
qthe queue
返回
NULL on error, otherwise the entry
函数调用图:
这是这个函数的调用关系图:

◆ pqueue_print()

void pqueue_print ( pqueue_t q,
FILE *  out,
pqueue_print_entry_f  print 
)

print the queue

函数调用图:

◆ pqueue_remove()

int pqueue_remove ( pqueue_t q,
void *  d 
)

remove an item from the queue.

参数
qthe queue
dthe entry
返回
0 on success
函数调用图:

◆ pqueue_size()

size_t pqueue_size ( pqueue_t q)

return the size of the queue.

参数
qthe queue
这是这个函数的调用关系图: