Main Page | Modules | Class Hierarchy | Data Structures | File List | Data Fields | Globals | Related Pages

iarray.h File Reference


Detailed Description

Resizable array of indirect elements of any size.

Author:
benjamin gerard
Date:
2002/10/22
Id
iarray.h,v 1.6 2003/04/05 16:33:30 ben Exp

#include "mutex.h"

Go to the source code of this file.

Data Structures

struct  iarray_elt_t
 Array element. More...

struct  iarray_t
 Array definition. More...


Typedefs

typedef void *(* iarray_alloc_f )(unsigned int size, void *cookie)
 User provided allocation function.

typedef void(* iarray_free_f )(void *addr, void *cookie)
 User provided free function.

typedef int(* iarray_cmp_f )(const void *a, const void *b, void *cookie)
 User provided compare function.


Functions

int iarray_create (iarray_t *a, iarray_alloc_f alloc, iarray_free_f free, void *cookie)
 Create and initialized.

void iarray_destroy (iarray_t *a)
 Destroy.

int iarray_clear (iarray_t *a)
 Remove all elements.

void * iarray_addrof (iarray_t *a, int idx)
iarray_elt_tiarray_eltof (iarray_t *a, int idx)
int iarray_get (iarray_t *a, int idx, void *elt, int eltsize)
int iarray_find (iarray_t *a, const void *what, iarray_cmp_f cmp, void *cookie)
iarray_elt_tiarray_dup (iarray_t *a, int idx)
int iarray_set (iarray_t *a, int idx, void *elt, unsigned int eltsize)
int iarray_insert (iarray_t *a, int idx, void *elt, unsigned int eltsize)
int iarray_remove (iarray_t *a, int idx)
void iarray_lock (iarray_t *a)
 Lock the array for thread safe modification.

void iarray_unlock (iarray_t *a)
 Unlock the array for thread safe modification.

int iarray_trylock (iarray_t *a)
 Test if the array is lockable.

int iarray_lockcount (const iarray_t *a)
 Get current lock count.

void iarray_shuffle (iarray_t *a, int idx, int n)
 Shuffle a partition of the array.

void iarray_sort (iarray_t *a, iarray_cmp_f cmp, void *cookie)
 Sort the whole array.

void iarray_sort_part (iarray_t *a, int idx, int n, iarray_cmp_f cmp, void *cookie)
 Sort a partition of an array.


dcplaya documentation version 1.2 Generated on January 2004 by doxygen 1.3.5