liba 0.1.15
An algorithm library based on C/C++
|
Data Structures | |
struct | a_vec |
instance structure for basic vector More... | |
Macros | |
#define | A_VEC_PTR(T, ctx) |
#define | A_VEC_AT_(T, ctx, idx) |
#define | A_VEC_AT(T, ctx, idx) |
#define | A_VEC_IDX(T, ctx, idx) |
#define | A_VEC_TOP_(T, ctx) |
#define | A_VEC_TOP(T, ctx) |
#define | A_VEC_END_(T, ctx) |
#define | A_VEC_END(T, ctx) |
#define | A_VEC_PUSH_SORT(T, ctx, key, cmp) |
#define | A_VEC_SEARCH(T, ctx, obj, cmp) |
#define | A_VEC_INSERT(T, ctx, idx) |
#define | A_VEC_REMOVE(T, ctx, idx) |
#define | A_VEC_PUSH_FORE(T, ctx) |
#define | A_VEC_PUSH_BACK(T, ctx) |
#define | A_VEC_PULL_FORE(T, ctx) |
#define | A_VEC_PULL_BACK(T, ctx) |
#define | A_VEC_PUSH(T, ctx) |
#define | A_VEC_PULL(T, ctx) |
#define | a_vec_forenum(i, ctx) |
iterate over a vector | |
#define | a_vec_forenum_reverse(i, ctx) |
iterate over a vector in reverse | |
#define | a_vec_foreach(T, P, it, ctx) |
iterate over a vector | |
#define | a_vec_foreach_reverse(T, P, it, ctx) |
iterate over a vector in reverse | |
Typedefs | |
typedef struct a_vec | a_vec |
instance structure for basic vector | |
Functions | |
void * | a_vec_ptr (a_vec const *ctx) |
access address of vector for a pointer to vector structure | |
size_t | a_vec_siz (a_vec const *ctx) |
access size of a element for a pointer to vector structure | |
size_t | a_vec_num (a_vec const *ctx) |
access number of element for a pointer to vector structure | |
size_t | a_vec_mem (a_vec const *ctx) |
access memory of element for a pointer to vector structure | |
void * | a_vec_at_ (a_vec const *ctx, size_t idx) |
access specified element for a pointer to vector structure | |
void * | a_vec_at (a_vec const *ctx, size_t idx) |
access specified element for a pointer to vector structure | |
void * | a_vec_idx (a_vec const *ctx, ptrdiff_t idx) |
access specified element for a pointer to vector structure | |
void * | a_vec_top_ (a_vec const *ctx) |
access top element for a pointer to vector structure | |
void * | a_vec_top (a_vec const *ctx) |
access top element for a pointer to vector structure | |
void * | a_vec_end_ (a_vec const *ctx) |
access end pointer for a pointer to vector structure | |
void * | a_vec_end (a_vec const *ctx) |
access end pointer for a pointer to vector structure | |
a_vec * | a_vec_new (size_t size) |
allocate a pointer to vector structure from memory | |
void | a_vec_die (a_vec *ctx, void(*dtor)(void *)) |
deallocate a pointer to vector structure | |
void | a_vec_ctor (a_vec *ctx, size_t size) |
constructor for vector structure | |
void | a_vec_dtor (a_vec *ctx, void(*dtor)(void *)) |
destructor for vector structure | |
int | a_vec_copy (a_vec *ctx, a_vec const *obj, int(*dup)(void *, void const *)) |
initialize a pointer to vector structure by copying | |
void | a_vec_move (a_vec *ctx, a_vec *obj) |
initialize a pointer to vector structure by moving | |
void | a_vec_edit (a_vec *ctx, size_t size, void(*dtor)(void *)) |
edit size of a element for a pointer to vector structure | |
int | a_vec_make (a_vec *ctx, size_t num, void(*dtor)(void *)) |
modify element number for a pointer to string structure | |
void | a_vec_drop (a_vec *ctx, void(*dtor)(void *)) |
drop all the elements for a pointer to vector structure | |
void | a_vec_swap (a_vec const *ctx, size_t lhs, size_t rhs) |
swap elements lhs and rhs for a pointer to vector structure | |
void | a_vec_sort (a_vec const *ctx, int(*cmp)(void const *, void const *)) |
sort all elements for a pointer to vector structure | |
void | a_vec_sort_fore (a_vec const *ctx, int(*cmp)(void const *, void const *)) |
insert sort foremost element for a pointer to vector structure | |
void | a_vec_sort_back (a_vec const *ctx, int(*cmp)(void const *, void const *)) |
insert sort backmost element for a pointer to vector structure | |
void * | a_vec_push_sort (a_vec *ctx, void const *key, int(*cmp)(void const *, void const *)) |
push an element into the vector and sort it | |
void * | a_vec_search (a_vec const *ctx, void const *obj, int(*cmp)(void const *, void const *)) |
search the given element in this vector | |
void * | a_vec_insert (a_vec *ctx, size_t idx) |
insert an element into the vector | |
void * | a_vec_remove (a_vec *ctx, size_t idx) |
remove an element from the vector | |
void * | a_vec_push_fore (a_vec *ctx) |
push an element into the vector forward | |
void * | a_vec_push_back (a_vec *ctx) |
push an element into the vector backward | |
void * | a_vec_pull_fore (a_vec *ctx) |
pull an element from the vector forward | |
void * | a_vec_pull_back (a_vec *ctx) |
pull an element from the vector backward | |
void * | a_vec_push (a_vec *ctx) |
push an element into the vector | |
void * | a_vec_pull (a_vec *ctx) |
pull an element from the vector | |
#define A_VEC_AT | ( | T, | |
ctx, | |||
idx ) |
#define A_VEC_AT_ | ( | T, | |
ctx, | |||
idx ) |
#define A_VEC_END | ( | T, | |
ctx ) |
#define A_VEC_END_ | ( | T, | |
ctx ) |
#define a_vec_foreach | ( | T, | |
P, | |||
it, | |||
ctx ) |
iterate over a vector
T | the prefix of the element type |
P | the suffix of the element type |
it | the &a_vec to use as a loop counter |
ctx | points to an instance of vector structure |
#define a_vec_foreach_reverse | ( | T, | |
P, | |||
it, | |||
ctx ) |
iterate over a vector in reverse
T | the prefix of the element type |
P | the suffix of the element type |
it | the &a_vec to use as a loop counter |
ctx | points to an instance of vector structure |
#define a_vec_forenum | ( | i, | |
ctx ) |
iterate over a vector
i | index of elements in the vector |
ctx | points to an instance of vector structure |
#define a_vec_forenum_reverse | ( | i, | |
ctx ) |
iterate over a vector in reverse
i | index of elements in the vector |
ctx | points to an instance of vector structure |
#define A_VEC_IDX | ( | T, | |
ctx, | |||
idx ) |
#define A_VEC_INSERT | ( | T, | |
ctx, | |||
idx ) |
#define A_VEC_PTR | ( | T, | |
ctx ) |
#define A_VEC_PULL | ( | T, | |
ctx ) |
#define A_VEC_PULL_BACK | ( | T, | |
ctx ) |
#define A_VEC_PULL_FORE | ( | T, | |
ctx ) |
#define A_VEC_PUSH | ( | T, | |
ctx ) |
#define A_VEC_PUSH_BACK | ( | T, | |
ctx ) |
#define A_VEC_PUSH_FORE | ( | T, | |
ctx ) |
#define A_VEC_PUSH_SORT | ( | T, | |
ctx, | |||
key, | |||
cmp ) |
#define A_VEC_REMOVE | ( | T, | |
ctx, | |||
idx ) |
#define A_VEC_SEARCH | ( | T, | |
ctx, | |||
obj, | |||
cmp ) |
#define A_VEC_TOP | ( | T, | |
ctx ) |
#define A_VEC_TOP_ | ( | T, | |
ctx ) |
void * a_vec_at | ( | a_vec const * | ctx, |
size_t | idx ) |
access specified element for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
[in] | idx | index of element less than memory |
0 | out of bounds |
void * a_vec_at_ | ( | a_vec const * | ctx, |
size_t | idx ) |
access specified element for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
[in] | idx | index of element less than memory |
initialize a pointer to vector structure by copying
[in] | ctx | points to an instance of vector structure |
[in] | obj | input source pointing to an instance |
[in] | dup | a function that copies elements
|
0 | success |
1 | failure |
void a_vec_ctor | ( | a_vec * | ctx, |
size_t | size ) |
constructor for vector structure
[in] | ctx | points to an instance of vector structure |
[in] | size | size of element |
void a_vec_die | ( | a_vec * | ctx, |
void(* | dtor )(void *) ) |
deallocate a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
[in] | dtor | element destructor |
void a_vec_drop | ( | a_vec * | ctx, |
void(* | dtor )(void *) ) |
drop all the elements for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
[in] | dtor | current element destructor |
void a_vec_dtor | ( | a_vec * | ctx, |
void(* | dtor )(void *) ) |
destructor for vector structure
[in] | ctx | points to an instance of vector structure |
[in] | dtor | element destructor |
void a_vec_edit | ( | a_vec * | ctx, |
size_t | size, | ||
void(* | dtor )(void *) ) |
edit size of a element for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
[in] | size | the size of the new element |
[in] | dtor | previous element destructor |
void * a_vec_end | ( | a_vec const * | ctx | ) |
access end pointer for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
0 | empty vector |
void * a_vec_end_ | ( | a_vec const * | ctx | ) |
access end pointer for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
void * a_vec_idx | ( | a_vec const * | ctx, |
ptrdiff_t | idx ) |
access specified element for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
[in] | idx | index of element -memory < idx < memory |
0 | out of bounds |
void * a_vec_insert | ( | a_vec * | ctx, |
size_t | idx ) |
insert an element into the vector
[in] | ctx | points to an instance of vector structure |
[in] | idx | index of element in this vector
|
0 | failure |
int a_vec_make | ( | a_vec * | ctx, |
size_t | num, | ||
void(* | dtor )(void *) ) |
modify element number for a pointer to string structure
[in] | ctx | points to an instance of string structure |
[in] | num | number of all elements in the vector |
[in] | dtor | previous element destructor |
0 | success |
1 | failure |
size_t a_vec_mem | ( | a_vec const * | ctx | ) |
access memory of element for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
initialize a pointer to vector structure by moving
[in] | ctx | points to an instance of vector structure |
[in] | obj | input source pointing to an instance |
a_vec * a_vec_new | ( | size_t | size | ) |
allocate a pointer to vector structure from memory
[in] | size | size of element |
size_t a_vec_num | ( | a_vec const * | ctx | ) |
access number of element for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
void * a_vec_ptr | ( | a_vec const * | ctx | ) |
access address of vector for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
void * a_vec_pull | ( | a_vec * | ctx | ) |
pull an element from the vector
[in] | ctx | points to an instance of vector structure |
0 | failure |
void * a_vec_pull_back | ( | a_vec * | ctx | ) |
pull an element from the vector backward
[in] | ctx | points to an instance of vector structure |
0 | failure |
void * a_vec_pull_fore | ( | a_vec * | ctx | ) |
pull an element from the vector forward
[in] | ctx | points to an instance of vector structure |
0 | failure |
void * a_vec_push | ( | a_vec * | ctx | ) |
push an element into the vector
[in] | ctx | points to an instance of vector structure |
0 | failure |
void * a_vec_push_back | ( | a_vec * | ctx | ) |
push an element into the vector backward
[in] | ctx | points to an instance of vector structure |
0 | failure |
void * a_vec_push_fore | ( | a_vec * | ctx | ) |
push an element into the vector forward
[in] | ctx | points to an instance of vector structure |
0 | failure |
void * a_vec_push_sort | ( | a_vec * | ctx, |
void const * | key, | ||
int(* | cmp )(void const *, void const *) ) |
push an element into the vector and sort it
[in] | ctx | points to an instance of vector structure |
[in] | key | the key on the right for insertion sort |
[in] | cmp | a function that compares two elements
|
0 | failure |
void * a_vec_remove | ( | a_vec * | ctx, |
size_t | idx ) |
remove an element from the vector
[in] | ctx | points to an instance of vector structure |
[in] | idx | index of element in this vector
|
0 | failure |
void * a_vec_search | ( | a_vec const * | ctx, |
void const * | obj, | ||
int(* | cmp )(void const *, void const *) ) |
search the given element in this vector
[in] | ctx | points to an instance of vector structure |
[in] | obj | object that serves as key for the search |
[in] | cmp | a function that compares two elements
|
0 | failure |
size_t a_vec_siz | ( | a_vec const * | ctx | ) |
access size of a element for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
void a_vec_sort | ( | a_vec const * | ctx, |
int(* | cmp )(void const *, void const *) ) |
sort all elements for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
[in] | cmp | a function that compares two elements
|
void a_vec_sort_back | ( | a_vec const * | ctx, |
int(* | cmp )(void const *, void const *) ) |
insert sort backmost element for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
[in] | cmp | a function that compares two elements
|
void a_vec_sort_fore | ( | a_vec const * | ctx, |
int(* | cmp )(void const *, void const *) ) |
insert sort foremost element for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
[in] | cmp | a function that compares two elements
|
void a_vec_swap | ( | a_vec const * | ctx, |
size_t | lhs, | ||
size_t | rhs ) |
swap elements lhs and rhs for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
[in] | lhs | element index on the left |
[in] | rhs | element index on the right |
void * a_vec_top | ( | a_vec const * | ctx | ) |
access top element for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |
0 | empty vector |
void * a_vec_top_ | ( | a_vec const * | ctx | ) |
access top element for a pointer to vector structure
[in] | ctx | points to an instance of vector structure |