// // Created by joey on 12/12/21. // #ifndef AOC_2021_GRID_H #define AOC_2021_GRID_H #include #include "puzzle_input.h" typedef enum { GRID_OK = 0, GRID_INDEX_OUT_OF_RANGE = -1, GRID_INVALID_RET_PTR = -2, } grid_ret_t; typedef struct { int ii; int jj; } point_t; typedef struct { void * data; size_t width; size_t height; size_t max_width; size_t max_height; size_t elem_size; } grid_t; grid_ret_t grid_init(grid_t * grid, size_t max_height, size_t max_width, size_t elem_size, void * data_store); grid_ret_t grid_get_data(const grid_t * grid, int ii, int jj, void * ret); grid_ret_t grid_set_data(const grid_t * grid, int ii, int jj, void * val); #endif //AOC_2021_GRID_H