/*
 * this code is auto generated. do not edit. change the sources in tools/introspection/ instead.
 *
 * the parse tree:
 *
 * typedef
 *   struct dt_iop_rawprepare_params_t
 *     int
 *     x 
 *       description: crop left
 *       default: 0
 *       range: 0 .. UINT16_MAX
 * 
 *     int
 *     y 
 *       description: crop top
 *       default: 0
 *       range: 0 .. UINT16_MAX
 * 
 *     int
 *     width 
 *       description: crop right
 *       default: 0
 *       range: 0 .. UINT16_MAX
 * 
 *     int
 *     height 
 *       description: crop bottom
 *       default: 0
 *       range: 0 .. UINT16_MAX
 * 
 *     unsigned short
 *     raw_black_level_separate [4]
 *       description: black level
 *       default: 0
 *       range: 0 .. UINT16_MAX
 * 
 *     unsigned short
 *     raw_white_point 
 *       description: white point
 *       default: 0
 *       range: 0 .. UINT16_MAX
 * 
 *     enum dt_iop_rawprepare_flat_field_t
 *       FLAT_FIELD_OFF : disabled
 *       FLAT_FIELD_EMBEDDED : embedded GainMap
 *     flat_field 
 *       description: flat field correction
 *       default: FLAT_FIELD_OFF
 * 
 * dt_iop_rawprepare_params_t
 *
 */

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

#ifdef __cplusplus
extern "C"
{
#endif

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

static dt_introspection_field_t introspection_linear[9+1]
#if !( defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406) )
= {
{
  .Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"x", (char*)"x", N_((char*)"crop left"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->x), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, x), NULL },
    /*Min*/ 0, /*Max*/ UINT16_MAX, /*Default*/ 0
  }
},
{
  .Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"y", (char*)"y", N_((char*)"crop top"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->y), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, y), NULL },
    /*Min*/ 0, /*Max*/ UINT16_MAX, /*Default*/ 0
  }
},
{
  .Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"width", (char*)"width", N_((char*)"crop right"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->width), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, width), NULL },
    /*Min*/ 0, /*Max*/ UINT16_MAX, /*Default*/ 0
  }
},
{
  .Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"height", (char*)"height", N_((char*)"crop bottom"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->height), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, height), NULL },
    /*Min*/ 0, /*Max*/ UINT16_MAX, /*Default*/ 0
  }
},
{
  .UShort = {
    { DT_INTROSPECTION_TYPE_USHORT, (char*)"ushort", (char*)"raw_black_level_separate[0]", (char*)"raw_black_level_separate[0]", N_((char*)"black level"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->raw_black_level_separate[0]), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, raw_black_level_separate), NULL },
    /*Min*/ 0, /*Max*/ UINT16_MAX, /*Default*/ 0
  }
},
{
  .Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"ushort[]", (char*)"raw_black_level_separate", (char*)"raw_black_level_separate", N_((char*)"black level"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->raw_black_level_separate), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, raw_black_level_separate), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rawprepare_params_t*)NULL)->raw_black_level_separate), /*type*/ DT_INTROSPECTION_TYPE_USHORT, /*field*/ &introspection_linear[4]
  }
},
{
  .UShort = {
    { DT_INTROSPECTION_TYPE_USHORT, (char*)"ushort", (char*)"raw_white_point", (char*)"raw_white_point", N_((char*)"white point"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->raw_white_point), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, raw_white_point), NULL },
    /*Min*/ 0, /*Max*/ UINT16_MAX, /*Default*/ 0
  }
},
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_rawprepare_flat_field_t", (char*)"flat_field", (char*)"flat_field", N_((char*)"flat field correction"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->flat_field), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, flat_field), NULL },
    /*entries*/ 2, /*values*/ NULL, /*Default*/ FLAT_FIELD_OFF
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_rawprepare_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_rawprepare_params_t), 0, NULL },
    /*entries*/ 7, /*fields*/ NULL
  }
},
  { .header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL} }
}
#endif
;

static dt_introspection_t introspection = {
  8,
  2,
  "dt_iop_rawprepare_params_t",
  sizeof(dt_iop_rawprepare_params_t),
  &introspection_linear[9-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].Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"x", (char*)"x", N_((char*)"crop left"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->x), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, x), NULL },
    /*Min*/ 0, /*Max*/ UINT16_MAX, /*Default*/ 0
  };
  introspection_linear[1].Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"y", (char*)"y", N_((char*)"crop top"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->y), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, y), NULL },
    /*Min*/ 0, /*Max*/ UINT16_MAX, /*Default*/ 0
  };
  introspection_linear[2].Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"width", (char*)"width", N_((char*)"crop right"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->width), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, width), NULL },
    /*Min*/ 0, /*Max*/ UINT16_MAX, /*Default*/ 0
  };
  introspection_linear[3].Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"height", (char*)"height", N_((char*)"crop bottom"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->height), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, height), NULL },
    /*Min*/ 0, /*Max*/ UINT16_MAX, /*Default*/ 0
  };
  introspection_linear[4].UShort = {
    { DT_INTROSPECTION_TYPE_USHORT, (char*)"ushort", (char*)"raw_black_level_separate[0]", (char*)"raw_black_level_separate[0]", N_((char*)"black level"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->raw_black_level_separate[0]), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, raw_black_level_separate), NULL },
    /*Min*/ 0, /*Max*/ UINT16_MAX, /*Default*/ 0
  };
  introspection_linear[5].Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"ushort[]", (char*)"raw_black_level_separate", (char*)"raw_black_level_separate", N_((char*)"black level"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->raw_black_level_separate), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, raw_black_level_separate), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_rawprepare_params_t*)NULL)->raw_black_level_separate), /*type*/ DT_INTROSPECTION_TYPE_USHORT, /*field*/ &introspection_linear[4]
  };
  introspection_linear[6].UShort = {
    { DT_INTROSPECTION_TYPE_USHORT, (char*)"ushort", (char*)"raw_white_point", (char*)"raw_white_point", N_((char*)"white point"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->raw_white_point), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, raw_white_point), NULL },
    /*Min*/ 0, /*Max*/ UINT16_MAX, /*Default*/ 0
  };
  introspection_linear[7].Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_rawprepare_flat_field_t", (char*)"flat_field", (char*)"flat_field", N_((char*)"flat field correction"), sizeof(((dt_iop_rawprepare_params_t*)NULL)->flat_field), G_STRUCT_OFFSET(dt_iop_rawprepare_params_t, flat_field), NULL },
    /*entries*/ 2, /*values*/ NULL, /*Default*/ FLAT_FIELD_OFF
  };
  introspection_linear[8].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_rawprepare_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_rawprepare_params_t), 0, NULL },
    /*entries*/ 7, /*fields*/ NULL
  };
  introspection_linear[9].header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL};
#endif

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

  static dt_introspection_type_enum_tuple_t f7[] = { 
    { "FLAT_FIELD_OFF", FLAT_FIELD_OFF, N_((char*)"disabled") },
    { "FLAT_FIELD_EMBEDDED", FLAT_FIELD_EMBEDDED, N_((char*)"embedded GainMap") },
    { NULL, 0 },
  };
  static dt_introspection_field_t *f8[] = {
    &introspection_linear[0],
    &introspection_linear[1],
    &introspection_linear[2],
    &introspection_linear[3],
    &introspection_linear[5],
    &introspection_linear[6],
    &introspection_linear[7],
    NULL
  };

  introspection_linear[7].Enum.values = f7;
  introspection_linear[8].Struct.fields = f8;

  return 0;
}

void * get_p(const void * param, const char * name)
{
  dt_iop_rawprepare_params_t * p = (dt_iop_rawprepare_params_t*)param;
  if(!strcmp(name, "x"))
    return &(p->x);
  else if(!strcmp(name, "y"))
    return &(p->y);
  else if(!strcmp(name, "width"))
    return &(p->width);
  else if(!strcmp(name, "height"))
    return &(p->height);
  else if(!strcmp(name, "raw_black_level_separate[0]"))
    return &(p->raw_black_level_separate[0]);
  else if(!strcmp(name, "raw_black_level_separate"))
    return &(p->raw_black_level_separate);
  else if(!strcmp(name, "raw_white_point"))
    return &(p->raw_white_point);
  else if(!strcmp(name, "flat_field"))
    return &(p->flat_field);
  else
    return NULL;
}

dt_introspection_field_t * get_f(const char * name)
{
  if(!strcmp(name, "x"))
    return &(introspection_linear[0]);
  else if(!strcmp(name, "y"))
    return &(introspection_linear[1]);
  else if(!strcmp(name, "width"))
    return &(introspection_linear[2]);
  else if(!strcmp(name, "height"))
    return &(introspection_linear[3]);
  else if(!strcmp(name, "raw_black_level_separate[0]"))
    return &(introspection_linear[4]);
  else if(!strcmp(name, "raw_black_level_separate"))
    return &(introspection_linear[5]);
  else if(!strcmp(name, "raw_white_point"))
    return &(introspection_linear[6]);
  else if(!strcmp(name, "flat_field"))
    return &(introspection_linear[7]);
  else
    return NULL;
}

#ifdef __cplusplus
}
#endif

