
#ifndef _STDIO_H_
#include <stdio.h>
#endif

#ifndef _STDINT_H_
#include <stdint.h>
#endif

#ifndef _biolibc_h_
#include "biolibc.h"
#endif

#define BL_POS_LIST_INIT  { 0, 0, NULL };

typedef struct
{
    size_t      array_size;
    size_t      count;
    uint64_t    *positions;
}   bl_pos_list_t;

typedef int bl_pos_list_sort_order_t;

#define BL_POS_LIST_ASCENDING  0
#define BL_POS_LIST_DESCENDING 1

/*
 *  Generated by /home/bacon/scripts/gen-get-set
 *
 *  Accessor macros.  Use these to access structure members from functions
 *  outside the bl_pos_list_t class.
 *
 *  These generated macros are not expected to be perfect.  Check and edit
 *  as needed before adding to your code.
 */

#define BL_POS_LIST_ARRAY_SIZE(ptr)     ((ptr)->array_size)
#define BL_POS_LIST_COUNT(ptr)          ((ptr)->count)
#define BL_POS_LIST_POSITIONS(ptr)      ((ptr)->positions)
#define BL_POS_LIST_POSITIONS_AE(ptr,c) ((ptr)->positions[c])

/* pos-list.c */
void bl_pos_list_allocate(bl_pos_list_t *pos_list, size_t array_size);
void bl_pos_list_free(bl_pos_list_t *pos_list);
int bl_pos_list_add_position(bl_pos_list_t *pos_list, uint64_t position);
int bl_pos_list_from_csv(bl_pos_list_t *pos_list, const char *bounds_str, size_t array_size);
int position_cmp_ascending(const uint64_t *pos1, const uint64_t *pos2);
int position_cmp_descending(const uint64_t *pos1, const uint64_t *pos2);
void bl_pos_list_sort(bl_pos_list_t *pos_list, bl_pos_list_sort_order_t order);

/* pos-list-mutators.c */
int bl_pos_list_set_array_size(bl_pos_list_t *bl_pos_list_ptr, size_t new_array_size);
int bl_pos_list_set_count(bl_pos_list_t *bl_pos_list_ptr, size_t new_count);
int bl_pos_list_set_positions(bl_pos_list_t *bl_pos_list_ptr, uint64_t *new_positions);
int bl_pos_list_set_positions_ae(bl_pos_list_t *bl_pos_list_ptr, size_t c, uint64_t new_positions_element);
int bl_pos_list_set_positions_cpy(bl_pos_list_t *bl_pos_list_ptr, uint64_t *new_positions, size_t array_size);
