/*
 * this code is auto generated. do not edit. change the sources in tools/introspection/ instead.
 *
 * the parse tree:
 *
 * typedef
 *   struct dt_iop_rgbcurve_params_t
 *     struct dt_iop_rgbcurve_node_t
 *       float
 *       x 
 *         default: 0.0
 *         range: 0.0 .. 1.0
 * 
 *       float
 *       y 
 *         default: 0.0
 *         range: 0.0 .. 1.0
 * 
 *     curve_nodes [DT_IOP_RGBCURVE_MAX_CHANNELS][DT_IOP_RGBCURVE_MAXNODES]
 * 
 *     int
 *     curve_num_nodes [DT_IOP_RGBCURVE_MAX_CHANNELS]
 *       default: 2
 *       range: G_MININT .. G_MAXINT
 * 
 *     int
 *     curve_type [DT_IOP_RGBCURVE_MAX_CHANNELS]
 *       default: MONOTONE_HERMITE
 *       range: G_MININT .. G_MAXINT
 * 
 *     enum dt_iop_rgbcurve_autoscale_t
 *       DT_S_SCALE_AUTOMATIC_RGB : RGB, linked channels
 *       DT_S_SCALE_MANUAL_RGB : RGB, independent channels
 *     curve_autoscale 
 *       description: mode
 *       default: DT_S_SCALE_AUTOMATIC_RGB
 * 
 *     boolean
 *     compensate_middle_grey 
 *       description: compensate middle gray
 *       default: 0
 * 
 *     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
 * 
 * dt_iop_rgbcurve_params_t
 *
 */

#include "/build/darktable/src/darktable-4.0.1/src/iop/rgbcurve.c"

#ifdef __cplusplus
extern "C"
{
#endif

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

static dt_introspection_field_t introspection_linear[13+1]
#if !( defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406) )
= {
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"curve_nodes[0][0].x", (char*)"x", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes[0][0].x), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_nodes[0][0].x), NULL },
    /*Min*/ 0.0, /*Max*/ 1.0, /*Default*/ 0.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"curve_nodes[0][0].y", (char*)"y", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes[0][0].y), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_nodes[0][0].y), NULL },
    /*Min*/ 0.0, /*Max*/ 1.0, /*Default*/ 0.0
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_rgbcurve_node_t", (char*)"curve_nodes[0][0]", (char*)"curve_nodes[0][0]", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes[0][0]), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_nodes), NULL },
    /*entries*/ 2, /*fields*/ NULL
  }
},
{
  .Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"dt_iop_rgbcurve_node_t[]", (char*)"curve_nodes[0]", (char*)"curve_nodes[0]", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes[0]), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_nodes), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes[0]), /*type*/ DT_INTROSPECTION_TYPE_STRUCT, /*field*/ &introspection_linear[2]
  }
},
{
  .Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"dt_iop_rgbcurve_node_t[][]", (char*)"curve_nodes", (char*)"curve_nodes", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_nodes), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes), /*type*/ DT_INTROSPECTION_TYPE_ARRAY, /*field*/ &introspection_linear[3]
  }
},
{
  .Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"curve_num_nodes[0]", (char*)"curve_num_nodes[0]", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_num_nodes[0]), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_num_nodes), NULL },
    /*Min*/ G_MININT, /*Max*/ G_MAXINT, /*Default*/ 2
  }
},
{
  .Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"int[]", (char*)"curve_num_nodes", (char*)"curve_num_nodes", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_num_nodes), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_num_nodes), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rgbcurve_params_t*)NULL)->curve_num_nodes), /*type*/ DT_INTROSPECTION_TYPE_INT, /*field*/ &introspection_linear[5]
  }
},
{
  .Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"curve_type[0]", (char*)"curve_type[0]", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_type[0]), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_type), NULL },
    /*Min*/ G_MININT, /*Max*/ G_MAXINT, /*Default*/ MONOTONE_HERMITE
  }
},
{
  .Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"int[]", (char*)"curve_type", (char*)"curve_type", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_type), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_type), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rgbcurve_params_t*)NULL)->curve_type), /*type*/ DT_INTROSPECTION_TYPE_INT, /*field*/ &introspection_linear[7]
  }
},
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_rgbcurve_autoscale_t", (char*)"curve_autoscale", (char*)"curve_autoscale", N_((char*)"mode"), sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_autoscale), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_autoscale), NULL },
    /*entries*/ 2, /*values*/ NULL, /*Default*/ DT_S_SCALE_AUTOMATIC_RGB
  }
},
{
  .Bool = {
    { DT_INTROSPECTION_TYPE_BOOL, (char*)"bool", (char*)"compensate_middle_grey", (char*)"compensate_middle_grey", N_((char*)"compensate middle gray"), sizeof(((dt_iop_rgbcurve_params_t*)NULL)->compensate_middle_grey), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, compensate_middle_grey), NULL },
    /*Default*/ 0
  }
},
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_rgb_norms_t", (char*)"preserve_colors", (char*)"preserve_colors", N_((char*)"preserve colors"), sizeof(((dt_iop_rgbcurve_params_t*)NULL)->preserve_colors), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, preserve_colors), NULL },
    /*entries*/ 7, /*values*/ NULL, /*Default*/ DT_RGB_NORM_LUMINANCE
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_rgbcurve_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_rgbcurve_params_t), 0, NULL },
    /*entries*/ 6, /*fields*/ NULL
  }
},
  { .header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL} }
}
#endif
;

static dt_introspection_t introspection = {
  8,
  1,
  "dt_iop_rgbcurve_params_t",
  sizeof(dt_iop_rgbcurve_params_t),
  &introspection_linear[13-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].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"curve_nodes[0][0].x", (char*)"x", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes[0][0].x), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_nodes[0][0].x), NULL },
    /*Min*/ 0.0, /*Max*/ 1.0, /*Default*/ 0.0
  };
  introspection_linear[1].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"curve_nodes[0][0].y", (char*)"y", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes[0][0].y), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_nodes[0][0].y), NULL },
    /*Min*/ 0.0, /*Max*/ 1.0, /*Default*/ 0.0
  };
  introspection_linear[2].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_rgbcurve_node_t", (char*)"curve_nodes[0][0]", (char*)"curve_nodes[0][0]", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes[0][0]), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_nodes), NULL },
    /*entries*/ 2, /*fields*/ NULL
  };
  introspection_linear[3].Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"dt_iop_rgbcurve_node_t[]", (char*)"curve_nodes[0]", (char*)"curve_nodes[0]", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes[0]), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_nodes), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes[0]), /*type*/ DT_INTROSPECTION_TYPE_STRUCT, /*field*/ &introspection_linear[2]
  };
  introspection_linear[4].Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"dt_iop_rgbcurve_node_t[][]", (char*)"curve_nodes", (char*)"curve_nodes", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_nodes), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rgbcurve_params_t*)NULL)->curve_nodes), /*type*/ DT_INTROSPECTION_TYPE_ARRAY, /*field*/ &introspection_linear[3]
  };
  introspection_linear[5].Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"curve_num_nodes[0]", (char*)"curve_num_nodes[0]", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_num_nodes[0]), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_num_nodes), NULL },
    /*Min*/ G_MININT, /*Max*/ G_MAXINT, /*Default*/ 2
  };
  introspection_linear[6].Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"int[]", (char*)"curve_num_nodes", (char*)"curve_num_nodes", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_num_nodes), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_num_nodes), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rgbcurve_params_t*)NULL)->curve_num_nodes), /*type*/ DT_INTROSPECTION_TYPE_INT, /*field*/ &introspection_linear[5]
  };
  introspection_linear[7].Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"curve_type[0]", (char*)"curve_type[0]", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_type[0]), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_type), NULL },
    /*Min*/ G_MININT, /*Max*/ G_MAXINT, /*Default*/ MONOTONE_HERMITE
  };
  introspection_linear[8].Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"int[]", (char*)"curve_type", (char*)"curve_type", (char*)"", sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_type), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_type), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rgbcurve_params_t*)NULL)->curve_type), /*type*/ DT_INTROSPECTION_TYPE_INT, /*field*/ &introspection_linear[7]
  };
  introspection_linear[9].Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_rgbcurve_autoscale_t", (char*)"curve_autoscale", (char*)"curve_autoscale", N_((char*)"mode"), sizeof(((dt_iop_rgbcurve_params_t*)NULL)->curve_autoscale), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, curve_autoscale), NULL },
    /*entries*/ 2, /*values*/ NULL, /*Default*/ DT_S_SCALE_AUTOMATIC_RGB
  };
  introspection_linear[10].Bool = {
    { DT_INTROSPECTION_TYPE_BOOL, (char*)"bool", (char*)"compensate_middle_grey", (char*)"compensate_middle_grey", N_((char*)"compensate middle gray"), sizeof(((dt_iop_rgbcurve_params_t*)NULL)->compensate_middle_grey), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, compensate_middle_grey), NULL },
    /*Default*/ 0
  };
  introspection_linear[11].Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_rgb_norms_t", (char*)"preserve_colors", (char*)"preserve_colors", N_((char*)"preserve colors"), sizeof(((dt_iop_rgbcurve_params_t*)NULL)->preserve_colors), G_STRUCT_OFFSET(dt_iop_rgbcurve_params_t, preserve_colors), NULL },
    /*entries*/ 7, /*values*/ NULL, /*Default*/ DT_RGB_NORM_LUMINANCE
  };
  introspection_linear[12].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_rgbcurve_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_rgbcurve_params_t), 0, NULL },
    /*entries*/ 6, /*fields*/ NULL
  };
  introspection_linear[13].header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL};
