/*
 * this code is auto generated. do not edit. change the sources in tools/introspection/ instead.
 *
 * the parse tree:
 *
 * typedef
 *   struct dt_iop_profilegamma_params_t
 *     enum dt_iop_profilegamma_mode_t
 *       PROFILEGAMMA_LOG : logarithmic
 *       PROFILEGAMMA_GAMMA : gamma
 *     mode 
 *       default: PROFILEGAMMA_LOG
 * 
 *     float
 *     linear 
 *       default: 0.1
 *       range: 0.0 .. 1.0
 * 
 *     float
 *     gamma 
 *       default: 0.45
 *       range: 0.0 .. 1.0
 * 
 *     float
 *     dynamic_range 
 *       description: dynamic range
 *       default: 10.0
 *       range: 0.01 .. 32.0
 * 
 *     float
 *     grey_point 
 *       description: middle gray luma
 *       default: 18.0
 *       range: 0.1 .. 100.0
 * 
 *     float
 *     shadows_range 
 *       description: black relative exposure
 *       default: -5.0
 *       range: -16.0 .. 16.0
 * 
 *     float
 *     security_factor 
 *       description: safety factor
 *       default: 0.0
 *       range: -100.0 .. 100.0
 * 
 * dt_iop_profilegamma_params_t
 *
 */

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

#ifdef __cplusplus
extern "C"
{
#endif

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

static dt_introspection_field_t introspection_linear[8+1]
#if !( defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406) )
= {
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_profilegamma_mode_t", (char*)"mode", (char*)"mode", (char*)"", sizeof(((dt_iop_profilegamma_params_t*)NULL)->mode), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, mode), NULL },
    /*entries*/ 2, /*values*/ NULL, /*Default*/ PROFILEGAMMA_LOG
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"linear", (char*)"linear", (char*)"", sizeof(((dt_iop_profilegamma_params_t*)NULL)->linear), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, linear), NULL },
    /*Min*/ 0.0, /*Max*/ 1.0, /*Default*/ 0.1
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"gamma", (char*)"gamma", (char*)"", sizeof(((dt_iop_profilegamma_params_t*)NULL)->gamma), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, gamma), NULL },
    /*Min*/ 0.0, /*Max*/ 1.0, /*Default*/ 0.45
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"dynamic_range", (char*)"dynamic_range", N_((char*)"dynamic range"), sizeof(((dt_iop_profilegamma_params_t*)NULL)->dynamic_range), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, dynamic_range), NULL },
    /*Min*/ 0.01, /*Max*/ 32.0, /*Default*/ 10.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"grey_point", (char*)"grey_point", N_((char*)"middle gray luma"), sizeof(((dt_iop_profilegamma_params_t*)NULL)->grey_point), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, grey_point), NULL },
    /*Min*/ 0.1, /*Max*/ 100.0, /*Default*/ 18.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"shadows_range", (char*)"shadows_range", N_((char*)"black relative exposure"), sizeof(((dt_iop_profilegamma_params_t*)NULL)->shadows_range), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, shadows_range), NULL },
    /*Min*/ -16.0, /*Max*/ 16.0, /*Default*/ -5.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"security_factor", (char*)"security_factor", N_((char*)"safety factor"), sizeof(((dt_iop_profilegamma_params_t*)NULL)->security_factor), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, security_factor), NULL },
    /*Min*/ -100.0, /*Max*/ 100.0, /*Default*/ 0.0
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_profilegamma_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_profilegamma_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_profilegamma_params_t",
  sizeof(dt_iop_profilegamma_params_t),
  &introspection_linear[8-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_profilegamma_mode_t", (char*)"mode", (char*)"mode", (char*)"", sizeof(((dt_iop_profilegamma_params_t*)NULL)->mode), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, mode), NULL },
    /*entries*/ 2, /*values*/ NULL, /*Default*/ PROFILEGAMMA_LOG
  };
  introspection_linear[1].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"linear", (char*)"linear", (char*)"", sizeof(((dt_iop_profilegamma_params_t*)NULL)->linear), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, linear), NULL },
    /*Min*/ 0.0, /*Max*/ 1.0, /*Default*/ 0.1
  };
  introspection_linear[2].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"gamma", (char*)"gamma", (char*)"", sizeof(((dt_iop_profilegamma_params_t*)NULL)->gamma), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, gamma), NULL },
    /*Min*/ 0.0, /*Max*/ 1.0, /*Default*/ 0.45
  };
  introspection_linear[3].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"dynamic_range", (char*)"dynamic_range", N_((char*)"dynamic range"), sizeof(((dt_iop_profilegamma_params_t*)NULL)->dynamic_range), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, dynamic_range), NULL },
    /*Min*/ 0.01, /*Max*/ 32.0, /*Default*/ 10.0
  };
  introspection_linear[4].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"grey_point", (char*)"grey_point", N_((char*)"middle gray luma"), sizeof(((dt_iop_profilegamma_params_t*)NULL)->grey_point), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, grey_point), NULL },
    /*Min*/ 0.1, /*Max*/ 100.0, /*Default*/ 18.0
  };
  introspection_linear[5].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"shadows_range", (char*)"shadows_range", N_((char*)"black relative exposure"), sizeof(((dt_iop_profilegamma_params_t*)NULL)->shadows_range), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, shadows_range), NULL },
    /*Min*/ -16.0, /*Max*/ 16.0, /*Default*/ -5.0
  };
  introspection_linear[6].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"security_factor", (char*)"security_factor", N_((char*)"safety factor"), sizeof(((dt_iop_profilegamma_params_t*)NULL)->security_factor), G_STRUCT_OFFSET(dt_iop_profilegamma_params_t, security_factor), NULL },
    /*Min*/ -100.0, /*Max*/ 100.0, /*Default*/ 0.0
  };
  introspection_linear[7].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_profilegamma_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_profilegamma_params_t), 0, NULL },
    /*entries*/ 7, /*fields*/ NULL
  };
  introspection_linear[8].header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL};
