/*
 * this code is auto generated. do not edit. change the sources in tools/introspection/ instead.
 *
 * the parse tree:
 *
 * typedef
 *   struct dt_iop_rgblevels_params_t
 *     enum dt_iop_rgblevels_autoscale_t
 *       DT_IOP_RGBLEVELS_LINKED_CHANNELS : RGB, linked channels
 *       DT_IOP_RGBLEVELS_INDEPENDENT_CHANNELS : RGB, independent channels
 *     autoscale 
 *       description: mode
 *       default: DT_IOP_RGBLEVELS_LINKED_CHANNELS
 * 
 *     enum dt_iop_rgb_norms_t
 *       DT_RGB_NORM_NONE : none
 *       DT_RGB_NORM_LUMINANCE : luminance
 *       DT_RGB_NORM_MAX : max RGB
 *       DT_RGB_NORM_AVERAGE : average RGB
 *       DT_RGB_NORM_SUM : sum RGB
 *       DT_RGB_NORM_NORM : norm RGB
 *       DT_RGB_NORM_POWER : basic power
 *     preserve_colors 
 *       description: preserve colors
 *       default: DT_RGB_NORM_LUMINANCE
 * 
 *     float
 *     levels [DT_IOP_RGBLEVELS_MAX_CHANNELS][3]
 *       default: 0.0
 *       range: -G_MAXFLOAT .. G_MAXFLOAT
 * 
 * dt_iop_rgblevels_params_t
 *
 */

#include "/build/darktable/src/darktable-5.6.0/src/iop/rgblevels.c"

#ifdef __cplusplus
extern "C"
{
#endif

#include <string.h>
#include "common/introspection.h"

static dt_introspection_field_t introspection_linear[6+1]
#if !( defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406) )
= {
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_rgblevels_autoscale_t", (char*)"autoscale", (char*)"autoscale", N_((char*)"mode"), sizeof(((dt_iop_rgblevels_params_t*)NULL)->autoscale), G_STRUCT_OFFSET(dt_iop_rgblevels_params_t, autoscale), NULL },
    /*entries*/ 2, /*values*/ NULL, /*Default*/ DT_IOP_RGBLEVELS_LINKED_CHANNELS
  }
},
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_rgb_norms_t", (char*)"preserve_colors", (char*)"preserve_colors", N_((char*)"preserve colors"), sizeof(((dt_iop_rgblevels_params_t*)NULL)->preserve_colors), G_STRUCT_OFFSET(dt_iop_rgblevels_params_t, preserve_colors), NULL },
    /*entries*/ 7, /*values*/ NULL, /*Default*/ DT_RGB_NORM_LUMINANCE
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"levels[0][0]", (char*)"levels[0][0]", (char*)"", sizeof(((dt_iop_rgblevels_params_t*)NULL)->levels[0][0]), G_STRUCT_OFFSET(dt_iop_rgblevels_params_t, levels), NULL },
    /*Min*/ -G_MAXFLOAT, /*Max*/ G_MAXFLOAT, /*Default*/ 0.0
  }
},
{
  .Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"float[]", (char*)"levels[0]", (char*)"levels[0]", (char*)"", sizeof(((dt_iop_rgblevels_params_t*)NULL)->levels[0]), G_STRUCT_OFFSET(dt_iop_rgblevels_params_t, levels), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rgblevels_params_t*)NULL)->levels[0]), /*type*/ DT_INTROSPECTION_TYPE_FLOAT, /*field*/ &introspection_linear[2]
  }
},
{
  .Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"float[][]", (char*)"levels", (char*)"levels", (char*)"", sizeof(((dt_iop_rgblevels_params_t*)NULL)->levels), G_STRUCT_OFFSET(dt_iop_rgblevels_params_t, levels), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rgblevels_params_t*)NULL)->levels), /*type*/ DT_INTROSPECTION_TYPE_ARRAY, /*field*/ &introspection_linear[3]
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_rgblevels_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_rgblevels_params_t), 0, NULL },
    /*entries*/ 3, /*fields*/ NULL
  }
},
  { .header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL} }
}
#endif
;

static dt_introspection_t introspection = {
  8,
  1,
  "dt_iop_rgblevels_params_t",
  sizeof(dt_iop_rgblevels_params_t),
  &introspection_linear[6-1],
  sizeof(dt_iop_module_t),
  G_STRUCT_OFFSET(dt_iop_module_t, default_params)
};

dt_introspection_field_t* get_introspection_linear()
{
  return introspection_linear;
}

dt_introspection_t* get_introspection()
{
  return &introspection;
}

