/*
 * this code is auto generated. do not edit. change the sources in tools/introspection/ instead.
 *
 * the parse tree:
 *
 * typedef
 *   struct dt_iop_global_tonemap_params_t
 *     enum _iop_operator_t
 *       OPERATOR_REINHARD : reinhard
 *       OPERATOR_FILMIC : filmic
 *       OPERATOR_DRAGO : drago
 *     operator 
 *       default: OPERATOR_DRAGO
 * 
 *     struct 
 *       float
 *       bias 
 *         description: bias
 *         default: 0.85
 *         range: 0.5 .. 1
 * 
 *       float
 *       max_light 
 *         description: target
 *         default: 100.0
 *         range: 1 .. 500
 * 
 *     drago 
 * 
 *     float
 *     detail 
 *       default: 0.0
 *       range: -1.0 .. 1.0
 * 
 * dt_iop_global_tonemap_params_t
 *
 */

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

#ifdef __cplusplus
extern "C"
{
#endif

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

static dt_introspection_field_t introspection_linear[6+1]
#if !( defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406) )
= {
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"_iop_operator_t", (char*)"operator", (char*)"operator", (char*)"", sizeof(((dt_iop_global_tonemap_params_t*)NULL)->operator), G_STRUCT_OFFSET(dt_iop_global_tonemap_params_t, operator), NULL },
    /*entries*/ 3, /*values*/ NULL, /*Default*/ OPERATOR_DRAGO
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"drago.bias", (char*)"bias", N_((char*)"bias"), sizeof(((dt_iop_global_tonemap_params_t*)NULL)->drago.bias), G_STRUCT_OFFSET(dt_iop_global_tonemap_params_t, drago.bias), NULL },
    /*Min*/ 0.5, /*Max*/ 1, /*Default*/ 0.85
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"drago.max_light", (char*)"max_light", N_((char*)"target"), sizeof(((dt_iop_global_tonemap_params_t*)NULL)->drago.max_light), G_STRUCT_OFFSET(dt_iop_global_tonemap_params_t, drago.max_light), NULL },
    /*Min*/ 1, /*Max*/ 500, /*Default*/ 100.0
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"", (char*)"drago", (char*)"drago", (char*)"", sizeof(((dt_iop_global_tonemap_params_t*)NULL)->drago), G_STRUCT_OFFSET(dt_iop_global_tonemap_params_t, drago), NULL },
    /*entries*/ 2, /*fields*/ NULL
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"detail", (char*)"detail", (char*)"", sizeof(((dt_iop_global_tonemap_params_t*)NULL)->detail), G_STRUCT_OFFSET(dt_iop_global_tonemap_params_t, detail), NULL },
    /*Min*/ -1.0, /*Max*/ 1.0, /*Default*/ 0.0
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_global_tonemap_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_global_tonemap_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,
  3,
  "dt_iop_global_tonemap_params_t",
  sizeof(dt_iop_global_tonemap_params_t),
  &introspection_linear[6-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*)"_iop_operator_t", (char*)"operator", (char*)"operator", (char*)"", sizeof(((dt_iop_global_tonemap_params_t*)NULL)->operator), G_STRUCT_OFFSET(dt_iop_global_tonemap_params_t, operator), NULL },
    /*entries*/ 3, /*values*/ NULL, /*Default*/ OPERATOR_DRAGO
  };
  introspection_linear[1].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"drago.bias", (char*)"bias", N_((char*)"bias"), sizeof(((dt_iop_global_tonemap_params_t*)NULL)->drago.bias), G_STRUCT_OFFSET(dt_iop_global_tonemap_params_t, drago.bias), NULL },
    /*Min*/ 0.5, /*Max*/ 1, /*Default*/ 0.85
  };
  introspection_linear[2].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"drago.max_light", (char*)"max_light", N_((char*)"target"), sizeof(((dt_iop_global_tonemap_params_t*)NULL)->drago.max_light), G_STRUCT_OFFSET(dt_iop_global_tonemap_params_t, drago.max_light), NULL },
    /*Min*/ 1, /*Max*/ 500, /*Default*/ 100.0
  };
  introspection_linear[3].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"", (char*)"drago", (char*)"drago", (char*)"", sizeof(((dt_iop_global_tonemap_params_t*)NULL)->drago), G_STRUCT_OFFSET(dt_iop_global_tonemap_params_t, drago), NULL },
    /*entries*/ 2, /*fields*/ NULL
  };
  introspection_linear[4].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"detail", (char*)"detail", (char*)"", sizeof(((dt_iop_global_tonemap_params_t*)NULL)->detail), G_STRUCT_OFFSET(dt_iop_global_tonemap_params_t, detail), NULL },
    /*Min*/ -1.0, /*Max*/ 1.0, /*Default*/ 0.0
  };
  introspection_linear[5].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_global_tonemap_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_global_tonemap_params_t), 0, NULL },
    /*entries*/ 3, /*fields*/ NULL
  };
  introspection_linear[6].header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL};
#endif

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

  static dt_introspection_type_enum_tuple_t f0[] = { 
    { "OPERATOR_REINHARD", OPERATOR_REINHARD, N_((char*)"reinhard") },
    { "OPERATOR_FILMIC", OPERATOR_FILMIC, N_((char*)"filmic") },
    { "OPERATOR_DRAGO", OPERATOR_DRAGO, N_((char*)"drago") },
    { NULL, 0 },
  };
  static dt_introspection_field_t *f3[] = {
    &introspection_linear[1],
    &introspection_linear[2],
    NULL
  };
  static dt_introspection_field_t *f5[] = {
    &introspection_linear[0],
    &introspection_linear[3],
    &introspection_linear[4],
    NULL
  };

  introspection_linear[0].Enum.values = f0;
  introspection_linear[3].Struct.fields = f3;
  introspection_linear[5].Struct.fields = f5;

  return 0;
}

void * get_p(const void * param, const char * name)
{
  dt_iop_global_tonemap_params_t * p = (dt_iop_global_tonemap_params_t*)param;
  if(!strcmp(name, "operator"))
    return &(p->operator);
  else if(!strcmp(name, "drago.bias"))
    return &(p->drago.bias);
  else if(!strcmp(name, "drago.max_light"))
    return &(p->drago.max_light);
  else if(!strcmp(name, "drago"))
    return &(p->drago);
  else if(!strcmp(name, "detail"))
    return &(p->detail);
  else
    return NULL;
}

dt_introspection_field_t * get_f(const char * name)
{
  if(!strcmp(name, "operator"))
    return &(introspection_linear[0]);
  else if(!strcmp(name, "drago.bias"))
    return &(introspection_linear[1]);
  else if(!strcmp(name, "drago.max_light"))
    return &(introspection_linear[2]);
  else if(!strcmp(name, "drago"))
    return &(introspection_linear[3]);
  else if(!strcmp(name, "detail"))
    return &(introspection_linear[4]);
  else
    return NULL;
}

#ifdef __cplusplus
}
#endif

