/*
 * this code is auto generated. do not edit. change the sources in tools/introspection/ instead.
 *
 * the parse tree:
 *
 * typedef
 *   struct dt_iop_exposure_params_t
 *     enum dt_iop_exposure_mode_t
 *       EXPOSURE_MODE_MANUAL : manual
 *       EXPOSURE_MODE_DEFLICKER : automatic
 *     mode 
 *       default: EXPOSURE_MODE_MANUAL
 * 
 *     float
 *     black 
 *       description: black level correction
 *       default: 0.0
 *       range: -1.0 .. 1.0
 * 
 *     float
 *     exposure 
 *       default: 0.0
 *       range: -18.0 .. 18.0
 * 
 *     float
 *     deflicker_percentile 
 *       description: percentile
 *       default: 50.0
 *       range: 0.0 .. 100.0
 * 
 *     float
 *     deflicker_target_level 
 *       description: target level
 *       default: -4.0
 *       range: -18.0 .. 18.0
 * 
 *     boolean
 *     compensate_exposure_bias 
 *       description: compensate exposure bias
 *       default: FALSE
 * 
 * dt_iop_exposure_params_t
 *
 */

#include "/build/darktable/src/darktable-4.0.0/src/iop/exposure.c"

#ifdef __cplusplus
extern "C"
{
#endif

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

static dt_introspection_field_t introspection_linear[7+1]
#if !( defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406) )
= {
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_exposure_mode_t", (char*)"mode", (char*)"mode", (char*)"", sizeof(((dt_iop_exposure_params_t*)NULL)->mode), G_STRUCT_OFFSET(dt_iop_exposure_params_t, mode), NULL },
    /*entries*/ 2, /*values*/ NULL, /*Default*/ EXPOSURE_MODE_MANUAL
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"black", (char*)"black", N_((char*)"black level correction"), sizeof(((dt_iop_exposure_params_t*)NULL)->black), G_STRUCT_OFFSET(dt_iop_exposure_params_t, black), 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_exposure_params_t*)NULL)->exposure), G_STRUCT_OFFSET(dt_iop_exposure_params_t, exposure), NULL },
    /*Min*/ -18.0, /*Max*/ 18.0, /*Default*/ 0.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"deflicker_percentile", (char*)"deflicker_percentile", N_((char*)"percentile"), sizeof(((dt_iop_exposure_params_t*)NULL)->deflicker_percentile), G_STRUCT_OFFSET(dt_iop_exposure_params_t, deflicker_percentile), NULL },
    /*Min*/ 0.0, /*Max*/ 100.0, /*Default*/ 50.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"deflicker_target_level", (char*)"deflicker_target_level", N_((char*)"target level"), sizeof(((dt_iop_exposure_params_t*)NULL)->deflicker_target_level), G_STRUCT_OFFSET(dt_iop_exposure_params_t, deflicker_target_level), NULL },
    /*Min*/ -18.0, /*Max*/ 18.0, /*Default*/ -4.0
  }
},
{
  .Bool = {
    { DT_INTROSPECTION_TYPE_BOOL, (char*)"bool", (char*)"compensate_exposure_bias", (char*)"compensate_exposure_bias", N_((char*)"compensate exposure bias"), sizeof(((dt_iop_exposure_params_t*)NULL)->compensate_exposure_bias), G_STRUCT_OFFSET(dt_iop_exposure_params_t, compensate_exposure_bias), NULL },
    /*Default*/ FALSE
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_exposure_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_exposure_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,
  6,
  "dt_iop_exposure_params_t",
  sizeof(dt_iop_exposure_params_t),
  &introspection_linear[7-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_exposure_mode_t", (char*)"mode", (char*)"mode", (char*)"", sizeof(((dt_iop_exposure_params_t*)NULL)->mode), G_STRUCT_OFFSET(dt_iop_exposure_params_t, mode), NULL },
    /*entries*/ 2, /*values*/ NULL, /*Default*/ EXPOSURE_MODE_MANUAL
  };
  introspection_linear[1].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"black", (char*)"black", N_((char*)"black level correction"), sizeof(((dt_iop_exposure_params_t*)NULL)->black), G_STRUCT_OFFSET(dt_iop_exposure_params_t, black), NULL },
    /*Min*/ -1.0, /*Max*/ 1.0, /*Default*/ 0.0
  };
  introspection_linear[2].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"exposure", (char*)"exposure", (char*)"", sizeof(((dt_iop_exposure_params_t*)NULL)->exposure), G_STRUCT_OFFSET(dt_iop_exposure_params_t, exposure), NULL },
    /*Min*/ -18.0, /*Max*/ 18.0, /*Default*/ 0.0
  };
  introspection_linear[3].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"deflicker_percentile", (char*)"deflicker_percentile", N_((char*)"percentile"), sizeof(((dt_iop_exposure_params_t*)NULL)->deflicker_percentile), G_STRUCT_OFFSET(dt_iop_exposure_params_t, deflicker_percentile), NULL },
    /*Min*/ 0.0, /*Max*/ 100.0, /*Default*/ 50.0
  };
  introspection_linear[4].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"deflicker_target_level", (char*)"deflicker_target_level", N_((char*)"target level"), sizeof(((dt_iop_exposure_params_t*)NULL)->deflicker_target_level), G_STRUCT_OFFSET(dt_iop_exposure_params_t, deflicker_target_level), NULL },
    /*Min*/ -18.0, /*Max*/ 18.0, /*Default*/ -4.0
  };
  introspection_linear[5].Bool = {
    { DT_INTROSPECTION_TYPE_BOOL, (char*)"bool", (char*)"compensate_exposure_bias", (char*)"compensate_exposure_bias", N_((char*)"compensate exposure bias"), sizeof(((dt_iop_exposure_params_t*)NULL)->compensate_exposure_bias), G_STRUCT_OFFSET(dt_iop_exposure_params_t, compensate_exposure_bias), NULL },
    /*Default*/ FALSE
  };
  introspection_linear[6].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_exposure_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_exposure_params_t), 0, NULL },
    /*entries*/ 6, /*fields*/ NULL
  };
  introspection_linear[7].header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL};