int introspection_init(struct dt_iop_module_so_t *self, int api_version)
{
  // here we check that the generated code matches the api at compile time and also at runtime
  if(introspection.api_version != DT_INTROSPECTION_VERSION || api_version != DT_INTROSPECTION_VERSION)
    return 1;

#if defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406)
  introspection_linear[0].Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_rgblevels_autoscale_t", (char*)"autoscale", (char*)"autoscale", N_((char*)"mode"), sizeof(((dt_iop_rgblevels_params_t*)NULL)->autoscale), G_STRUCT_OFFSET(dt_iop_rgblevels_params_t, autoscale), NULL },
    /*entries*/ 2, /*values*/ NULL, /*Default*/ DT_IOP_RGBLEVELS_LINKED_CHANNELS
  };
  introspection_linear[1].Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_rgb_norms_t", (char*)"preserve_colors", (char*)"preserve_colors", N_((char*)"preserve colors"), sizeof(((dt_iop_rgblevels_params_t*)NULL)->preserve_colors), G_STRUCT_OFFSET(dt_iop_rgblevels_params_t, preserve_colors), NULL },
    /*entries*/ 7, /*values*/ NULL, /*Default*/ DT_RGB_NORM_LUMINANCE
  };
  introspection_linear[2].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"levels[0][0]", (char*)"levels[0][0]", (char*)"", sizeof(((dt_iop_rgblevels_params_t*)NULL)->levels[0][0]), G_STRUCT_OFFSET(dt_iop_rgblevels_params_t, levels), NULL },
    /*Min*/ -G_MAXFLOAT, /*Max*/ G_MAXFLOAT, /*Default*/ 0.0
  };
  introspection_linear[3].Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"float[]", (char*)"levels[0]", (char*)"levels[0]", (char*)"", sizeof(((dt_iop_rgblevels_params_t*)NULL)->levels[0]), G_STRUCT_OFFSET(dt_iop_rgblevels_params_t, levels), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rgblevels_params_t*)NULL)->levels[0]), /*type*/ DT_INTROSPECTION_TYPE_FLOAT, /*field*/ &introspection_linear[2]
  };
  introspection_linear[4].Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"float[][]", (char*)"levels", (char*)"levels", (char*)"", sizeof(((dt_iop_rgblevels_params_t*)NULL)->levels), G_STRUCT_OFFSET(dt_iop_rgblevels_params_t, levels), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rgblevels_params_t*)NULL)->levels), /*type*/ DT_INTROSPECTION_TYPE_ARRAY, /*field*/ &introspection_linear[3]
  };
  introspection_linear[5].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_rgblevels_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_rgblevels_params_t), 0, NULL },
    /*entries*/ 3, /*fields*/ NULL
  };
  introspection_linear[6].header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL};
#endif

  for(int i = 0; i <= 6; i++)
    introspection_linear[i].header.so = self;

  static dt_introspection_type_enum_tuple_t f0[] = { 
    { "DT_IOP_RGBLEVELS_LINKED_CHANNELS", DT_IOP_RGBLEVELS_LINKED_CHANNELS, N_((char*)"RGB, linked channels") },
    { "DT_IOP_RGBLEVELS_INDEPENDENT_CHANNELS", DT_IOP_RGBLEVELS_INDEPENDENT_CHANNELS, N_((char*)"RGB, independent channels") },
    { NULL, 0 },
  };
  static dt_introspection_type_enum_tuple_t f1[] = { 
    { "DT_RGB_NORM_NONE", DT_RGB_NORM_NONE, N_((char*)"none") },
    { "DT_RGB_NORM_LUMINANCE", DT_RGB_NORM_LUMINANCE, N_((char*)"luminance") },
    { "DT_RGB_NORM_MAX", DT_RGB_NORM_MAX, N_((char*)"max RGB") },
    { "DT_RGB_NORM_AVERAGE", DT_RGB_NORM_AVERAGE, N_((char*)"average RGB") },
    { "DT_RGB_NORM_SUM", DT_RGB_NORM_SUM, N_((char*)"sum RGB") },
    { "DT_RGB_NORM_NORM", DT_RGB_NORM_NORM, N_((char*)"norm RGB") },
    { "DT_RGB_NORM_POWER", DT_RGB_NORM_POWER, N_((char*)"basic power") },
    { NULL, 0 },
  };
  static dt_introspection_field_t *f5[] = {
    &introspection_linear[0],
    &introspection_linear[1],
    &introspection_linear[4],
    NULL
  };

  introspection_linear[0].Enum.values = f0;
  introspection_linear[1].Enum.values = f1;
  introspection_linear[5].Struct.fields = f5;

  return 0;
}

void * get_p(const void * param, const char * name)
{
  dt_iop_rgblevels_params_t * p = (dt_iop_rgblevels_params_t*)param;
  if(!strcmp(name, "autoscale"))
    return &(p->autoscale);
  else if(!strcmp(name, "preserve_colors"))
    return &(p->preserve_colors);
  else if(!strcmp(name, "levels[0][0]"))
    return &(p->levels[0][0]);
  else if(!strcmp(name, "levels[0]"))
    return &(p->levels[0]);
  else if(!strcmp(name, "levels"))
    return &(p->levels);
  else
    return NULL;
}

dt_introspection_field_t * get_f(const char * name)
{
  if(!g_ascii_strcasecmp(name, "autoscale"))
    return &(introspection_linear[0]);
  else if(!g_ascii_strcasecmp(name, "preserve_colors"))
    return &(introspection_linear[1]);
  else if(!g_ascii_strcasecmp(name, "levels[0][0]"))
    return &(introspection_linear[2]);
  else if(!g_ascii_strcasecmp(name, "levels[0]"))
    return &(introspection_linear[3]);
  else if(!g_ascii_strcasecmp(name, "levels"))
    return &(introspection_linear[4]);
  else
    return NULL;
}

#ifdef __cplusplus
}
#endif

