#ifndef VAL_H
#define VAL_H

/* The actual element type */
typedef struct {
	char name[16];
	double val;
} val_t;

/* Instantiate genvector for val_t using prefix vtval0_ */
#include <stdlib.h>
#include <string.h>

/* all public symbols are wrapped in GVT() */
#define GVT(x) vtval0_ ## x

/* Array elem type */
#define GVT_ELEM_TYPE val_t

/* Type that represents array lengths */
#define GVT_SIZE_TYPE size_t

/* Below this length, always double allocation size when the array grows */
#define GVT_DOUBLING_THRS 8

/* Initial array size when the first element is written */
#define GVT_START_SIZE 2

/* Optional terminator; when present, it is always appended at the end */
/* #define GVT_TERM '\0' */

/* Optional prefix for function definitions (e.g. static inline) */
#define GVT_FUNC

/* Enable this to set all new bytes ever allocated to this value */
#define GVT_SET_NEW_BYTES_TO 0

/* Enable GVT_INIT_ELEM_FUNC and an user configured function is called
   for each new element allocated (even between used and alloced). */
/* #define GVT_INIT_ELEM_FUNC */

/* Enable GVT_ELEM_CONSTRUCTOR and an user configured function is called
   for each element that is getting within the range of ->used. */
/* #define GVT_ELEM_CONSTRUCTOR */

/* Enable GVT_ELEM_DESTRUCTOR and an user configured function is called
   for each element that was once constructed and now getting beyong ->used. */
/* #define GVT_ELEM_DESTRUCTOR */

/* Enable GVT_ELEM_COPY and an user configured function is called
   for copying elements into the array. */
/* #define GVT_ELEM_COPY */

/* Optional extra fields in the vector struct */
/* #define GVT_USER_FIELDS int t; */

/* Include the actual header implementation */
#include <genvector/genvector_impl.h>

/* Memory allocator */
#define GVT_REALLOC(vect, ptr, size)  realloc(ptr, size)
#define GVT_FREE(vect, ptr)           free(ptr)

/* clean up #defines */
#include <genvector/genvector_undef.h>

#endif