#endif

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

  static dt_introspection_field_t *f2[] = {
    &introspection_linear[0],
    &introspection_linear[1],
    NULL
  };
  static dt_introspection_type_enum_tuple_t f9[] = { 
    { "DT_S_SCALE_AUTOMATIC_RGB", DT_S_SCALE_AUTOMATIC_RGB, N_((char*)"RGB, linked channels") },
    { "DT_S_SCALE_MANUAL_RGB", DT_S_SCALE_MANUAL_RGB, N_((char*)"RGB, independent channels") },
    { NULL, 0 },
  };
  static dt_introspection_type_enum_tuple_t f11[] = { 
    { "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 *f12[] = {
    &introspection_linear[4],
    &introspection_linear[6],
    &introspection_linear[8],
    &introspection_linear[9],
    &introspection_linear[10],
    &introspection_linear[11],
    NULL
  };

  introspection_linear[2].Struct.fields = f2;
  introspection_linear[9].Enum.values = f9;
  introspection_linear[11].Enum.values = f11;
  introspection_linear[12].Struct.fields = f12;

  return 0;
}

void * get_p(const void * param, const char * name)
{
  dt_iop_rgbcurve_params_t * p = (dt_iop_rgbcurve_params_t*)param;
  if(!strcmp(name, "curve_nodes[0][0].x"))
    return &(p->curve_nodes[0][0].x);
  else if(!strcmp(name, "curve_nodes[0][0].y"))
    return &(p->curve_nodes[0][0].y);
  else if(!strcmp(name, "curve_nodes[0][0]"))
    return &(p->curve_nodes[0][0]);
  else if(!strcmp(name, "curve_nodes[0]"))
    return &(p->curve_nodes[0]);
  else if(!strcmp(name, "curve_nodes"))
    return &(p->curve_nodes);
  else if(!strcmp(name, "curve_num_nodes[0]"))
    return &(p->curve_num_nodes[0]);
  else if(!strcmp(name, "curve_num_nodes"))
    return &(p->curve_num_nodes);
  else if(!strcmp(name, "curve_type[0]"))
    return &(p->curve_type[0]);
  else if(!strcmp(name, "curve_type"))
    return &(p->curve_type);
  else if(!strcmp(name, "curve_autoscale"))
    return &(p->curve_autoscale);
  else if(!strcmp(name, "compensate_middle_grey"))
    return &(p->compensate_middle_grey);
  else if(!strcmp(name, "preserve_colors"))
    return &(p->preserve_colors);
  else
    return NULL;
}

dt_introspection_field_t * get_f(const char * name)
{
  if(!strcmp(name, "curve_nodes[0][0].x"))
    return &(introspection_linear[0]);
  else if(!strcmp(name, "curve_nodes[0][0].y"))
    return &(introspection_linear[1]);
  else if(!strcmp(name, "curve_nodes[0][0]"))
    return &(introspection_linear[2]);
  else if(!strcmp(name, "curve_nodes[0]"))
    return &(introspection_linear[3]);
  else if(!strcmp(name, "curve_nodes"))
    return &(introspection_linear[4]);
  else if(!strcmp(name, "curve_num_nodes[0]"))
    return &(introspection_linear[5]);
  else if(!strcmp(name, "curve_num_nodes"))
    return &(introspection_linear[6]);
  else if(!strcmp(name, "curve_type[0]"))
    return &(introspection_linear[7]);
  else if(!strcmp(name, "curve_type"))
    return &(introspection_linear[8]);
  else if(!strcmp(name, "curve_autoscale"))
    return &(introspection_linear[9]);
  else if(!strcmp(name, "compensate_middle_grey"))
    return &(introspection_linear[10]);
  else if(!strcmp(name, "preserve_colors"))
    return &(introspection_linear[11]);
  else
    return NULL;
}

#ifdef __cplusplus
}
#endif

