/*
 * this code is auto generated. do not edit. change the sources in tools/introspection/ instead.
 *
 * the parse tree:
 *
 * typedef
 *   struct dt_iop_basicadj_params_t
 *     float
 *     black_point 
 *       description: black level correction
 *       default: 0.0
 *       range: -1.0 .. 1.0
 * 
 *     float
 *     exposure 
 *       default: 0.0
 *       range: -18.0 .. 18.0
 * 
 *     float
 *     hlcompr 
 *       description: highlight compression
 *       default: 0.0
 *       range: 0 .. 500.0
 * 
 *     float
 *     hlcomprthresh 
 *       default: 0.0
 *       range: -G_MAXFLOAT .. G_MAXFLOAT
 * 
 *     float
 *     contrast 
 *       default: 0.0
 *       range: -1.0 .. 5.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
 * 
 *     float
 *     middle_grey 
 *       description: middle gray
 *       default: 18.42
 *       range: 0.05 .. 100
 * 
 *     float
 *     brightness 
 *       default: 0.0
 *       range: -4.0 .. 4.0
 * 
 *     float
 *     saturation 
 *       default: 0.0
 *       range: -1.0 .. 1.0
 * 
 *     float
 *     vibrance 
 *       default: 0.0
 *       range: -1.0 .. 1.0
 * 
 *     float
 *     clip 
 *       default: 0.0
 *       range: -1.0 .. 1.0
 * 
 * dt_iop_basicadj_params_t
 *
 */

#include "/build/darktable/src/darktable-4.0.1/src/iop/basicadj.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) )
= {
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"black_point", (char*)"black_point", N_((char*)"black level correction"), sizeof(((dt_iop_basicadj_params_t*)NULL)->black_point), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, black_point), NULL },
    /*Min*/ -1.0, /*Max*/ 1.0, /*Default*/ 0.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"exposure", (char*)"exposure", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->exposure), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, exposure), NULL },
    /*Min*/ -18.0, /*Max*/ 18.0, /*Default*/ 0.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"hlcompr", (char*)"hlcompr", N_((char*)"highlight compression"), sizeof(((dt_iop_basicadj_params_t*)NULL)->hlcompr), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, hlcompr), NULL },
    /*Min*/ 0, /*Max*/ 500.0, /*Default*/ 0.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"hlcomprthresh", (char*)"hlcomprthresh", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->hlcomprthresh), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, hlcomprthresh), NULL },
    /*Min*/ -G_MAXFLOAT, /*Max*/ G_MAXFLOAT, /*Default*/ 0.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"contrast", (char*)"contrast", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->contrast), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, contrast), NULL },
    /*Min*/ -1.0, /*Max*/ 5.0, /*Default*/ 0.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_basicadj_params_t*)NULL)->preserve_colors), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, preserve_colors), NULL },
    /*entries*/ 7, /*values*/ NULL, /*Default*/ DT_RGB_NORM_LUMINANCE
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"middle_grey", (char*)"middle_grey", N_((char*)"middle gray"), sizeof(((dt_iop_basicadj_params_t*)NULL)->middle_grey), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, middle_grey), NULL },
    /*Min*/ 0.05, /*Max*/ 100, /*Default*/ 18.42
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"brightness", (char*)"brightness", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->brightness), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, brightness), NULL },
    /*Min*/ -4.0, /*Max*/ 4.0, /*Default*/ 0.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"saturation", (char*)"saturation", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->saturation), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, saturation), NULL },
    /*Min*/ -1.0, /*Max*/ 1.0, /*Default*/ 0.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"vibrance", (char*)"vibrance", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->vibrance), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, vibrance), NULL },
    /*Min*/ -1.0, /*Max*/ 1.0, /*Default*/ 0.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"clip", (char*)"clip", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->clip), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, clip), NULL },
    /*Min*/ -1.0, /*Max*/ 1.0, /*Default*/ 0.0
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_basicadj_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_basicadj_params_t), 0, NULL },
    /*entries*/ 11, /*fields*/ NULL
  }
},
  { .header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL} }
}
#endif
;

