PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ _rti_iterator_arg_callback_init()

static int _rti_iterator_arg_callback_init ( _rti_iterator_arg  _param)
static

Definition at line 700 of file rt_mapalgebra.c.

References _rti_iterator_arg_t::arg, _rti_iterator_arg_t::columns, rt_iterator_arg_t::columns, _rti_iterator_arg_t::count, _rti_iterator_arg_t::dimension, rt_iterator_arg_t::dst_pixel, rt_iterator_arg_t::nodata, rt_iterator_arg_t::rasters, _rti_iterator_arg_t::rows, rt_iterator_arg_t::rows, rtalloc(), rterror(), rt_iterator_arg_t::src_pixel, and rt_iterator_arg_t::values.

Referenced by rt_raster_iterator().

700  {
701  int i = 0;
702 
703  _param->arg = rtalloc(sizeof(struct rt_iterator_arg_t));
704  if (_param->arg == NULL) {
705  rterror("_rti_iterator_arg_callback_init: Could not allocate memory for rt_iterator_arg");
706  return 0;
707  }
708 
709  _param->arg->values = NULL;
710  _param->arg->nodata = NULL;
711  _param->arg->src_pixel = NULL;
712 
713  /* initialize argument components */
714  _param->arg->values = rtalloc(sizeof(double **) * _param->count);
715  _param->arg->nodata = rtalloc(sizeof(int **) * _param->count);
716  _param->arg->src_pixel = rtalloc(sizeof(int *) * _param->count);
717  if (_param->arg->values == NULL || _param->arg->nodata == NULL || _param->arg->src_pixel == NULL) {
718  rterror("_rti_iterator_arg_callback_init: Could not allocate memory for element of rt_iterator_arg");
719  return 0;
720  }
721  memset(_param->arg->values, 0, sizeof(double **) * _param->count);
722  memset(_param->arg->nodata, 0, sizeof(int **) * _param->count);
723 
724  /* initialize pos */
725  for (i = 0; i < _param->count; i++) {
726 
727  _param->arg->src_pixel[i] = rtalloc(sizeof(int) * 2);
728  if (_param->arg->src_pixel[i] == NULL) {
729  rterror("_rti_iterator_arg_callback_init: Could not allocate memory for position elements of rt_iterator_arg");
730  return 0;
731  }
732  memset(_param->arg->src_pixel[i], 0, sizeof(int) * 2);
733  }
734 
735  _param->arg->rasters = _param->count;
736  _param->arg->rows = _param->dimension.rows;
737  _param->arg->columns = _param->dimension.columns;
738 
739  _param->arg->dst_pixel[0] = 0;
740  _param->arg->dst_pixel[1] = 0;
741 
742  return 1;
743 }
struct _rti_iterator_arg_t::@10 dimension
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
Definition: rt_context.c:199
void * rtalloc(size_t size)
Wrappers used for managing memory.
Definition: rt_context.c:171
rt_iterator_arg arg
uint32_t columns
Definition: librtcore.h:2406
uint16_t rasters
Definition: librtcore.h:2402
double *** values
Definition: librtcore.h:2410
Here is the call graph for this function:
Here is the caller graph for this function: