liba 0.1.15
An algorithm library based on C/C++
|
Data Structures | |
struct | a_buf |
instance structure for basic buffer More... | |
Macros | |
#define | A_BUF_PTR(T, ctx) |
#define | A_BUF_AT_(T, ctx, idx) |
#define | A_BUF_AT(T, ctx, idx) |
#define | A_BUF_IDX(T, ctx, idx) |
#define | A_BUF_TOP_(T, ctx) |
#define | A_BUF_TOP(T, ctx) |
#define | A_BUF_END(T, ctx) |
#define | A_BUF_PUSH_SORT(T, ctx, key, cmp) |
#define | A_BUF_SEARCH(T, ctx, obj, cmp) |
#define | A_BUF_INSERT(T, ctx, idx) |
#define | A_BUF_REMOVE(T, ctx, idx) |
#define | A_BUF_PUSH_FORE(T, ctx) |
#define | A_BUF_PUSH_BACK(T, ctx) |
#define | A_BUF_PULL_FORE(T, ctx) |
#define | A_BUF_PULL_BACK(T, ctx) |
#define | A_BUF_PUSH(T, ctx) |
#define | A_BUF_PULL(T, ctx) |
#define | a_buf_forenum(i, ctx) |
iterate over a buffer | |
#define | a_buf_forenum_reverse(i, ctx) |
iterate over a buffer in reverse | |
#define | a_buf_foreach(T, P, it, ctx) |
iterate over a buffer | |
#define | a_buf_foreach_reverse(T, P, it, ctx) |
iterate over a buffer in reverse | |
Typedefs | |
typedef struct a_buf | a_buf |
instance structure for basic buffer | |
Functions | |
void * | a_buf_ptr (a_buf const *ctx) |
access address of buffer for a pointer to buffer structure | |
size_t | a_buf_siz (a_buf const *ctx) |
access size of a element for a pointer to buffer structure | |
size_t | a_buf_num (a_buf const *ctx) |
access number of element for a pointer to buffer structure | |
size_t | a_buf_mem (a_buf const *ctx) |
access memory of element for a pointer to buffer structure | |
void * | a_buf_at_ (a_buf const *ctx, size_t idx) |
access specified element for a pointer to buffer structure | |
void * | a_buf_at (a_buf const *ctx, size_t idx) |
access specified element for a pointer to buffer structure | |
void * | a_buf_idx (a_buf const *ctx, ptrdiff_t idx) |
access specified element for a pointer to buffer structure | |
void * | a_buf_top_ (a_buf const *ctx) |
access top element for a pointer to buffer structure | |
void * | a_buf_top (a_buf const *ctx) |
access top element for a pointer to buffer structure | |
void * | a_buf_end (a_buf const *ctx) |
access end pointer for a pointer to buffer structure | |
void | a_buf_ctor (a_buf *ctx, void *ptr, size_t siz, size_t num) |
constructor for buffer structure | |
void | a_buf_dtor (a_buf *ctx, void(*dtor)(void *)) |
destructor for buffer structure | |
void | a_buf_move (a_buf *ctx, a_buf *obj) |
initialize a pointer to buffer structure by moving | |
void | a_buf_drop (a_buf *ctx, void(*dtor)(void *)) |
drop all the elements for a pointer to buffer structure | |
void | a_buf_swap (a_buf const *ctx, size_t lhs, size_t rhs) |
swap elements lhs and rhs for a pointer to buffer structure | |
void | a_buf_sort (a_buf const *ctx, int(*cmp)(void const *, void const *)) |
sort all elements for a pointer to buffer structure | |
void | a_buf_sort_fore (a_buf const *ctx, int(*cmp)(void const *, void const *)) |
insert sort foremost element for a pointer to buffer structure | |
void | a_buf_sort_back (a_buf const *ctx, int(*cmp)(void const *, void const *)) |
insert sort backmost element for a pointer to buffer structure | |
void * | a_buf_push_sort (a_buf *ctx, void const *key, int(*cmp)(void const *, void const *)) |
push an element into the buffer and sort it | |
void * | a_buf_search (a_buf const *ctx, void const *obj, int(*cmp)(void const *, void const *)) |
search the given element in this buffer | |
void * | a_buf_insert (a_buf *ctx, size_t idx) |
insert an element into the buffer | |
void * | a_buf_remove (a_buf *ctx, size_t idx) |
remove an element from the buffer | |
void * | a_buf_push_fore (a_buf *ctx) |
push an element into the buffer forward | |
void * | a_buf_push_back (a_buf *ctx) |
push an element into the buffer backward | |
void * | a_buf_pull_fore (a_buf *ctx) |
pull an element from the buffer forward | |
void * | a_buf_pull_back (a_buf *ctx) |
pull an element from the buffer backward | |
void * | a_buf_push (a_buf *ctx) |
push an element into the buffer | |
void * | a_buf_pull (a_buf *ctx) |
pull an element from the buffer | |
#define A_BUF_AT | ( | T, | |
ctx, | |||
idx ) |
#define A_BUF_AT_ | ( | T, | |
ctx, | |||
idx ) |
#define A_BUF_END | ( | T, | |
ctx ) |
#define a_buf_foreach | ( | T, | |
P, | |||
it, | |||
ctx ) |
iterate over a buffer
T | the prefix of the element type |
P | the suffix of the element type |
it | the &a_buf to use as a loop counter |
ctx | points to an instance of buffer structure |
#define a_buf_foreach_reverse | ( | T, | |
P, | |||
it, | |||
ctx ) |
iterate over a buffer in reverse
T | the prefix of the element type |
P | the suffix of the element type |
it | the &a_buf to use as a loop counter |
ctx | points to an instance of buffer structure |
#define a_buf_forenum | ( | i, | |
ctx ) |
iterate over a buffer
i | index of elements in the buffer |
ctx | points to an instance of buffer structure |
#define a_buf_forenum_reverse | ( | i, | |
ctx ) |
iterate over a buffer in reverse
i | index of elements in the buffer |
ctx | points to an instance of buffer structure |
#define A_BUF_IDX | ( | T, | |
ctx, | |||
idx ) |
#define A_BUF_INSERT | ( | T, | |
ctx, | |||
idx ) |
#define A_BUF_PTR | ( | T, | |
ctx ) |
#define A_BUF_PULL | ( | T, | |
ctx ) |
#define A_BUF_PULL_BACK | ( | T, | |
ctx ) |
#define A_BUF_PULL_FORE | ( | T, | |
ctx ) |
#define A_BUF_PUSH | ( | T, | |
ctx ) |
#define A_BUF_PUSH_BACK | ( | T, | |
ctx ) |
#define A_BUF_PUSH_FORE | ( | T, | |
ctx ) |
#define A_BUF_PUSH_SORT | ( | T, | |
ctx, | |||
key, | |||
cmp ) |
#define A_BUF_REMOVE | ( | T, | |
ctx, | |||
idx ) |
#define A_BUF_SEARCH | ( | T, | |
ctx, | |||
obj, | |||
cmp ) |
#define A_BUF_TOP | ( | T, | |
ctx ) |
#define A_BUF_TOP_ | ( | T, | |
ctx ) |
void * a_buf_at | ( | a_buf const * | ctx, |
size_t | idx ) |
access specified element for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
[in] | idx | index of element less than memory |
0 | out of bounds |
void * a_buf_at_ | ( | a_buf const * | ctx, |
size_t | idx ) |
access specified element for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
[in] | idx | index of element less than memory |
void a_buf_ctor | ( | a_buf * | ctx, |
void * | ptr, | ||
size_t | siz, | ||
size_t | num ) |
constructor for buffer structure
[in] | ctx | points to an instance of buffer structure |
[in] | ptr | address of memory |
[in] | siz | size of a element |
[in] | num | number of element |
void a_buf_drop | ( | a_buf * | ctx, |
void(* | dtor )(void *) ) |
drop all the elements for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
[in] | dtor | current element destructor |
void a_buf_dtor | ( | a_buf * | ctx, |
void(* | dtor )(void *) ) |
destructor for buffer structure
[in] | ctx | points to an instance of buffer structure |
[in] | dtor | element destructor |
void * a_buf_end | ( | a_buf const * | ctx | ) |
access end pointer for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
void * a_buf_idx | ( | a_buf const * | ctx, |
ptrdiff_t | idx ) |
access specified element for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
[in] | idx | index of element -memory < idx < memory |
0 | out of bounds |
void * a_buf_insert | ( | a_buf * | ctx, |
size_t | idx ) |
insert an element into the buffer
[in] | ctx | points to an instance of buffer structure |
[in] | idx | index of element in this buffer
|
0 | failure |
size_t a_buf_mem | ( | a_buf const * | ctx | ) |
access memory of element for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
initialize a pointer to buffer structure by moving
[in] | ctx | points to an instance of buffer structure |
[in] | obj | input source pointing to an instance |
size_t a_buf_num | ( | a_buf const * | ctx | ) |
access number of element for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
void * a_buf_ptr | ( | a_buf const * | ctx | ) |
access address of buffer for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
void * a_buf_pull | ( | a_buf * | ctx | ) |
pull an element from the buffer
[in] | ctx | points to an instance of buffer structure |
0 | failure |
void * a_buf_pull_back | ( | a_buf * | ctx | ) |
pull an element from the buffer backward
[in] | ctx | points to an instance of buffer structure |
0 | failure |
void * a_buf_pull_fore | ( | a_buf * | ctx | ) |
pull an element from the buffer forward
[in] | ctx | points to an instance of buffer structure |
0 | failure |
void * a_buf_push | ( | a_buf * | ctx | ) |
push an element into the buffer
[in] | ctx | points to an instance of buffer structure |
0 | failure |
void * a_buf_push_back | ( | a_buf * | ctx | ) |
push an element into the buffer backward
[in] | ctx | points to an instance of buffer structure |
0 | failure |
void * a_buf_push_fore | ( | a_buf * | ctx | ) |
push an element into the buffer forward
[in] | ctx | points to an instance of buffer structure |
0 | failure |
void * a_buf_push_sort | ( | a_buf * | ctx, |
void const * | key, | ||
int(* | cmp )(void const *, void const *) ) |
push an element into the buffer and sort it
[in] | ctx | points to an instance of buffer structure |
[in] | key | the key on the right for insertion sort |
[in] | cmp | a function that compares two elements
|
0 | failure |
void * a_buf_remove | ( | a_buf * | ctx, |
size_t | idx ) |
remove an element from the buffer
[in] | ctx | points to an instance of buffer structure |
[in] | idx | index of element in this buffer
|
0 | failure |
void * a_buf_search | ( | a_buf const * | ctx, |
void const * | obj, | ||
int(* | cmp )(void const *, void const *) ) |
search the given element in this buffer
[in] | ctx | points to an instance of buffer structure |
[in] | obj | object that serves as key for the search |
[in] | cmp | a function that compares two elements
|
0 | failure |
size_t a_buf_siz | ( | a_buf const * | ctx | ) |
access size of a element for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
void a_buf_sort | ( | a_buf const * | ctx, |
int(* | cmp )(void const *, void const *) ) |
sort all elements for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
[in] | cmp | a function that compares two elements
|
void a_buf_sort_back | ( | a_buf const * | ctx, |
int(* | cmp )(void const *, void const *) ) |
insert sort backmost element for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
[in] | cmp | a function that compares two elements
|
void a_buf_sort_fore | ( | a_buf const * | ctx, |
int(* | cmp )(void const *, void const *) ) |
insert sort foremost element for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
[in] | cmp | a function that compares two elements
|
void a_buf_swap | ( | a_buf const * | ctx, |
size_t | lhs, | ||
size_t | rhs ) |
swap elements lhs and rhs for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
[in] | lhs | element index on the left |
[in] | rhs | element index on the right |
void * a_buf_top | ( | a_buf const * | ctx | ) |
access top element for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |
0 | empty buffer |
void * a_buf_top_ | ( | a_buf const * | ctx | ) |
access top element for a pointer to buffer structure
[in] | ctx | points to an instance of buffer structure |