/*
 * this code is auto generated. do not edit. change the sources in tools/introspection/ instead.
 *
 * the parse tree:
 *
 * typedef
 *   struct dt_iop_colorbalance_params_t
 *     enum dt_iop_colorbalance_mode_t
 *       LIFT_GAMMA_GAIN : lift, gamma, gain (ProPhoto RGB)
 *       SLOPE_OFFSET_POWER : slope, offset, power (ProPhoto RGB)
 *       LEGACY : lift, gamma, gain (sRGB)
 *     mode 
 *       default: SLOPE_OFFSET_POWER
 * 
 *     float
 *     lift [CHANNEL_SIZE]
 *       default: 1.0
 *       range: 0.0 .. 2.0
 * 
 *     float
 *     gamma [CHANNEL_SIZE]
 *       default: 1.0
 *       range: 0.0 .. 2.0
 * 
 *     float
 *     gain [CHANNEL_SIZE]
 *       default: 1.0
 *       range: 0.0 .. 2.0
 * 
 *     float
 *     saturation 
 *       description: input saturation
 *       default: 1.0
 *       range: 0.0 .. 2.0
 * 
 *     float
 *     contrast 
 *       default: 1.0
 *       range: 0.01 .. 1.99
 * 
 *     float
 *     grey 
 *       description: contrast fulcrum
 *       default: 18.0
 *       range: 0.1 .. 100.0
 * 
 *     float
 *     saturation_out 
 *       description: output saturation
 *       default: 1.0
 *       range: 0.0 .. 2.0
 * 
 * dt_iop_colorbalance_params_t
 *
 */

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

#ifdef __cplusplus
extern "C"
{
#endif

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

static dt_introspection_field_t introspection_linear[12+1]
#if !( defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406) )
= {
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_colorbalance_mode_t", (char*)"mode", (char*)"mode", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->mode), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, mode), NULL },
    /*entries*/ 3, /*values*/ NULL, /*Default*/ SLOPE_OFFSET_POWER
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"lift[0]", (char*)"lift[0]", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->lift[0]), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, lift), NULL },
    /*Min*/ 0.0, /*Max*/ 2.0, /*Default*/ 1.0
  }
},
{
  .Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"float[]", (char*)"lift", (char*)"lift", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->lift), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, lift), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_colorbalance_params_t*)NULL)->lift), /*type*/ DT_INTROSPECTION_TYPE_FLOAT, /*field*/ &introspection_linear[1]
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"gamma[0]", (char*)"gamma[0]", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->gamma[0]), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, gamma), NULL },
    /*Min*/ 0.0, /*Max*/ 2.0, /*Default*/ 1.0
  }
},
{
  .Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"float[]", (char*)"gamma", (char*)"gamma", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->gamma), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, gamma), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_colorbalance_params_t*)NULL)->gamma), /*type*/ DT_INTROSPECTION_TYPE_FLOAT, /*field*/ &introspection_linear[3]
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"gain[0]", (char*)"gain[0]", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->gain[0]), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, gain), NULL },
    /*Min*/ 0.0, /*Max*/ 2.0, /*Default*/ 1.0
  }
},
{
  .Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"float[]", (char*)"gain", (char*)"gain", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->gain), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, gain), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_colorbalance_params_t*)NULL)->gain), /*type*/ DT_INTROSPECTION_TYPE_FLOAT, /*field*/ &introspection_linear[5]
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"saturation", (char*)"saturation", N_((char*)"input saturation"), sizeof(((dt_iop_colorbalance_params_t*)NULL)->saturation), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, saturation), NULL },
    /*Min*/ 0.0, /*Max*/ 2.0, /*Default*/ 1.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"contrast", (char*)"contrast", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->contrast), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, contrast), NULL },
    /*Min*/ 0.01, /*Max*/ 1.99, /*Default*/ 1.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"grey", (char*)"grey", N_((char*)"contrast fulcrum"), sizeof(((dt_iop_colorbalance_params_t*)NULL)->grey), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, grey), NULL },
    /*Min*/ 0.1, /*Max*/ 100.0, /*Default*/ 18.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"saturation_out", (char*)"saturation_out", N_((char*)"output saturation"), sizeof(((dt_iop_colorbalance_params_t*)NULL)->saturation_out), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, saturation_out), NULL },
    /*Min*/ 0.0, /*Max*/ 2.0, /*Default*/ 1.0
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_colorbalance_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_colorbalance_params_t), 0, NULL },
    /*entries*/ 8, /*fields*/ NULL
  }
},
  { .header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL} }
}
#endif
;