#endif

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

  static dt_introspection_type_enum_tuple_t f0[] = { 
    { "EXPOSURE_MODE_MANUAL", EXPOSURE_MODE_MANUAL, N_((char*)"manual") },
    { "EXPOSURE_MODE_DEFLICKER", EXPOSURE_MODE_DEFLICKER, N_((char*)"automatic") },
    { NULL, 0 },
  };
  static dt_introspection_field_t *f6[] = {
    &introspection_linear[0],
    &introspection_linear[1],
    &introspection_linear[2],
    &introspection_linear[3],
    &introspection_linear[4],
    &introspection_linear[5],
    NULL
  };

  introspection_linear[0].Enum.values = f0;
  introspection_linear[6].Struct.fields = f6;

  return 0;
}

void * get_p(const void * param, const char * name)
{
  dt_iop_exposure_params_t * p = (dt_iop_exposure_params_t*)param;
  if(!strcmp(name, "mode"))
    return &(p->mode);
  else if(!strcmp(name, "black"))
    return &(p->black);
  else if(!strcmp(name, "exposure"))
    return &(p->exposure);
  else if(!strcmp(name, "deflicker_percentile"))
    return &(p->deflicker_percentile);
  else if(!strcmp(name, "deflicker_target_level"))
    return &(p->deflicker_target_level);
  else if(!strcmp(name, "compensate_exposure_bias"))
    return &(p->compensate_exposure_bias);
  else
    return NULL;
}

dt_introspection_field_t * get_f(const char * name)
{
  if(!strcmp(name, "mode"))
    return &(introspection_linear[0]);
  else if(!strcmp(name, "black"))
    return &(introspection_linear[1]);
  else if(!strcmp(name, "exposure"))
    return &(introspection_linear[2]);
  else if(!strcmp(name, "deflicker_percentile"))
    return &(introspection_linear[3]);
  else if(!strcmp(name, "deflicker_target_level"))
    return &(introspection_linear[4]);
  else if(!strcmp(name, "compensate_exposure_bias"))
    return &(introspection_linear[5]);
  else
    return NULL;
}

#ifdef __cplusplus
}
#endif