#endif

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

  static dt_introspection_type_enum_tuple_t f0[] = { 
    { "PROFILEGAMMA_LOG", PROFILEGAMMA_LOG, N_((char*)"logarithmic") },
    { "PROFILEGAMMA_GAMMA", PROFILEGAMMA_GAMMA, N_((char*)"gamma") },
    { NULL, 0 },
  };
  static dt_introspection_field_t *f7[] = {
    &introspection_linear[0],
    &introspection_linear[1],
    &introspection_linear[2],
    &introspection_linear[3],
    &introspection_linear[4],
    &introspection_linear[5],
    &introspection_linear[6],
    NULL
  };

  introspection_linear[0].Enum.values = f0;
  introspection_linear[7].Struct.fields = f7;

  return 0;
}

void * get_p(const void * param, const char * name)
{
  dt_iop_profilegamma_params_t * p = (dt_iop_profilegamma_params_t*)param;
  if(!strcmp(name, "mode"))
    return &(p->mode);
  else if(!strcmp(name, "linear"))
    return &(p->linear);
  else if(!strcmp(name, "gamma"))
    return &(p->gamma);
  else if(!strcmp(name, "dynamic_range"))
    return &(p->dynamic_range);
  else if(!strcmp(name, "grey_point"))
    return &(p->grey_point);
  else if(!strcmp(name, "shadows_range"))
    return &(p->shadows_range);
  else if(!strcmp(name, "security_factor"))
    return &(p->security_factor);
  else
    return NULL;
}

dt_introspection_field_t * get_f(const char * name)
{
  if(!strcmp(name, "mode"))
    return &(introspection_linear[0]);
  else if(!strcmp(name, "linear"))
    return &(introspection_linear[1]);
  else if(!strcmp(name, "gamma"))
    return &(introspection_linear[2]);
  else if(!strcmp(name, "dynamic_range"))
    return &(introspection_linear[3]);
  else if(!strcmp(name, "grey_point"))
    return &(introspection_linear[4]);
  else if(!strcmp(name, "shadows_range"))
    return &(introspection_linear[5]);
  else if(!strcmp(name, "security_factor"))
    return &(introspection_linear[6]);
  else
    return NULL;
}

#ifdef __cplusplus
}
#endif

