liba 0.1.15
An algorithm library based on C/C++
|
Data Structures | |
struct | a_que |
instance structure for basic queue More... | |
Macros | |
#define | A_QUE_FORE_(T, ctx) |
#define | A_QUE_BACK_(T, ctx) |
#define | A_QUE_FORE(T, ctx) |
#define | A_QUE_BACK(T, ctx) |
#define | A_QUE_AT(T, ctx, idx) |
#define | A_QUE_PUSH_SORT(T, ctx, key, cmp) |
#define | A_QUE_PUSH_FORE(T, ctx) |
#define | A_QUE_PUSH_BACK(T, ctx) |
#define | A_QUE_PULL_FORE(T, ctx) |
#define | A_QUE_PULL_BACK(T, ctx) |
#define | A_QUE_INSERT(T, ctx, idx) |
#define | A_QUE_REMOVE(T, ctx, idx) |
#define | a_que_foreach(T, P, it, ctx) |
iterate over a queue | |
#define | a_que_foreach_reverse(T, P, it, ctx) |
iterate over a queue in reverse | |
Typedefs | |
typedef struct a_que | a_que |
instance structure for basic queue | |
Functions | |
size_t | a_que_siz (a_que const *ctx) |
access size of a element for a pointer to queue structure | |
size_t | a_que_num (a_que const *ctx) |
access number of element for a pointer to queue structure | |
void * | a_que_fore_ (a_que const *ctx) |
access foremost element for a pointer to queue structure | |
void * | a_que_back_ (a_que const *ctx) |
access backmost element for a pointer to queue structure | |
void * | a_que_fore (a_que const *ctx) |
access foremost element for a pointer to queue structure | |
void * | a_que_back (a_que const *ctx) |
access backmost element for a pointer to queue structure | |
void | a_que_swap_ (void *lhs, void *rhs) |
swap elements lhs and rhs for a pointer to queue structure | |
a_que * | a_que_new (size_t size) |
allocate a pointer to queue structure from memory | |
void | a_que_die (a_que *ctx, void(*dtor)(void *)) |
deallocate a pointer to queue structure | |
void | a_que_ctor (a_que *ctx, size_t size) |
constructor for queue structure | |
void | a_que_dtor (a_que *ctx, void(*dtor)(void *)) |
destructor for queue structure | |
void | a_que_move (a_que *ctx, a_que *obj) |
initialize a pointer to queue structure by moving | |
void * | a_que_at (a_que const *ctx, ptrdiff_t idx) |
access specified element for a pointer to queue structure | |
int | a_que_drop (a_que *ctx, void(*dtor)(void *)) |
drop all the elements for a pointer to queue structure | |
int | a_que_edit (a_que *ctx, size_t size, void(*dtor)(void *)) |
edit size of a element for a pointer to queue structure | |
int | a_que_swap (a_que const *ctx, size_t lhs, size_t rhs) |
swap elements lhs and rhs for a pointer to queue structure | |
void | a_que_sort_fore (a_que const *ctx, int(*cmp)(void const *, void const *)) |
insert sort foremost element for a pointer to queue structure | |
void | a_que_sort_back (a_que const *ctx, int(*cmp)(void const *, void const *)) |
insert sort backmost element for a pointer to queue structure | |
void * | a_que_push_sort (a_que *ctx, void const *key, int(*cmp)(void const *, void const *)) |
push an element into the queue and sort it | |
void * | a_que_push_fore (a_que *ctx) |
push an element into the queue forward | |
void * | a_que_push_back (a_que *ctx) |
push an element into the queue backward | |
void * | a_que_pull_fore (a_que *ctx) |
pull an element from the queue forward | |
void * | a_que_pull_back (a_que *ctx) |
pull an element from the queue backward | |
void * | a_que_insert (a_que *ctx, size_t idx) |
insert an element into the queue | |
void * | a_que_remove (a_que *ctx, size_t idx) |
remove an element from the queue | |
#define A_QUE_AT | ( | T, | |
ctx, | |||
idx ) |
#define A_QUE_BACK | ( | T, | |
ctx ) |
#define A_QUE_BACK_ | ( | T, | |
ctx ) |
#define A_QUE_FORE | ( | T, | |
ctx ) |
#define A_QUE_FORE_ | ( | T, | |
ctx ) |
#define a_que_foreach | ( | T, | |
P, | |||
it, | |||
ctx ) |
iterate over a queue
T | the prefix of the element type |
P | the suffix of the element type |
it | the &a_que to use as a loop counter |
ctx | points to an instance of queue structure |
#define a_que_foreach_reverse | ( | T, | |
P, | |||
it, | |||
ctx ) |
iterate over a queue in reverse
T | the prefix of the element type |
P | the suffix of the element type |
it | the &a_que to use as a loop counter |
ctx | points to an instance of queue structure |
#define A_QUE_INSERT | ( | T, | |
ctx, | |||
idx ) |
#define A_QUE_PULL_BACK | ( | T, | |
ctx ) |
#define A_QUE_PULL_FORE | ( | T, | |
ctx ) |
#define A_QUE_PUSH_BACK | ( | T, | |
ctx ) |
#define A_QUE_PUSH_FORE | ( | T, | |
ctx ) |
#define A_QUE_PUSH_SORT | ( | T, | |
ctx, | |||
key, | |||
cmp ) |
#define A_QUE_REMOVE | ( | T, | |
ctx, | |||
idx ) |
void * a_que_at | ( | a_que const * | ctx, |
ptrdiff_t | idx ) |
access specified element for a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
[in] | idx | index of element, 0 ~ n-1, -n ~ -1 |
0 | out of bounds |
void * a_que_back | ( | a_que const * | ctx | ) |
access backmost element for a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
0 | empty queue |
void * a_que_back_ | ( | a_que const * | ctx | ) |
access backmost element for a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
void a_que_ctor | ( | a_que * | ctx, |
size_t | size ) |
constructor for queue structure
[in] | ctx | points to an instance of queue structure |
[in] | size | size of element |
void a_que_die | ( | a_que * | ctx, |
void(* | dtor )(void *) ) |
deallocate a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
[in] | dtor | element destructor |
int a_que_drop | ( | a_que * | ctx, |
void(* | dtor )(void *) ) |
drop all the elements for a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
[in] | dtor | current element destructor |
0 | success |
1 | failure |
void a_que_dtor | ( | a_que * | ctx, |
void(* | dtor )(void *) ) |
destructor for queue structure
[in] | ctx | points to an instance of queue structure |
[in] | dtor | element destructor |
int a_que_edit | ( | a_que * | ctx, |
size_t | size, | ||
void(* | dtor )(void *) ) |
edit size of a element for a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
[in] | size | the size of the new element |
[in] | dtor | previous element destructor |
0 | success |
1 | failure |
void * a_que_fore | ( | a_que const * | ctx | ) |
access foremost element for a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
0 | empty queue |
void * a_que_fore_ | ( | a_que const * | ctx | ) |
access foremost element for a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
void * a_que_insert | ( | a_que * | ctx, |
size_t | idx ) |
insert an element into the queue
[in] | ctx | points to an instance of queue structure |
[in] | idx | index of element in this queue
|
0 | failure |
initialize a pointer to queue structure by moving
[in] | ctx | points to an instance of queue structure |
[in] | obj | input source pointing to an instance |
a_que * a_que_new | ( | size_t | size | ) |
allocate a pointer to queue structure from memory
[in] | size | size of element |
size_t a_que_num | ( | a_que const * | ctx | ) |
access number of element for a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
void * a_que_pull_back | ( | a_que * | ctx | ) |
pull an element from the queue backward
[in] | ctx | points to an instance of queue structure |
0 | failure |
void * a_que_pull_fore | ( | a_que * | ctx | ) |
pull an element from the queue forward
[in] | ctx | points to an instance of queue structure |
0 | failure |
void * a_que_push_back | ( | a_que * | ctx | ) |
push an element into the queue backward
[in] | ctx | points to an instance of queue structure |
0 | failure |
void * a_que_push_fore | ( | a_que * | ctx | ) |
push an element into the queue forward
[in] | ctx | points to an instance of queue structure |
0 | failure |
void * a_que_push_sort | ( | a_que * | ctx, |
void const * | key, | ||
int(* | cmp )(void const *, void const *) ) |
push an element into the queue and sort it
[in] | ctx | points to an instance of queue structure |
[in] | key | the key on the right for insertion sort |
[in] | cmp | a function that compares two elements
|
0 | failure |
void * a_que_remove | ( | a_que * | ctx, |
size_t | idx ) |
remove an element from the queue
[in] | ctx | points to an instance of queue structure |
[in] | idx | index of element in this queue
|
0 | failure |
size_t a_que_siz | ( | a_que const * | ctx | ) |
access size of a element for a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
void a_que_sort_back | ( | a_que const * | ctx, |
int(* | cmp )(void const *, void const *) ) |
insert sort backmost element for a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
[in] | cmp | a function that compares two elements
|
void a_que_sort_fore | ( | a_que const * | ctx, |
int(* | cmp )(void const *, void const *) ) |
insert sort foremost element for a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
[in] | cmp | a function that compares two elements
|
int a_que_swap | ( | a_que const * | ctx, |
size_t | lhs, | ||
size_t | rhs ) |
swap elements lhs and rhs for a pointer to queue structure
[in] | ctx | points to an instance of queue structure |
[in] | lhs | element index on the left |
[in] | rhs | element index on the right |
0 | success |
1 | failure |
void a_que_swap_ | ( | void * | lhs, |
void * | rhs ) |
swap elements lhs and rhs for a pointer to queue structure
[in] | lhs | element pointer on the left |
[in] | rhs | element pointer on the right |