static dt_introspection_t introspection = {
  8,
  2,
  "dt_iop_basicadj_params_t",
  sizeof(dt_iop_basicadj_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].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"black_point", (char*)"black_point", N_((char*)"black level correction"), sizeof(((dt_iop_basicadj_params_t*)NULL)->black_point), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, black_point), NULL },
    /*Min*/ -1.0, /*Max*/ 1.0, /*Default*/ 0.0
  };
  introspection_linear[1].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"exposure", (char*)"exposure", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->exposure), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, exposure), NULL },
    /*Min*/ -18.0, /*Max*/ 18.0, /*Default*/ 0.0
  };
  introspection_linear[2].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"hlcompr", (char*)"hlcompr", N_((char*)"highlight compression"), sizeof(((dt_iop_basicadj_params_t*)NULL)->hlcompr), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, hlcompr), NULL },
    /*Min*/ 0, /*Max*/ 500.0, /*Default*/ 0.0
  };
  introspection_linear[3].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"hlcomprthresh", (char*)"hlcomprthresh", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->hlcomprthresh), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, hlcomprthresh), NULL },
    /*Min*/ -G_MAXFLOAT, /*Max*/ G_MAXFLOAT, /*Default*/ 0.0
  };
  introspection_linear[4].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"contrast", (char*)"contrast", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->contrast), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, contrast), NULL },
    /*Min*/ -1.0, /*Max*/ 5.0, /*Default*/ 0.0
  };
  introspection_linear[5].Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_rgb_norms_t", (char*)"preserve_colors", (char*)"preserve_colors", N_((char*)"preserve colors"), sizeof(((dt_iop_basicadj_params_t*)NULL)->preserve_colors), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, preserve_colors), NULL },
    /*entries*/ 7, /*values*/ NULL, /*Default*/ DT_RGB_NORM_LUMINANCE
  };
  introspection_linear[6].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"middle_grey", (char*)"middle_grey", N_((char*)"middle gray"), sizeof(((dt_iop_basicadj_params_t*)NULL)->middle_grey), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, middle_grey), NULL },
    /*Min*/ 0.05, /*Max*/ 100, /*Default*/ 18.42
  };
  introspection_linear[7].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"brightness", (char*)"brightness", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->brightness), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, brightness), NULL },
    /*Min*/ -4.0, /*Max*/ 4.0, /*Default*/ 0.0
  };
  introspection_linear[8].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"saturation", (char*)"saturation", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->saturation), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, saturation), NULL },
    /*Min*/ -1.0, /*Max*/ 1.0, /*Default*/ 0.0
  };
  introspection_linear[9].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"vibrance", (char*)"vibrance", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->vibrance), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, vibrance), NULL },
    /*Min*/ -1.0, /*Max*/ 1.0, /*Default*/ 0.0
  };
  introspection_linear[10].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"clip", (char*)"clip", (char*)"", sizeof(((dt_iop_basicadj_params_t*)NULL)->clip), G_STRUCT_OFFSET(dt_iop_basicadj_params_t, clip), NULL },
    /*Min*/ -1.0, /*Max*/ 1.0, /*Default*/ 0.0
  };
  introspection_linear[11].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_basicadj_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_basicadj_params_t), 0, NULL },
    /*entries*/ 11, /*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 f5[] = { 
    { "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 *f11[] = {
    &introspection_linear[0],
    &introspection_linear[1],
    &introspection_linear[2],
    &introspection_linear[3],
    &introspection_linear[4],
    &introspection_linear[5],
    &introspection_linear[6],
    &introspection_linear[7],
    &introspection_linear[8],
    &introspection_linear[9],
    &introspection_linear[10],
    NULL
  };

  introspection_linear[5].Enum.values = f5;
  introspection_linear[11].Struct.fields = f11;

  return 0;
}

void * get_p(const void * param, const char * name)
{
  dt_iop_basicadj_params_t * p = (dt_iop_basicadj_params_t*)param;
  if(!strcmp(name, "black_point"))
    return &(p->black_point);
  else if(!strcmp(name, "exposure"))
    return &(p->exposure);
  else if(!strcmp(name, "hlcompr"))
    return &(p->hlcompr);
  else if(!strcmp(name, "hlcomprthresh"))
    return &(p->hlcomprthresh);
  else if(!strcmp(name, "contrast"))
    return &(p->contrast);
  else if(!strcmp(name, "preserve_colors"))
    return &(p->preserve_colors);
  else if(!strcmp(name, "middle_grey"))
    return &(p->middle_grey);
  else if(!strcmp(name, "brightness"))
    return &(p->brightness);
  else if(!strcmp(name, "saturation"))
    return &(p->saturation);
  else if(!strcmp(name, "vibrance"))
    return &(p->vibrance);
  else if(!strcmp(name, "clip"))
    return &(p->clip);
  else
    return NULL;
}

dt_introspection_field_t * get_f(const char * name)
{
  if(!strcmp(name, "black_point"))
    return &(introspection_linear[0]);
  else if(!strcmp(name, "exposure"))
    return &(introspection_linear[1]);
  else if(!strcmp(name, "hlcompr"))
    return &(introspection_linear[2]);
  else if(!strcmp(name, "hlcomprthresh"))
    return &(introspection_linear[3]);
  else if(!strcmp(name, "contrast"))
    return &(introspection_linear[4]);
  else if(!strcmp(name, "preserve_colors"))
    return &(introspection_linear[5]);
  else if(!strcmp(name, "middle_grey"))
    return &(introspection_linear[6]);
  else if(!strcmp(name, "brightness"))
    return &(introspection_linear[7]);
  else if(!strcmp(name, "saturation"))
    return &(introspection_linear[8]);
  else if(!strcmp(name, "vibrance"))
    return &(introspection_linear[9]);
  else if(!strcmp(name, "clip"))
    return &(introspection_linear[10]);
  else
    return NULL;
}

#ifdef __cplusplus
}
#endif

