Classes | |
struct | ix_entry_t |
Defines | |
#define | ix_stack_new(b, c) ix_list_new( NULL, (b), (c) ) |
new stack | |
#define | ix_stack_free(a) ix_list_free((a)) |
free stack | |
#define | ix_stack_push ix_list_insert |
put element on stack | |
#define | ix_stack_pop ix_list_last |
pop element from stack | |
#define | ix_queue_new(b, c) ix_list_new( NULL, (b), (c) ) |
new queue | |
#define | ix_queue_free(a) ix_list_free((a)) |
free queue | |
#define | ix_queue_add ix_list_add |
feed queue (overwrites oldest element if full) | |
#define | ix_queue_insert ix_list_insert |
feed queue (returns error if full) | |
#define | ix_queue_eat ix_list_first |
eat from queue | |
Typedefs | |
typedef int(*) | IX_LIST_CMP_FCT (const void *, const void *) |
compare function used for list ordering | |
typedef int(*) | IX_LIST_TRAVERSE_FCT (const void *, void *) |
function wich is called during list traversing called with entry and userdata, s. ix_list_traverse(), ix_list_traverse_del() | |
typedef ix_list_s | ix_list_t |
list class | |
typedef ix_list_s | ix_queue_t |
queue class | |
typedef ix_list_s | ix_stack_t |
stack class | |
typedef ix_hash_s | ix_hash_t |
hash pool class | |
typedef ix_rb_s | ix_rb_t |
ring buffer class | |
Enumerations | |
enum | ix_rb_e { IX_RB_DEFAULT, IX_RB_KEEP } |
Functions | |
ix_list_t * | ix_list_new (IX_LIST_CMP_FCT cmp, void *mem, size_t size) |
int | ix_list_lock (ix_list_t *plist) |
int | ix_list_unlock (ix_list_t *plist) |
void * | ix_list_search (ix_list_t *plist, void *ptr) |
int | ix_list_delete (ix_list_t *plist, void *ptr) |
int | ix_list_delete_ret (ix_list_t *plist, void *ptr, void **ret) |
int | ix_list_free (ix_list_t *plist) |
int | ix_list_sort (ix_list_t *plist) |
int | ix_list_insert (ix_list_t *plist, void *ptr) |
int | ix_list_add (ix_list_t *plist, void *ptr, void **pret) |
void * | ix_list_first (ix_list_t *plist) |
void * | ix_list_head (ix_list_t *plist) |
void * | ix_list_tail (ix_list_t *plist) |
void * | ix_list_last (ix_list_t *plist) |
int | ix_list_count (ix_list_t *plist) |
int | ix_list_overrun (ix_list_t *plist) |
int | ix_list_fills (ix_list_t *plist) |
int | ix_list_traverse (ix_list_t *plist, IX_LIST_TRAVERSE_FCT fct, void *arg) |
int | ix_list_traverse_del (ix_list_t *plist, IX_LIST_TRAVERSE_FCT fct, void *arg) |
ix_hash_t * | ix_hash_new (int nel) |
void | ix_hash_free (ix_hash_t *ph) |
int | ix_hash_add (ix_hash_t *ph, char *key, void *data, void **retdata) |
void * | ix_hash_find (ix_hash_t *ph, char *key) |
ix_rb_t * | ix_rb_new (size_t len, int flag) |
int | ix_rb_read (ix_rb_t *prb, char *buf, int len) |
int | ix_rb_write (ix_rb_t *prb, char *buf, int len) |
void | ix_rb_free (ix_rb_t *prb) |
int | ix_rb_no (ix_rb_t *prb) |
typedef struct ix_hash_s ix_hash_t |
hash pool class
A hash pool is a set of key - data pairs for fast key search.
typedef struct ix_list_s ix_list_t |
list class
A class to store void pointers, not more. But you can specify a compare function to sort this pointers, s. IX_LIST_CMP_FCT and find an entry. The list functions are thread-safe. The following queue and stack classes are realised with ix_list_t.
typedef struct ix_list_s ix_queue_t |
queue class
s. ix_list_t
typedef struct ix_rb_s ix_rb_t |
ring buffer class
"Ring buffer" is realized as a fixed maximum length byte queue. You can add bytes to the end and read bytes from the head of the queue. By creation you have to give the maximum size and the type ix_rb_e of the queue. The type specifies wether it is a real ring (default), i.e. old data is overwritten when the queue becomes full.
typedef struct ix_list_s ix_stack_t |
stack class
s. ix_list_t
enum ix_rb_e |
int ix_hash_add | ( | ix_hash_t * | ph, | |
char * | key, | |||
void * | data, | |||
void ** | retdata | |||
) |
adds new data with key to hash pool ph, if key already exists data is overwritten and pointer returned in retdata
ph | handle for hash pool | |
key | key of entry | |
data | pointer to userdata | |
retdata | existing data is retrieved in retdata |
void* ix_hash_find | ( | ix_hash_t * | ph, | |
char * | key | |||
) |
finds data with key in hash pool ph
ph | handle for hash pool | |
key | key to look for |
void ix_hash_free | ( | ix_hash_t * | ph | ) |
destructor, frees hash pool
ph | handle for hash pool |
ix_hash_t* ix_hash_new | ( | int | nel | ) |
constructor, creates new hash pool
nel | estimated number of entries (increased internally) |
int ix_list_add | ( | ix_list_t * | plist, | |
void * | ptr, | |||
void ** | pret | |||
) |
Add a new element to end of list; if maximal size is reached, the first element is deleted (queue)
plist | List handle | |
ptr | elment to add | |
ret | where overwritten element is saved, NULL if not desired |
int ix_list_count | ( | ix_list_t * | plist | ) |
Gets number of elements in list
plist | List handle |
int ix_list_delete | ( | ix_list_t * | plist, | |
void * | ptr | |||
) |
delete an element from list
plist | List handle | |
ptr | element to supply compare function |
int ix_list_delete_ret | ( | ix_list_t * | plist, | |
void * | ptr, | |||
void ** | ret | |||
) |
delete and retrieve element from list
plist | List handle | |
ptr | element to supply compare function | |
ret | deleted element |
int ix_list_fills | ( | ix_list_t * | plist | ) |
gets number of insertions into list
plist | List handle |
void* ix_list_first | ( | ix_list_t * | plist | ) |
gets the first entry and deletes it from list
plist | List handle |
int ix_list_free | ( | ix_list_t * | plist | ) |
free whole list (of course not the entries)
plist | List handle |
void* ix_list_head | ( | ix_list_t * | plist | ) |
gets the first entry
plist | List handle |
int ix_list_insert | ( | ix_list_t * | plist, | |
void * | ptr | |||
) |
Insert a new element at proper place
plist | List handle | |
ptr | elment to insert |
void* ix_list_last | ( | ix_list_t * | plist | ) |
gets the last entry and deletes it from list
plist | List handle |
int ix_list_lock | ( | ix_list_t * | plist | ) |
list is blocked for other threads
plist | List handle |
ix_list_t* ix_list_new | ( | IX_LIST_CMP_FCT | cmp, | |
void * | mem, | |||
size_t | size | |||
) |
constructor, creates new empty list cmp==NULL: unsorted list or queue or stack insert: pointer to data retrieve: pointer to data
cmp | compare function | |
mem | memory pointer taken for list, if mem = NULL the memory for number size element entries is allocated, otherwise mem of size(in bytes) is used | |
size | see paramter mem |
int ix_list_overrun | ( | ix_list_t * | plist | ) |
gets number of overruns for queue-lists
plist | List handle |
void* ix_list_search | ( | ix_list_t * | plist, | |
void * | ptr | |||
) |
search for a list element, see compare function supplied with ix_list_new()
plist | List handle | |
ptr | element to supply compare function |
int ix_list_sort | ( | ix_list_t * | plist | ) |
sort list
plist | List handle |
void* ix_list_tail | ( | ix_list_t * | plist | ) |
gets the last entry
plist | List handle |
int ix_list_traverse | ( | ix_list_t * | plist, | |
IX_LIST_TRAVERSE_FCT | fct, | |||
void * | arg | |||
) |
traverses list and calls fct with element and arg
plist | List handle | |
fct | user function to call. If fct returns < 0 the scan is interrupted. | |
arg | user argument for fct |
int ix_list_traverse_del | ( | ix_list_t * | plist, | |
IX_LIST_TRAVERSE_FCT | fct, | |||
void * | arg | |||
) |
traverses list and calls for each list entry fct with list entry and arg
plist | List handle | |
fct | user function to call.
| |
arg | user argument for fct |
int ix_list_unlock | ( | ix_list_t * | plist | ) |
list is unblocked for other threads
plist | List handle |
void ix_rb_free | ( | ix_rb_t * | prb | ) |
Destructor, frees memory of ringbuffer
prb | handle of ring buffer |
ix_rb_t* ix_rb_new | ( | size_t | len, | |
int | flag | |||
) |
Constructor, creates a new ring buffer of size len
len | maximal size of the queue | |
flag | specify type of ring buffer |
int ix_rb_no | ( | ix_rb_t * | prb | ) |
returns number of bytes in ring buffer
prb | handle of ring buffer |
int ix_rb_read | ( | ix_rb_t * | prb, | |
char * | buf, | |||
int | len | |||
) |
reads max len bytes from ringbuffer prb,
prb | handle of ring buffer | |
buf | buffer to store data | |
len | max number of bytes to read |
int ix_rb_write | ( | ix_rb_t * | prb, | |
char * | buf, | |||
int | len | |||
) |
Writes len bytes of buffer to ringbuffer
prb | handle of ring buffer | |
buf | buffer with data to write | |
len | number of bytes to write to ringbuffer |