2004-02-09 23:03:03 +03:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MPI_F2C_TABLE
|
|
|
|
#define _MPI_F2C_TABLE
|
|
|
|
|
|
|
|
|
|
|
|
#include "lam/threads/mutex.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* typedefs
|
|
|
|
*/
|
2004-02-10 19:53:41 +03:00
|
|
|
typedef struct lam_pointer_array_t lam_pointer_array_t;
|
2004-02-09 23:03:03 +03:00
|
|
|
|
|
|
|
/*
|
2004-02-10 02:27:43 +03:00
|
|
|
* dynamic pointer array
|
2004-02-09 23:03:03 +03:00
|
|
|
*/
|
2004-02-10 19:53:41 +03:00
|
|
|
struct lam_pointer_array_t {
|
2004-02-10 02:27:43 +03:00
|
|
|
/* synchronization object */
|
2004-02-09 23:03:03 +03:00
|
|
|
lam_mutex_t lock;
|
2004-02-10 02:27:43 +03:00
|
|
|
/* index of lowest free element */
|
2004-02-09 23:03:03 +03:00
|
|
|
size_t lowest_free;
|
2004-02-10 02:27:43 +03:00
|
|
|
/* number of fee elements in the list */
|
2004-02-09 23:03:03 +03:00
|
|
|
size_t number_free;
|
2004-02-10 02:27:43 +03:00
|
|
|
/* size of list, i.e. number of elements in addr */
|
2004-02-09 23:03:03 +03:00
|
|
|
size_t size;
|
2004-02-10 02:27:43 +03:00
|
|
|
/* pointer to array of pointers */
|
2004-02-09 23:03:03 +03:00
|
|
|
void **addr;
|
|
|
|
};
|
|
|
|
|
2004-02-10 02:27:43 +03:00
|
|
|
/**
|
|
|
|
* Add a pointer to the array (Grow the array, if need be)
|
|
|
|
*
|
|
|
|
* @param array Pointer to array (IN)
|
|
|
|
* @param ptr Pointer value (IN)
|
|
|
|
*
|
|
|
|
* @return Index of inserted array element. Return value of
|
|
|
|
* (size_t)(-1) indicates an error.
|
|
|
|
*/
|
|
|
|
size_t lam_pointer_array_add(lam_pointer_array_t *array, void *ptr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the value of an element in array
|
|
|
|
*
|
|
|
|
* @param array Pointer to array (IN)
|
|
|
|
* @param index Index of element to be reset (IN)
|
|
|
|
* @param value New value to be set at element index (IN)
|
|
|
|
*
|
|
|
|
* @return Error code. (-1) indicates an error.
|
|
|
|
*/
|
|
|
|
int lam_pointer_array_set_item(lam_pointer_array_t *array,
|
2004-02-09 23:03:03 +03:00
|
|
|
size_t index, void *value);
|
2004-02-10 02:27:43 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the value of an element in array
|
|
|
|
*
|
|
|
|
* @param array Pointer to array (IN)
|
|
|
|
* @param index Index of element to be returned (IN)
|
|
|
|
*
|
|
|
|
* @return Error code. NULL indicates an error.
|
|
|
|
*/
|
|
|
|
void *lam_pointer_array_get_item(lam_pointer_array_t *array, size_t index);
|
2004-02-09 23:03:03 +03:00
|
|
|
|
|
|
|
#endif /* _MPI_F2C_TABLE */
|