PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ rtpg_summarystats_arg_init()

static rtpg_summarystats_arg rtpg_summarystats_arg_init ( )
static

Definition at line 518 of file rtpg_statistics.c.

References rtpg_summarystats_arg_t::band_index, rtpg_summarystats_arg_t::cK, rtpg_summarystats_arg_t::cM, rt_bandstats_t::count, rtpg_summarystats_arg_t::cQ, rtpg_summarystats_arg_t::exclude_nodata_value, rt_bandstats_t::max, rt_bandstats_t::mean, rt_bandstats_t::min, PG_FUNCTION_INFO_V1(), RASTER_summaryStats_transfn(), rtpg_summarystats_arg_destroy(), rtpg_summarystats_arg_t::sample, rt_bandstats_t::sample, rt_bandstats_t::sorted, rtpg_summarystats_arg_t::stats, rt_bandstats_t::stddev, rt_bandstats_t::sum, TRUE, and rt_bandstats_t::values.

Referenced by RASTER_summaryStats_transfn().

518  {
519  rtpg_summarystats_arg arg = NULL;
520 
521  arg = palloc(sizeof(struct rtpg_summarystats_arg_t));
522  if (arg == NULL) {
523  elog(
524  ERROR,
525  "rtpg_summarystats_arg_init: Cannot allocate memory for function arguments"
526  );
527  return NULL;
528  }
529 
530  arg->stats = (rt_bandstats) palloc(sizeof(struct rt_bandstats_t));
531  if (arg->stats == NULL) {
533  elog(
534  ERROR,
535  "rtpg_summarystats_arg_init: Cannot allocate memory for stats function argument"
536  );
537  return NULL;
538  }
539 
540  arg->stats->sample = 0;
541  arg->stats->count = 0;
542  arg->stats->min = 0;
543  arg->stats->max = 0;
544  arg->stats->sum = 0;
545  arg->stats->mean = 0;
546  arg->stats->stddev = -1;
547  arg->stats->values = NULL;
548  arg->stats->sorted = 0;
549 
550  arg->cK = 0;
551  arg->cM = 0;
552  arg->cQ = 0;
553 
554  arg->band_index = 1;
555  arg->exclude_nodata_value = TRUE;
556  arg->sample = 1;
557 
558  return arg;
559 }
uint32_t count
Definition: librtcore.h:2360
double * values
Definition: librtcore.h:2368
struct rt_bandstats_t * rt_bandstats
Definition: librtcore.h:150
static void rtpg_summarystats_arg_destroy(rtpg_summarystats_arg arg)
#define TRUE
Definition: dbfopen.c:169
Here is the call graph for this function:
Here is the caller graph for this function: