/*
 * this code is auto generated. do not edit. change the sources in tools/introspection/ instead.
 *
 * the parse tree:
 *
 * typedef
 *   struct dt_iop_defringe_params_t
 *     float
 *     radius 
 *       description: edge detection radius
 *       default: 4.0
 *       range: 0.5 .. 20.0
 * 
 *     float
 *     thresh 
 *       description: threshold
 *       default: 20.0
 *       range: 0.5 .. 128.0
 * 
 *     enum dt_iop_defringe_mode_t
 *       MODE_GLOBAL_AVERAGE : global average (fast)
 *       MODE_LOCAL_AVERAGE : local average (slow)
 *       MODE_STATIC : static threshold (fast)
 *     op_mode 
 *       description: operation mode
 *       default: MODE_GLOBAL_AVERAGE
 * 
 * dt_iop_defringe_params_t
 *
 */

#include "/build/darktable/src/darktable-5.6.0/src/iop/defringe.c"

#ifdef __cplusplus
extern "C"
{
#endif

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

static dt_introspection_field_t introspection_linear[4+1]
#if !( defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406) )
= {
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"radius", (char*)"radius", N_((char*)"edge detection radius"), sizeof(((dt_iop_defringe_params_t*)NULL)->radius), G_STRUCT_OFFSET(dt_iop_defringe_params_t, radius), NULL },
    /*Min*/ 0.5, /*Max*/ 20.0, /*Default*/ 4.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"thresh", (char*)"thresh", N_((char*)"threshold"), sizeof(((dt_iop_defringe_params_t*)NULL)->thresh), G_STRUCT_OFFSET(dt_iop_defringe_params_t, thresh), NULL },
    /*Min*/ 0.5, /*Max*/ 128.0, /*Default*/ 20.0
  }
},
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_defringe_mode_t", (char*)"op_mode", (char*)"op_mode", N_((char*)"operation mode"), sizeof(((dt_iop_defringe_params_t*)NULL)->op_mode), G_STRUCT_OFFSET(dt_iop_defringe_params_t, op_mode), NULL },
    /*entries*/ 3, /*values*/ NULL, /*Default*/ MODE_GLOBAL_AVERAGE
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_defringe_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_defringe_params_t), 0, NULL },
    /*entries*/ 3, /*fields*/ NULL
  }
},
  { .header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL} }
}
#endif
;

static dt_introspection_t introspection = {
  8,
  1,
  "dt_iop_defringe_params_t",
  sizeof(dt_iop_defringe_params_t),
  &introspection_linear[4-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*)"radius", (char*)"radius", N_((char*)"edge detection radius"), sizeof(((dt_iop_defringe_params_t*)NULL)->radius), G_STRUCT_OFFSET(dt_iop_defringe_params_t, radius), NULL },
    /*Min*/ 0.5, /*Max*/ 20.0, /*Default*/ 4.0
  };
  introspection_linear[1].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"thresh", (char*)"thresh", N_((char*)"threshold"), sizeof(((dt_iop_defringe_params_t*)NULL)->thresh), G_STRUCT_OFFSET(dt_iop_defringe_params_t, thresh), NULL },
    /*Min*/ 0.5, /*Max*/ 128.0, /*Default*/ 20.0
  };
  introspection_linear[2].Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_defringe_mode_t", (char*)"op_mode", (char*)"op_mode", N_((char*)"operation mode"), sizeof(((dt_iop_defringe_params_t*)NULL)->op_mode), G_STRUCT_OFFSET(dt_iop_defringe_params_t, op_mode), NULL },
    /*entries*/ 3, /*values*/ NULL, /*Default*/ MODE_GLOBAL_AVERAGE
  };
  introspection_linear[3].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_defringe_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_defringe_params_t), 0, NULL },
    /*entries*/ 3, /*fields*/ NULL
  };
  introspection_linear[4].header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL};
#endif

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

  static dt_introspection_type_enum_tuple_t f2[] = { 
    { "MODE_GLOBAL_AVERAGE", MODE_GLOBAL_AVERAGE, N_((char*)"global average (fast)") },
    { "MODE_LOCAL_AVERAGE", MODE_LOCAL_AVERAGE, N_((char*)"local average (slow)") },
    { "MODE_STATIC", MODE_STATIC, N_((char*)"static threshold (fast)") },
    { NULL, 0 },
  };
  static dt_introspection_field_t *f3[] = {
    &introspection_linear[0],
    &introspection_linear[1],
    &introspection_linear[2],
    NULL
  };

  introspection_linear[2].Enum.values = f2;
  introspection_linear[3].Struct.fields = f3;

  return 0;
}

void * get_p(const void * param, const char * name)
{
  dt_iop_defringe_params_t * p = (dt_iop_defringe_params_t*)param;
  if(!strcmp(name, "radius"))
    return &(p->radius);
  else if(!strcmp(name, "thresh"))
    return &(p->thresh);
  else if(!strcmp(name, "op_mode"))
    return &(p->op_mode);
  else
    return NULL;
}

dt_introspection_field_t * get_f(const char * name)
{
  if(!g_ascii_strcasecmp(name, "radius"))
    return &(introspection_linear[0]);
  else if(!g_ascii_strcasecmp(name, "thresh"))
    return &(introspection_linear[1]);
  else if(!g_ascii_strcasecmp(name, "op_mode"))
    return &(introspection_linear[2]);
  else
    return NULL;
}

#ifdef __cplusplus
}
#endif