static dt_introspection_t introspection = {
  8,
  3,
  "dt_iop_colorbalance_params_t",
  sizeof(dt_iop_colorbalance_params_t),
  &introspection_linear[12-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_colorbalance_mode_t", (char*)"mode", (char*)"mode", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->mode), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, mode), NULL },
    /*entries*/ 3, /*values*/ NULL, /*Default*/ SLOPE_OFFSET_POWER
  };
  introspection_linear[1].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"lift[0]", (char*)"lift[0]", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->lift[0]), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, lift), NULL },
    /*Min*/ 0.0, /*Max*/ 2.0, /*Default*/ 1.0
  };
  introspection_linear[2].Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"float[]", (char*)"lift", (char*)"lift", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->lift), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, lift), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_colorbalance_params_t*)NULL)->lift), /*type*/ DT_INTROSPECTION_TYPE_FLOAT, /*field*/ &introspection_linear[1]
  };
  introspection_linear[3].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"gamma[0]", (char*)"gamma[0]", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->gamma[0]), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, gamma), NULL },
    /*Min*/ 0.0, /*Max*/ 2.0, /*Default*/ 1.0
  };
  introspection_linear[4].Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"float[]", (char*)"gamma", (char*)"gamma", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->gamma), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, gamma), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_colorbalance_params_t*)NULL)->gamma), /*type*/ DT_INTROSPECTION_TYPE_FLOAT, /*field*/ &introspection_linear[3]
  };
  introspection_linear[5].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"gain[0]", (char*)"gain[0]", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->gain[0]), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, gain), NULL },
    /*Min*/ 0.0, /*Max*/ 2.0, /*Default*/ 1.0
  };
  introspection_linear[6].Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"float[]", (char*)"gain", (char*)"gain", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->gain), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, gain), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_colorbalance_params_t*)NULL)->gain), /*type*/ DT_INTROSPECTION_TYPE_FLOAT, /*field*/ &introspection_linear[5]
  };
  introspection_linear[7].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"saturation", (char*)"saturation", N_((char*)"input saturation"), sizeof(((dt_iop_colorbalance_params_t*)NULL)->saturation), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, saturation), NULL },
    /*Min*/ 0.0, /*Max*/ 2.0, /*Default*/ 1.0
  };
  introspection_linear[8].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"contrast", (char*)"contrast", (char*)"", sizeof(((dt_iop_colorbalance_params_t*)NULL)->contrast), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, contrast), NULL },
    /*Min*/ 0.01, /*Max*/ 1.99, /*Default*/ 1.0
  };
  introspection_linear[9].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"grey", (char*)"grey", N_((char*)"contrast fulcrum"), sizeof(((dt_iop_colorbalance_params_t*)NULL)->grey), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, grey), NULL },
    /*Min*/ 0.1, /*Max*/ 100.0, /*Default*/ 18.0
  };
  introspection_linear[10].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"saturation_out", (char*)"saturation_out", N_((char*)"output saturation"), sizeof(((dt_iop_colorbalance_params_t*)NULL)->saturation_out), G_STRUCT_OFFSET(dt_iop_colorbalance_params_t, saturation_out), NULL },
    /*Min*/ 0.0, /*Max*/ 2.0, /*Default*/ 1.0
  };
  introspection_linear[11].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_colorbalance_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_colorbalance_params_t), 0, NULL },
    /*entries*/ 8, /*fields*/ NULL
  };
  introspection_linear[12].header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL};
#endif

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

  static dt_introspection_type_enum_tuple_t f0[] = { 
    { "LIFT_GAMMA_GAIN", LIFT_GAMMA_GAIN, N_((char*)"lift, gamma, gain (ProPhoto RGB)") },
    { "SLOPE_OFFSET_POWER", SLOPE_OFFSET_POWER, N_((char*)"slope, offset, power (ProPhoto RGB)") },
    { "LEGACY", LEGACY, N_((char*)"lift, gamma, gain (sRGB)") },
    { NULL, 0 },
  };
  static dt_introspection_field_t *f11[] = {
    &introspection_linear[0],
    &introspection_linear[2],
    &introspection_linear[4],
    &introspection_linear[6],
    &introspection_linear[7],
    &introspection_linear[8],
    &introspection_linear[9],
    &introspection_linear[10],
    NULL
  };

  introspection_linear[0].Enum.values = f0;
  introspection_linear[11].Struct.fields = f11;

  return 0;
}

void * get_p(const void * param, const char * name)
{
  dt_iop_colorbalance_params_t * p = (dt_iop_colorbalance_params_t*)param;
  if(!strcmp(name, "mode"))
    return &(p->mode);
  else if(!strcmp(name, "lift[0]"))
    return &(p->lift[0]);
  else if(!strcmp(name, "lift"))
    return &(p->lift);
  else if(!strcmp(name, "gamma[0]"))
    return &(p->gamma[0]);
  else if(!strcmp(name, "gamma"))
    return &(p->gamma);
  else if(!strcmp(name, "gain[0]"))
    return &(p->gain[0]);
  else if(!strcmp(name, "gain"))
    return &(p->gain);
  else if(!strcmp(name, "saturation"))
    return &(p->saturation);
  else if(!strcmp(name, "contrast"))
    return &(p->contrast);
  else if(!strcmp(name, "grey"))
    return &(p->grey);
  else if(!strcmp(name, "saturation_out"))
    return &(p->saturation_out);
  else
    return NULL;
}

dt_introspection_field_t * get_f(const char * name)
{
  if(!strcmp(name, "mode"))
    return &(introspection_linear[0]);
  else if(!strcmp(name, "lift[0]"))
    return &(introspection_linear[1]);
  else if(!strcmp(name, "lift"))
    return &(introspection_linear[2]);
  else if(!strcmp(name, "gamma[0]"))
    return &(introspection_linear[3]);
  else if(!strcmp(name, "gamma"))
    return &(introspection_linear[4]);
  else if(!strcmp(name, "gain[0]"))
    return &(introspection_linear[5]);
  else if(!strcmp(name, "gain"))
    return &(introspection_linear[6]);
  else if(!strcmp(name, "saturation"))
    return &(introspection_linear[7]);
  else if(!strcmp(name, "contrast"))
    return &(introspection_linear[8]);
  else if(!strcmp(name, "grey"))
    return &(introspection_linear[9]);
  else if(!strcmp(name, "saturation_out"))
    return &(introspection_linear[10]);
  else
    return NULL;
}

#ifdef __cplusplus
}
#endif

