| 1 |
/*! |
| 2 |
\file gk_struct.h |
| 3 |
\brief This file contains various datastructures used/provided by GKlib |
| 4 |
|
| 5 |
\date Started 3/27/2007 |
| 6 |
\author George |
| 7 |
\version\verbatim $Id: gk_struct.h 21988 2018-04-16 00:11:19Z karypis $ \endverbatim |
| 8 |
*/ |
| 9 |
|
| 10 |
#ifndef _GK_STRUCT_H_ |
| 11 |
#define _GK_STRUCT_H_ |
| 12 |
|
| 13 |
|
| 14 |
/********************************************************************/ |
| 15 |
/*! Generator for gk_??KeyVal_t data structure */ |
| 16 |
/********************************************************************/ |
| 17 |
#define GK_MKKEYVALUE_T(NAME, KEYTYPE, VALTYPE) \ |
| 18 |
typedef struct {\ |
| 19 |
KEYTYPE key;\ |
| 20 |
VALTYPE val;\ |
| 21 |
} NAME;\ |
| 22 |
|
| 23 |
/********************************************************************/ |
| 24 |
/*! Generator for gk_?pq_t data structure */ |
| 25 |
/********************************************************************/ |
| 26 |
#define GK_MKPQUEUE_T(NAME, KVTYPE)\ |
| 27 |
typedef struct {\ |
| 28 |
size_t nnodes;\ |
| 29 |
size_t maxnodes;\ |
| 30 |
\ |
| 31 |
/* Heap version of the data structure */ \ |
| 32 |
KVTYPE *heap;\ |
| 33 |
ssize_t *locator;\ |
| 34 |
} NAME;\ |
| 35 |
|
| 36 |
|
| 37 |
/*************************************************************************/ |
| 38 |
/*! The following data structure stores information about a memory |
| 39 |
allocation operation that can either be served from gk_mcore_t or by |
| 40 |
a gk_malloc if not sufficient workspace memory is available. */ |
| 41 |
/*************************************************************************/ |
| 42 |
typedef struct gk_mop_t { |
| 43 |
int type; |
| 44 |
ssize_t nbytes; |
| 45 |
void *ptr; |
| 46 |
} gk_mop_t; |
| 47 |
|
| 48 |
|
| 49 |
/*************************************************************************/ |
| 50 |
/*! The following structure defines the mcore for GKlib's customized |
| 51 |
memory allocations. */ |
| 52 |
/*************************************************************************/ |
| 53 |
typedef struct gk_mcore_t { |
| 54 |
/* Workspace information */ |
| 55 |
size_t coresize; /*!< The amount of core memory that has been allocated */ |
| 56 |
size_t corecpos; /*!< Index of the first free location in core */ |
| 57 |
void *core; /*!< Pointer to the core itself */ |
| 58 |
|
| 59 |
/* These are for implementing a stack-based allocation scheme using both |
| 60 |
core and also dynamically allocated memory */ |
| 61 |
size_t nmops; /*!< The number of maop_t entries that have been allocated */ |
| 62 |
size_t cmop; /*!< Index of the first free location in maops */ |
| 63 |
gk_mop_t *mops; /*!< The array recording the maop_t operations */ |
| 64 |
} gk_mcore_t; |
| 65 |
|
| 66 |
#endif |